code stringlengths 1 1.49M | file_id stringlengths 42 46 | node_count int64 0 7.38k | total_lines int64 1 20.9k | vector_dim int64 15 15 | vector_labels stringclasses 1
value | nodes stringlengths 2 3.75M | connections stringlengths 2 964k |
|---|---|---|---|---|---|---|---|
from django.contrib.gis.db import models
from django.contrib.localflavor.us.models import USStateField
class Location(models.Model):
point = models.PointField()
objects = models.GeoManager()
def __unicode__(self): return self.point.wkt
class City(models.Model):
name = models.CharField(max_length=50)
state = USStateField()
location = models.ForeignKey(Location)
objects = models.GeoManager()
def __unicode__(self): return self.name
class AugmentedLocation(Location):
extra_text = models.TextField(blank=True)
objects = models.GeoManager()
class DirectoryEntry(models.Model):
listing_text = models.CharField(max_length=50)
location = models.ForeignKey(AugmentedLocation)
objects = models.GeoManager()
class Parcel(models.Model):
name = models.CharField(max_length=30)
city = models.ForeignKey(City)
center1 = models.PointField()
# Throwing a curveball w/`db_column` here.
center2 = models.PointField(srid=2276, db_column='mycenter')
border1 = models.PolygonField()
border2 = models.PolygonField(srid=2276)
objects = models.GeoManager()
def __unicode__(self): return self.name
# These use the GeoManager but do not have any geographic fields.
class Author(models.Model):
name = models.CharField(max_length=100)
objects = models.GeoManager()
class Article(models.Model):
title = models.CharField(max_length=100)
author = models.ForeignKey(Author, unique=True)
objects = models.GeoManager()
class Book(models.Model):
title = models.CharField(max_length=100)
author = models.ForeignKey(Author, related_name='books', null=True)
objects = models.GeoManager()
| ajibawa-2023/Python-Code-Large/train/row_98692 | 42 | 49 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98692:ImportFrom_L1_C0", "label": "from django.contrib.gis.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0204, 0.0204, 0, 0.66, 0.0, 964, 0, 1, 0, 0, 964, 0, 0], "semantic": {"name": "django.contrib.gis.db", "arg_names": [], "import_names": ["models"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db import models"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:ImportFrom_L2_C0", "label": "from django.contrib.localflavor.us.models import USStateField", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0408, 0.0204, 0, 0.66, 0.1111, 676, 0, 1, 0, 0, 676, 0, 0], "semantic": {"name": "django.contrib.localflavor.us.models", "arg_names": [], "import_names": ["USStateField"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.localflavor.us.models import USStateField"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L4_C0", "label": "Location", "type": "class", "loc": [4, 7], "level": 0, "parent": null, "vector": [3, 0, 0.1122, 0.0816, 0, 0.66, 0.2222, 692, 0, 1, 0, 0, 996, 0, 2], "semantic": {"name": "Location", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Location(models.Model):\n point = models.PointField()\n objects = models.GeoManager()\n def __unicode__(self): return self.point.wkt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L5_C4", "label": "point = PointField()", "type": "assigned_variable", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L4_C0", "vector": [14, 1, 0.102, 0.0204, 1, 0.96, 0.0, 16, 3, 0, 0, 0, 260, 10, 1], "semantic": {"name": "point", "arg_names": [], "import_names": [], "rhs_call_name": "PointField", "annotation": ""}, "snippet": " point = models.PointField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L6_C4", "label": "objects = GeoManager()", "type": "assigned_variable", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L4_C0", "vector": [14, 1, 0.1224, 0.0204, 1, 0.96, 0.5, 550, 3, 0, 0, 0, 665, 10, 1], "semantic": {"name": "objects", "arg_names": [], "import_names": [], "rhs_call_name": "GeoManager", "annotation": ""}, "snippet": " objects = models.GeoManager()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:FunctionDef_L7_C4", "label": "__unicode__", "type": "function", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L4_C0", "vector": [2, 1, 0.1429, 0.0204, 1, 0.96, 1.0, 318, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__unicode__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __unicode__(self): return self.point.wkt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Return_L7_C27", "label": "return", "type": "return", "loc": [7, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:FunctionDef_L7_C4", "vector": [13, 2, 0.1429, 0.0204, 2, 0.04, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __unicode__(self): return self.point.wkt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L9_C0", "label": "City", "type": "class", "loc": [9, 14], "level": 0, "parent": null, "vector": [3, 0, 0.2347, 0.1224, 0, 0.66, 0.3333, 801, 0, 1, 0, 0, 996, 0, 4], "semantic": {"name": "City", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class City(models.Model):\n name = models.CharField(max_length=50)\n state = USStateField()\n location = models.ForeignKey(Location)\n objects = models.GeoManager()\n def __unicode__(self): return self.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L10_C4", "label": "name = CharField()", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L9_C0", "vector": [14, 1, 0.2041, 0.0204, 1, 0.23, 0.0, 57, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " name = models.CharField(max_length=50)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L11_C4", "label": "state = USStateField()", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L9_C0", "vector": [14, 1, 0.2245, 0.0204, 1, 0.23, 0.25, 688, 3, 0, 0, 0, 447, 10, 1], "semantic": {"name": "state", "arg_names": [], "import_names": [], "rhs_call_name": "USStateField", "annotation": ""}, "snippet": " state = USStateField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L12_C4", "label": "location = ForeignKey()", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L9_C0", "vector": [14, 1, 0.2449, 0.0204, 1, 0.23, 0.5, 771, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "location", "arg_names": [], "import_names": [], "rhs_call_name": "ForeignKey", "annotation": ""}, "snippet": " location = models.ForeignKey(Location)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L13_C4", "label": "objects = GeoManager()", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L9_C0", "vector": [14, 1, 0.2653, 0.0204, 1, 0.23, 0.75, 550, 3, 0, 0, 0, 665, 10, 1], "semantic": {"name": "objects", "arg_names": [], "import_names": [], "rhs_call_name": "GeoManager", "annotation": ""}, "snippet": " objects = models.GeoManager()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:FunctionDef_L14_C4", "label": "__unicode__", "type": "function", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L9_C0", "vector": [2, 1, 0.2857, 0.0204, 1, 0.23, 1.0, 318, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__unicode__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __unicode__(self): return self.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Return_L14_C27", "label": "return", "type": "return", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:FunctionDef_L14_C4", "vector": [13, 2, 0.2857, 0.0204, 2, 0.72, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __unicode__(self): return self.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L16_C0", "label": "AugmentedLocation", "type": "class", "loc": [16, 18], "level": 0, "parent": null, "vector": [3, 0, 0.3469, 0.0612, 0, 0.66, 0.4444, 650, 0, 0, 0, 0, 692, 0, 2], "semantic": {"name": "AugmentedLocation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class AugmentedLocation(Location):\n extra_text = models.TextField(blank=True)\n objects = models.GeoManager()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L17_C4", "label": "extra_text = TextField()", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L16_C0", "vector": [14, 1, 0.3469, 0.0204, 1, 0.4, 0.0, 716, 3, 1, 0, 0, 612, 10, 1], "semantic": {"name": "extra_text", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " extra_text = models.TextField(blank=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L18_C4", "label": "objects = GeoManager()", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L16_C0", "vector": [14, 1, 0.3673, 0.0204, 1, 0.4, 1.0, 550, 3, 0, 0, 0, 665, 10, 1], "semantic": {"name": "objects", "arg_names": [], "import_names": [], "rhs_call_name": "GeoManager", "annotation": ""}, "snippet": " objects = models.GeoManager()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L20_C0", "label": "DirectoryEntry", "type": "class", "loc": [20, 23], "level": 0, "parent": null, "vector": [3, 0, 0.4388, 0.0816, 0, 0.66, 0.5556, 252, 0, 0, 0, 0, 996, 0, 3], "semantic": {"name": "DirectoryEntry", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DirectoryEntry(models.Model):\n listing_text = models.CharField(max_length=50)\n location = models.ForeignKey(AugmentedLocation)\n objects = models.GeoManager()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L21_C4", "label": "listing_text = CharField()", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L20_C0", "vector": [14, 1, 0.4286, 0.0204, 1, 0.14, 0.0, 605, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "listing_text", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " listing_text = models.CharField(max_length=50)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L22_C4", "label": "location = ForeignKey()", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L20_C0", "vector": [14, 1, 0.449, 0.0204, 1, 0.14, 0.5, 771, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "location", "arg_names": [], "import_names": [], "rhs_call_name": "ForeignKey", "annotation": ""}, "snippet": " location = models.ForeignKey(AugmentedLocation)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L23_C4", "label": "objects = GeoManager()", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L20_C0", "vector": [14, 1, 0.4694, 0.0204, 1, 0.14, 1.0, 550, 3, 0, 0, 0, 665, 10, 1], "semantic": {"name": "objects", "arg_names": [], "import_names": [], "rhs_call_name": "GeoManager", "annotation": ""}, "snippet": " objects = models.GeoManager()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L25_C0", "label": "Parcel", "type": "class", "loc": [25, 34], "level": 0, "parent": null, "vector": [3, 0, 0.602, 0.2041, 0, 0.66, 0.6667, 914, 0, 1, 0, 0, 996, 0, 7], "semantic": {"name": "Parcel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Parcel(models.Model):\n name = models.CharField(max_length=30)\n city = models.ForeignKey(City)\n center1 = models.PointField()\n # Throwing a curveball w/`db_column` here.\n center2 = models.PointField(srid=2276, db_column='mycenter') \n border1 = models.PolygonField()\n border2 = models.PolygonField(srid=2276)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L26_C4", "label": "name = CharField()", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L25_C0", "vector": [14, 1, 0.5306, 0.0204, 1, 0.32, 0.0, 57, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " name = models.CharField(max_length=30)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L27_C4", "label": "city = ForeignKey()", "type": "assigned_variable", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L25_C0", "vector": [14, 1, 0.551, 0.0204, 1, 0.32, 0.1429, 825, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "city", "arg_names": [], "import_names": [], "rhs_call_name": "ForeignKey", "annotation": ""}, "snippet": " city = models.ForeignKey(City)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L28_C4", "label": "center1 = PointField()", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L25_C0", "vector": [14, 1, 0.5714, 0.0204, 1, 0.32, 0.2857, 745, 3, 0, 0, 0, 260, 10, 1], "semantic": {"name": "center1", "arg_names": [], "import_names": [], "rhs_call_name": "PointField", "annotation": ""}, "snippet": " center1 = models.PointField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L30_C4", "label": "center2 = PointField()", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L25_C0", "vector": [14, 1, 0.6122, 0.0204, 1, 0.32, 0.4286, 457, 3, 2, 0, 0, 260, 10, 1], "semantic": {"name": "center2", "arg_names": [], "import_names": [], "rhs_call_name": "PointField", "annotation": ""}, "snippet": " center2 = models.PointField(srid=2276, db_column='mycenter') "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L31_C4", "label": "border1 = PolygonField()", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L25_C0", "vector": [14, 1, 0.6327, 0.0204, 1, 0.32, 0.5714, 712, 3, 0, 0, 0, 736, 10, 1], "semantic": {"name": "border1", "arg_names": [], "import_names": [], "rhs_call_name": "PolygonField", "annotation": ""}, "snippet": " border1 = models.PolygonField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L32_C4", "label": "border2 = PolygonField()", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L25_C0", "vector": [14, 1, 0.6531, 0.0204, 1, 0.32, 0.7143, 305, 3, 1, 0, 0, 736, 10, 1], "semantic": {"name": "border2", "arg_names": [], "import_names": [], "rhs_call_name": "PolygonField", "annotation": ""}, "snippet": " border2 = models.PolygonField(srid=2276)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L33_C4", "label": "objects = GeoManager()", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L25_C0", "vector": [14, 1, 0.6735, 0.0204, 1, 0.32, 0.8571, 550, 3, 0, 0, 0, 665, 10, 1], "semantic": {"name": "objects", "arg_names": [], "import_names": [], "rhs_call_name": "GeoManager", "annotation": ""}, "snippet": " objects = models.GeoManager()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:FunctionDef_L34_C4", "label": "__unicode__", "type": "function", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L25_C0", "vector": [2, 1, 0.6939, 0.0204, 1, 0.32, 1.0, 318, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__unicode__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __unicode__(self): return self.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Return_L34_C27", "label": "return", "type": "return", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:FunctionDef_L34_C4", "vector": [13, 2, 0.6939, 0.0204, 2, 0.12, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __unicode__(self): return self.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L37_C0", "label": "Author", "type": "class", "loc": [37, 39], "level": 0, "parent": null, "vector": [3, 0, 0.7755, 0.0612, 0, 0.66, 0.7778, 798, 0, 0, 0, 0, 996, 0, 2], "semantic": {"name": "Author", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Author(models.Model):\n name = models.CharField(max_length=100)\n objects = models.GeoManager()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L38_C4", "label": "name = CharField()", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L37_C0", "vector": [14, 1, 0.7755, 0.0204, 1, 0.3, 0.0, 57, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " name = models.CharField(max_length=100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L39_C4", "label": "objects = GeoManager()", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L37_C0", "vector": [14, 1, 0.7959, 0.0204, 1, 0.3, 1.0, 550, 3, 0, 0, 0, 665, 10, 1], "semantic": {"name": "objects", "arg_names": [], "import_names": [], "rhs_call_name": "GeoManager", "annotation": ""}, "snippet": " objects = models.GeoManager()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L41_C0", "label": "Article", "type": "class", "loc": [41, 44], "level": 0, "parent": null, "vector": [3, 0, 0.8673, 0.0816, 0, 0.66, 0.8889, 583, 0, 0, 0, 0, 996, 0, 3], "semantic": {"name": "Article", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Article(models.Model):\n title = models.CharField(max_length=100)\n author = models.ForeignKey(Author, unique=True)\n objects = models.GeoManager()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L42_C4", "label": "title = CharField()", "type": "assigned_variable", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L41_C0", "vector": [14, 1, 0.8571, 0.0204, 1, 0.4, 0.0, 48, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " title = models.CharField(max_length=100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L43_C4", "label": "author = ForeignKey()", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L41_C0", "vector": [14, 1, 0.8776, 0.0204, 1, 0.4, 0.5, 355, 3, 2, 0, 0, 140, 10, 1], "semantic": {"name": "author", "arg_names": [], "import_names": [], "rhs_call_name": "ForeignKey", "annotation": ""}, "snippet": " author = models.ForeignKey(Author, unique=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L44_C4", "label": "objects = GeoManager()", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L41_C0", "vector": [14, 1, 0.898, 0.0204, 1, 0.4, 1.0, 550, 3, 0, 0, 0, 665, 10, 1], "semantic": {"name": "objects", "arg_names": [], "import_names": [], "rhs_call_name": "GeoManager", "annotation": ""}, "snippet": " objects = models.GeoManager()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L46_C0", "label": "Book", "type": "class", "loc": [46, 49], "level": 0, "parent": null, "vector": [3, 0, 0.9694, 0.0816, 0, 0.66, 1.0, 97, 0, 0, 0, 0, 996, 0, 3], "semantic": {"name": "Book", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Book(models.Model):\n title = models.CharField(max_length=100)\n author = models.ForeignKey(Author, related_name='books', null=True)\n objects = models.GeoManager()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L47_C4", "label": "title = CharField()", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L46_C0", "vector": [14, 1, 0.9592, 0.0204, 1, 0.64, 0.0, 48, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " title = models.CharField(max_length=100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L48_C4", "label": "author = ForeignKey()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L46_C0", "vector": [14, 1, 0.9796, 0.0204, 1, 0.64, 0.5, 355, 3, 3, 0, 0, 140, 10, 1], "semantic": {"name": "author", "arg_names": [], "import_names": [], "rhs_call_name": "ForeignKey", "annotation": ""}, "snippet": " author = models.ForeignKey(Author, related_name='books', null=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L49_C4", "label": "objects = GeoManager()", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L46_C0", "vector": [14, 1, 1.0, 0.0204, 1, 0.64, 1.0, 550, 3, 0, 0, 0, 665, 10, 1], "semantic": {"name": "objects", "arg_names": [], "import_names": [], "rhs_call_name": "GeoManager", "annotation": ""}, "snippet": " objects = models.GeoManager()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Return_L7_C27"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Return_L14_C27"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Return_L34_C27"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L49_C4"}] |
import os, unittest
from django.contrib.gis.geos import *
from django.contrib.gis.db.models import Collect, Count, Extent, F, Union
from django.contrib.gis.geometry.backend import Geometry
from django.contrib.gis.tests.utils import mysql, oracle, postgis, spatialite, no_mysql, no_oracle, no_spatialite
from django.conf import settings
from models import City, Location, DirectoryEntry, Parcel, Book, Author, Article
cities = (('Aurora', 'TX', -97.516111, 33.058333),
('Roswell', 'NM', -104.528056, 33.387222),
('Kecksburg', 'PA', -79.460734, 40.18476),
)
class RelatedGeoModelTest(unittest.TestCase):
def test01_setup(self):
"Setting up for related model tests."
for name, state, lon, lat in cities:
loc = Location.objects.create(point=Point(lon, lat))
c = City.objects.create(name=name, state=state, location=loc)
def test02_select_related(self):
"Testing `select_related` on geographic models (see #7126)."
qs1 = City.objects.all()
qs2 = City.objects.select_related()
qs3 = City.objects.select_related('location')
for qs in (qs1, qs2, qs3):
for ref, c in zip(cities, qs):
nm, st, lon, lat = ref
self.assertEqual(nm, c.name)
self.assertEqual(st, c.state)
self.assertEqual(Point(lon, lat), c.location.point)
@no_mysql
def test03_transform_related(self):
"Testing the `transform` GeoQuerySet method on related geographic models."
# All the transformations are to state plane coordinate systems using
# US Survey Feet (thus a tolerance of 0 implies error w/in 1 survey foot).
tol = 0
def check_pnt(ref, pnt):
self.assertAlmostEqual(ref.x, pnt.x, tol)
self.assertAlmostEqual(ref.y, pnt.y, tol)
self.assertEqual(ref.srid, pnt.srid)
# Each city transformed to the SRID of their state plane coordinate system.
transformed = (('Kecksburg', 2272, 'POINT(1490553.98959621 314792.131023984)'),
('Roswell', 2257, 'POINT(481902.189077221 868477.766629735)'),
('Aurora', 2276, 'POINT(2269923.2484839 7069381.28722222)'),
)
for name, srid, wkt in transformed:
# Doing this implicitly sets `select_related` select the location.
# TODO: Fix why this breaks on Oracle.
qs = list(City.objects.filter(name=name).transform(srid, field_name='location__point'))
check_pnt(GEOSGeometry(wkt, srid), qs[0].location.point)
@no_mysql
@no_spatialite
def test04a_related_extent_aggregate(self):
"Testing the `extent` GeoQuerySet aggregates on related geographic models."
# This combines the Extent and Union aggregates into one query
aggs = City.objects.aggregate(Extent('location__point'))
# One for all locations, one that excludes Roswell.
all_extent = (-104.528060913086, 33.0583305358887,-79.4607315063477, 40.1847610473633)
txpa_extent = (-97.51611328125, 33.0583305358887,-79.4607315063477, 40.1847610473633)
e1 = City.objects.extent(field_name='location__point')
e2 = City.objects.exclude(name='Roswell').extent(field_name='location__point')
e3 = aggs['location__point__extent']
# The tolerance value is to four decimal places because of differences
# between the Oracle and PostGIS spatial backends on the extent calculation.
tol = 4
for ref, e in [(all_extent, e1), (txpa_extent, e2), (all_extent, e3)]:
for ref_val, e_val in zip(ref, e): self.assertAlmostEqual(ref_val, e_val, tol)
@no_mysql
def test04b_related_union_aggregate(self):
"Testing the `unionagg` GeoQuerySet aggregates on related geographic models."
# This combines the Extent and Union aggregates into one query
aggs = City.objects.aggregate(Union('location__point'))
# These are the points that are components of the aggregate geographic
# union that is returned.
p1 = Point(-104.528056, 33.387222)
p2 = Point(-97.516111, 33.058333)
p3 = Point(-79.460734, 40.18476)
# Creating the reference union geometry depending on the spatial backend,
# as Oracle will have a different internal ordering of the component
# geometries than PostGIS. The second union aggregate is for a union
# query that includes limiting information in the WHERE clause (in other
# words a `.filter()` precedes the call to `.unionagg()`).
if oracle:
ref_u1 = MultiPoint(p3, p1, p2, srid=4326)
ref_u2 = MultiPoint(p3, p2, srid=4326)
else:
ref_u1 = MultiPoint(p1, p2, p3, srid=4326)
ref_u2 = MultiPoint(p2, p3, srid=4326)
u1 = City.objects.unionagg(field_name='location__point')
u2 = City.objects.exclude(name='Roswell').unionagg(field_name='location__point')
u3 = aggs['location__point__union']
self.assertEqual(ref_u1, u1)
self.assertEqual(ref_u2, u2)
self.assertEqual(ref_u1, u3)
def test05_select_related_fk_to_subclass(self):
"Testing that calling select_related on a query over a model with an FK to a model subclass works"
# Regression test for #9752.
l = list(DirectoryEntry.objects.all().select_related())
def test06_f_expressions(self):
"Testing F() expressions on GeometryFields."
# Constructing a dummy parcel border and getting the City instance for
# assigning the FK.
b1 = GEOSGeometry('POLYGON((-97.501205 33.052520,-97.501205 33.052576,-97.501150 33.052576,-97.501150 33.052520,-97.501205 33.052520))', srid=4326)
pcity = City.objects.get(name='Aurora')
# First parcel has incorrect center point that is equal to the City;
# it also has a second border that is different from the first as a
# 100ft buffer around the City.
c1 = pcity.location.point
c2 = c1.transform(2276, clone=True)
b2 = c2.buffer(100)
p1 = Parcel.objects.create(name='P1', city=pcity, center1=c1, center2=c2, border1=b1, border2=b2)
# Now creating a second Parcel where the borders are the same, just
# in different coordinate systems. The center points are also the
# the same (but in different coordinate systems), and this time they
# actually correspond to the centroid of the border.
c1 = b1.centroid
c2 = c1.transform(2276, clone=True)
p2 = Parcel.objects.create(name='P2', city=pcity, center1=c1, center2=c2, border1=b1, border2=b1)
# Should return the second Parcel, which has the center within the
# border.
qs = Parcel.objects.filter(center1__within=F('border1'))
self.assertEqual(1, len(qs))
self.assertEqual('P2', qs[0].name)
if not mysql:
# This time center2 is in a different coordinate system and needs
# to be wrapped in transformation SQL.
qs = Parcel.objects.filter(center2__within=F('border1'))
self.assertEqual(1, len(qs))
self.assertEqual('P2', qs[0].name)
# Should return the first Parcel, which has the center point equal
# to the point in the City ForeignKey.
qs = Parcel.objects.filter(center1=F('city__location__point'))
self.assertEqual(1, len(qs))
self.assertEqual('P1', qs[0].name)
if not mysql:
# This time the city column should be wrapped in transformation SQL.
qs = Parcel.objects.filter(border2__contains=F('city__location__point'))
self.assertEqual(1, len(qs))
self.assertEqual('P1', qs[0].name)
def test07_values(self):
"Testing values() and values_list() and GeoQuerySets."
# GeoQuerySet and GeoValuesQuerySet, and GeoValuesListQuerySet respectively.
gqs = Location.objects.all()
gvqs = Location.objects.values()
gvlqs = Location.objects.values_list()
# Incrementing through each of the models, dictionaries, and tuples
# returned by the different types of GeoQuerySets.
for m, d, t in zip(gqs, gvqs, gvlqs):
# The values should be Geometry objects and not raw strings returned
# by the spatial database.
self.failUnless(isinstance(d['point'], Geometry))
self.failUnless(isinstance(t[1], Geometry))
self.assertEqual(m.point, d['point'])
self.assertEqual(m.point, t[1])
def test08_defer_only(self):
"Testing defer() and only() on Geographic models."
qs = Location.objects.all()
def_qs = Location.objects.defer('point')
for loc, def_loc in zip(qs, def_qs):
self.assertEqual(loc.point, def_loc.point)
def test09_pk_relations(self):
"Ensuring correct primary key column is selected across relations. See #10757."
# Adding two more cities, but this time making sure that their location
# ID values do not match their City ID values.
loc1 = Location.objects.create(point='POINT (-95.363151 29.763374)')
loc2 = Location.objects.create(point='POINT (-96.801611 32.782057)')
dallas = City.objects.create(name='Dallas', state='TX', location=loc2)
houston = City.objects.create(name='Houston', state='TX', location=loc1)
# The expected ID values -- notice the last two location IDs
# are out of order. We want to make sure that the related
# location ID column is selected instead of ID column for
# the city.
city_ids = (1, 2, 3, 4, 5)
loc_ids = (1, 2, 3, 5, 4)
ids_qs = City.objects.order_by('id').values('id', 'location__id')
for val_dict, c_id, l_id in zip(ids_qs, city_ids, loc_ids):
self.assertEqual(val_dict['id'], c_id)
self.assertEqual(val_dict['location__id'], l_id)
def test10_combine(self):
"Testing the combination of two GeoQuerySets. See #10807."
buf1 = City.objects.get(name='Aurora').location.point.buffer(0.1)
buf2 = City.objects.get(name='Kecksburg').location.point.buffer(0.1)
qs1 = City.objects.filter(location__point__within=buf1)
qs2 = City.objects.filter(location__point__within=buf2)
combined = qs1 | qs2
names = [c.name for c in combined]
self.assertEqual(2, len(names))
self.failUnless('Aurora' in names)
self.failUnless('Kecksburg' in names)
def test11_geoquery_pickle(self):
"Ensuring GeoQuery objects are unpickled correctly. See #10839."
import pickle
from django.contrib.gis.db.models.sql import GeoQuery
qs = City.objects.all()
q_str = pickle.dumps(qs.query)
q = pickle.loads(q_str)
self.assertEqual(GeoQuery, q.__class__)
# TODO: fix on Oracle -- get the following error because the SQL is ordered
# by a geometry object, which Oracle apparently doesn't like:
# ORA-22901: cannot compare nested table or VARRAY or LOB attributes of an object type
@no_oracle
def test12a_count(self):
"Testing `Count` aggregate use with the `GeoManager` on geo-fields."
# Creating a new City, 'Fort Worth', that uses the same location
# as Dallas.
dallas = City.objects.get(name='Dallas')
ftworth = City.objects.create(name='Fort Worth', state='TX', location=dallas.location)
# Count annotation should be 2 for the Dallas location now.
loc = Location.objects.annotate(num_cities=Count('city')).get(id=dallas.location.id)
self.assertEqual(2, loc.num_cities)
def test12b_count(self):
"Testing `Count` aggregate use with the `GeoManager` on non geo-fields. See #11087."
# Creating some data for the Book/Author non-geo models that
# use GeoManager. See #11087.
tp = Author.objects.create(name='Trevor Paglen')
Book.objects.create(title='Torture Taxi', author=tp)
Book.objects.create(title='I Could Tell You But Then You Would Have to be Destroyed by Me', author=tp)
Book.objects.create(title='Blank Spots on the Map', author=tp)
wp = Author.objects.create(name='William Patry')
Book.objects.create(title='Patry on Copyright', author=wp)
# Should only be one author (Trevor Paglen) returned by this query, and
# the annotation should have 3 for the number of books. Also testing
# with a `GeoValuesQuerySet` (see #11489).
qs = Author.objects.annotate(num_books=Count('books')).filter(num_books__gt=1)
vqs = Author.objects.values('name').annotate(num_books=Count('books')).filter(num_books__gt=1)
self.assertEqual(1, len(qs))
self.assertEqual(3, qs[0].num_books)
self.assertEqual(1, len(vqs))
self.assertEqual(3, vqs[0]['num_books'])
# TODO: The phantom model does appear on Oracle.
@no_oracle
def test13_select_related_null_fk(self):
"Testing `select_related` on a nullable ForeignKey via `GeoManager`. See #11381."
no_author = Book.objects.create(title='Without Author')
b = Book.objects.select_related('author').get(title='Without Author')
# Should be `None`, and not a 'dummy' model.
self.assertEqual(None, b.author)
@no_mysql
@no_oracle
@no_spatialite
def test14_collect(self):
"Testing the `collect` GeoQuerySet method and `Collect` aggregate."
# Reference query:
# SELECT AsText(ST_Collect("relatedapp_location"."point")) FROM "relatedapp_city" LEFT OUTER JOIN
# "relatedapp_location" ON ("relatedapp_city"."location_id" = "relatedapp_location"."id")
# WHERE "relatedapp_city"."state" = 'TX';
ref_geom = fromstr('MULTIPOINT(-97.516111 33.058333,-96.801611 32.782057,-95.363151 29.763374,-96.801611 32.782057)')
c1 = City.objects.filter(state='TX').collect(field_name='location__point')
c2 = City.objects.filter(state='TX').aggregate(Collect('location__point'))['location__point__collect']
for coll in (c1, c2):
# Even though Dallas and Ft. Worth share same point, Collect doesn't
# consolidate -- that's why 4 points in MultiPoint.
self.assertEqual(4, len(coll))
self.assertEqual(ref_geom, coll)
def test15_invalid_select_related(self):
"Testing doing select_related on the related name manager of a unique FK. See #13934."
qs = Article.objects.select_related('author__article')
# This triggers TypeError when `get_default_columns` has no `local_only`
# keyword. The TypeError is swallowed if QuerySet is actually
# evaluated as list generation swallows TypeError in CPython.
sql = str(qs.query)
# TODO: Related tests for KML, GML, and distance lookups.
def suite():
s = unittest.TestSuite()
s.addTest(unittest.makeSuite(RelatedGeoModelTest))
return s
| ajibawa-2023/Python-Code-Large/train/row_98693 | 181 | 307 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Import_L1_C0", "label": "os import os, unittest", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0033, 0.0033, 0, 0.66, 0.0, 688, 0, 2, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "unittest"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os, unittest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:ImportFrom_L2_C0", "label": "from django.contrib.gis.geos import *", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0065, 0.0033, 0, 0.66, 0.1111, 886, 0, 1, 0, 0, 886, 0, 0], "semantic": {"name": "django.contrib.gis.geos", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:ImportFrom_L3_C0", "label": "from django.contrib.gis.db.models import Collect, Count, Extent\u2026", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0098, 0.0033, 0, 0.66, 0.2222, 472, 0, 5, 0, 0, 472, 0, 0], "semantic": {"name": "django.contrib.gis.db.models", "arg_names": [], "import_names": ["Collect", "Count", "Extent", "F", "Union"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.models import Collect, Count, Extent, F, Union"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:ImportFrom_L4_C0", "label": "from django.contrib.gis.geometry.backend import Geometry", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.013, 0.0033, 0, 0.66, 0.3333, 299, 0, 1, 0, 0, 299, 0, 0], "semantic": {"name": "django.contrib.gis.geometry.backend", "arg_names": [], "import_names": ["Geometry"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geometry.backend import Geometry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:ImportFrom_L5_C0", "label": "from django.contrib.gis.tests.utils import mysql, oracle, postgis\u2026", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0163, 0.0033, 0, 0.66, 0.4444, 185, 0, 7, 0, 0, 185, 0, 0], "semantic": {"name": "django.contrib.gis.tests.utils", "arg_names": [], "import_names": ["mysql", "oracle", "postgis", "spatialite", "no_mysql", "no_oracle", "no_spatialite"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.tests.utils import mysql, oracle, postgis, spatialite, no_mysql, no_oracle, no_spatialite"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:ImportFrom_L6_C0", "label": "from django.conf import settings", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0195, 0.0033, 0, 0.66, 0.5556, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:ImportFrom_L7_C0", "label": "from models import City, Location, DirectoryEntry\u2026", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0228, 0.0033, 0, 0.66, 0.6667, 495, 0, 7, 0, 0, 495, 0, 0], "semantic": {"name": "models", "arg_names": [], "import_names": ["City", "Location", "DirectoryEntry", "Parcel", "Book", "Author", "Article"], "rhs_call_name": "", "annotation": ""}, "snippet": "from models import City, Location, DirectoryEntry, Parcel, Book, Author, Article"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L9_C0", "label": "cities =", "type": "assigned_variable", "loc": [9, 12], "level": 0, "parent": null, "vector": [14, 0, 0.0342, 0.013, 0, 0.66, 0.7778, 884, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "cities", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "cities = (('Aurora', 'TX', -97.516111, 33.058333),\n ('Roswell', 'NM', -104.528056, 33.387222),\n ('Kecksburg', 'PA', -79.460734, 40.18476),\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "label": "RelatedGeoModelTest", "type": "class", "loc": [14, 300], "level": 0, "parent": null, "vector": [3, 0, 0.5114, 0.9349, 0, 0.66, 0.8889, 218, 0, 18, 0, 0, 878, 0, 99], "semantic": {"name": "RelatedGeoModelTest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RelatedGeoModelTest(unittest.TestCase):\n\n def test01_setup(self):\n \"Setting up for related model tests.\"\n for name, state, lon, lat in cities:\n loc = Location.objects.create(point=Point(lon, lat))\n c = City.objects.create(name=name, state=state, location=loc)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L16_C4", "label": "test01_setup", "type": "function", "loc": [16, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "vector": [2, 1, 0.0586, 0.0163, 1, 0.58, 0.0, 948, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "test01_setup", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test01_setup(self):\n \"Setting up for related model tests.\"\n for name, state, lon, lat in cities:\n loc = Location.objects.create(point=Point(lon, lat))\n c = City.objects.create(name=name, state=state, location=loc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L17_C8", "label": "expression", "type": "expression", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L16_C4", "vector": [8, 2, 0.0554, 0.0033, 2, 0.02, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Setting up for related model tests.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L18_C8", "label": "for name, state, lon, lat", "type": "for", "loc": [18, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L16_C4", "vector": [6, 2, 0.0619, 0.0098, 2, 0.02, 1.0, 433, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "name, state, lon, lat", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for name, state, lon, lat in cities:\n loc = Location.objects.create(point=Point(lon, lat))\n c = City.objects.create(name=name, state=state, location=loc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L19_C12", "label": "loc = create()", "type": "assigned_variable", "loc": [19, 19], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L18_C8", "vector": [14, 3, 0.0619, 0.0033, 3, 0.58, 0.0, 822, 3, 1, 0, 0, 316, 10, 2], "semantic": {"name": "loc", "arg_names": [], "import_names": [], "rhs_call_name": "create", "annotation": ""}, "snippet": " loc = Location.objects.create(point=Point(lon, lat))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L20_C12", "label": "c = create()", "type": "assigned_variable", "loc": [20, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L18_C8", "vector": [14, 3, 0.0651, 0.0033, 3, 0.58, 1.0, 411, 3, 3, 0, 0, 316, 10, 1], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "create", "annotation": ""}, "snippet": " c = City.objects.create(name=name, state=state, location=loc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L22_C4", "label": "test02_select_related", "type": "function", "loc": [22, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "vector": [2, 1, 0.0896, 0.0391, 1, 0.58, 0.0625, 216, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "test02_select_related", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test02_select_related(self):\n \"Testing `select_related` on geographic models (see #7126).\"\n qs1 = City.objects.all()\n qs2 = City.objects.select_related()\n qs3 = City.objects.select_related('location')\n\n for qs in (qs1, qs2, qs3):\n for ref, c in zip(cities, qs):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L23_C8", "label": "expression", "type": "expression", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L22_C4", "vector": [8, 2, 0.0749, 0.0033, 2, 0.8, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Testing `select_related` on geographic models (see #7126).\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L24_C8", "label": "qs1 = all()", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L22_C4", "vector": [14, 2, 0.0782, 0.0033, 2, 0.8, 0.25, 811, 3, 0, 0, 0, 895, 10, 1], "semantic": {"name": "qs1", "arg_names": [], "import_names": [], "rhs_call_name": "all", "annotation": ""}, "snippet": " qs1 = City.objects.all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L25_C8", "label": "qs2 = select_related()", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L22_C4", "vector": [14, 2, 0.0814, 0.0033, 2, 0.8, 0.5, 595, 3, 0, 0, 0, 595, 10, 1], "semantic": {"name": "qs2", "arg_names": [], "import_names": [], "rhs_call_name": "select_related", "annotation": ""}, "snippet": " qs2 = City.objects.select_related()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L26_C8", "label": "qs3 = select_related()", "type": "assigned_variable", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L22_C4", "vector": [14, 2, 0.0847, 0.0033, 2, 0.8, 0.75, 595, 3, 1, 0, 0, 595, 10, 1], "semantic": {"name": "qs3", "arg_names": [], "import_names": [], "rhs_call_name": "select_related", "annotation": ""}, "snippet": " qs3 = City.objects.select_related('location')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L28_C8", "label": "for qs", "type": "for", "loc": [28, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L22_C4", "vector": [6, 2, 0.0993, 0.0195, 2, 0.8, 1.0, 251, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "qs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for qs in (qs1, qs2, qs3):\n for ref, c in zip(cities, qs):\n nm, st, lon, lat = ref\n self.assertEqual(nm, c.name)\n self.assertEqual(st, c.state)\n self.assertEqual(Point(lon, lat), c.location.point)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L29_C12", "label": "for ref, c", "type": "for", "loc": [29, 33], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L28_C8", "vector": [6, 3, 0.101, 0.0163, 3, 0.9, 0.0, 692, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "ref, c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for ref, c in zip(cities, qs):\n nm, st, lon, lat = ref\n self.assertEqual(nm, c.name)\n self.assertEqual(st, c.state)\n self.assertEqual(Point(lon, lat), c.location.point)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L30_C16", "label": "nm, st, lon, lat =", "type": "assigned_variable", "loc": [30, 30], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L29_C12", "vector": [14, 4, 0.0977, 0.0033, 4, 0.19, 0.0, 444, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "nm, st, lon, lat", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nm, st, lon, lat = ref"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L31_C16", "label": "assertEqual()", "type": "expression", "loc": [31, 31], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L29_C12", "vector": [8, 4, 0.101, 0.0033, 4, 0.19, 0.3333, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(nm, c.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L32_C16", "label": "assertEqual()", "type": "expression", "loc": [32, 32], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L29_C12", "vector": [8, 4, 0.1042, 0.0033, 4, 0.19, 0.6667, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(st, c.state)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L33_C16", "label": "assertEqual()", "type": "expression", "loc": [33, 33], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L29_C12", "vector": [8, 4, 0.1075, 0.0033, 4, 0.19, 1.0, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(Point(lon, lat), c.location.point)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L36_C4", "label": "test03_transform_related", "type": "function", "loc": [36, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "vector": [2, 1, 0.1515, 0.0717, 1, 0.58, 0.125, 842, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "test03_transform_related", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test03_transform_related(self):\n \"Testing the `transform` GeoQuerySet method on related geographic models.\"\n # All the transformations are to state plane coordinate systems using\n # US Survey Feet (thus a tolerance of 0 implies error w/in 1 survey foot).\n tol = 0\n\n def check_pnt(ref, pnt):\n self.assertAlmostEqual(ref.x, pnt.x, tol)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L37_C8", "label": "expression", "type": "expression", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L36_C4", "vector": [8, 2, 0.1205, 0.0033, 2, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Testing the `transform` GeoQuerySet method on related geographic models.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L40_C8", "label": "tol =", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L36_C4", "vector": [14, 2, 0.1303, 0.0033, 2, 0.91, 0.25, 422, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "tol", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tol = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L42_C8", "label": "check_pnt", "type": "function", "loc": [42, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L36_C4", "vector": [2, 2, 0.1417, 0.013, 2, 0.91, 0.5, 81, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "check_pnt", "arg_names": ["ref", "pnt"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def check_pnt(ref, pnt):\n self.assertAlmostEqual(ref.x, pnt.x, tol)\n self.assertAlmostEqual(ref.y, pnt.y, tol)\n self.assertEqual(ref.srid, pnt.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L43_C12", "label": "assertAlmostEqual()", "type": "expression", "loc": [43, 43], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L42_C8", "vector": [8, 3, 0.1401, 0.0033, 3, 0.97, 0.0, 448, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "assertAlmostEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertAlmostEqual", "annotation": ""}, "snippet": " self.assertAlmostEqual(ref.x, pnt.x, tol)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L44_C12", "label": "assertAlmostEqual()", "type": "expression", "loc": [44, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L42_C8", "vector": [8, 3, 0.1433, 0.0033, 3, 0.97, 0.5, 448, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "assertAlmostEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertAlmostEqual", "annotation": ""}, "snippet": " self.assertAlmostEqual(ref.y, pnt.y, tol)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L45_C12", "label": "assertEqual()", "type": "expression", "loc": [45, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L42_C8", "vector": [8, 3, 0.1466, 0.0033, 3, 0.97, 1.0, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(ref.srid, pnt.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L48_C8", "label": "transformed =", "type": "assigned_variable", "loc": [48, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L36_C4", "vector": [14, 2, 0.1612, 0.013, 2, 0.91, 0.75, 374, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "transformed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " transformed = (('Kecksburg', 2272, 'POINT(1490553.98959621 314792.131023984)'),\n ('Roswell', 2257, 'POINT(481902.189077221 868477.766629735)'),\n ('Aurora', 2276, 'POINT(2269923.2484839 7069381.28722222)'),\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L53_C8", "label": "for name, srid, wkt", "type": "for", "loc": [53, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L36_C4", "vector": [6, 2, 0.1792, 0.0163, 2, 0.91, 1.0, 238, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "name, srid, wkt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for name, srid, wkt in transformed:\n # Doing this implicitly sets `select_related` select the location.\n # TODO: Fix why this breaks on Oracle.\n qs = list(City.objects.filter(name=name).transform(srid, field_name='location__point'))\n check_pnt(GEOSGeometry(wkt, srid), qs[0].location.point)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L56_C12", "label": "qs = list()", "type": "assigned_variable", "loc": [56, 56], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L53_C8", "vector": [14, 3, 0.1824, 0.0033, 3, 0.27, 0.0, 251, 3, 1, 0, 0, 430, 10, 3], "semantic": {"name": "qs", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " qs = list(City.objects.filter(name=name).transform(srid, field_name='location__point'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L57_C12", "label": "check_pnt()", "type": "expression", "loc": [57, 57], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L53_C8", "vector": [8, 3, 0.1857, 0.0033, 3, 0.27, 1.0, 81, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "check_pnt", "arg_names": [], "import_names": [], "rhs_call_name": "check_pnt", "annotation": ""}, "snippet": " check_pnt(GEOSGeometry(wkt, srid), qs[0].location.point)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L61_C4", "label": "test04a_related_extent_aggregate", "type": "function", "loc": [61, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "vector": [2, 1, 0.2248, 0.0554, 1, 0.58, 0.1875, 647, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "test04a_related_extent_aggregate", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test04a_related_extent_aggregate(self):\n \"Testing the `extent` GeoQuerySet aggregates on related geographic models.\"\n # This combines the Extent and Union aggregates into one query\n aggs = City.objects.aggregate(Extent('location__point'))\n\n # One for all locations, one that excludes Roswell.\n all_extent = (-104.528060913086, 33.0583305358887,-79.4607315063477, 40.1847610473633)\n txpa_extent = (-97.51611328125, 33.0583305358887,-79.4607315063477, 40.1847610473633)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L62_C8", "label": "expression", "type": "expression", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L61_C4", "vector": [8, 2, 0.202, 0.0033, 2, 0.59, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Testing the `extent` GeoQuerySet aggregates on related geographic models.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L64_C8", "label": "aggs = aggregate()", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L61_C4", "vector": [14, 2, 0.2085, 0.0033, 2, 0.59, 0.125, 366, 3, 1, 0, 0, 583, 10, 2], "semantic": {"name": "aggs", "arg_names": [], "import_names": [], "rhs_call_name": "aggregate", "annotation": ""}, "snippet": " aggs = City.objects.aggregate(Extent('location__point'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L67_C8", "label": "all_extent =", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L61_C4", "vector": [14, 2, 0.2182, 0.0033, 2, 0.59, 0.25, 767, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "all_extent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " all_extent = (-104.528060913086, 33.0583305358887,-79.4607315063477, 40.1847610473633)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L68_C8", "label": "txpa_extent =", "type": "assigned_variable", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L61_C4", "vector": [14, 2, 0.2215, 0.0033, 2, 0.59, 0.375, 341, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "txpa_extent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " txpa_extent = (-97.51611328125, 33.0583305358887,-79.4607315063477, 40.1847610473633)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L69_C8", "label": "e1 = extent()", "type": "assigned_variable", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L61_C4", "vector": [14, 2, 0.2248, 0.0033, 2, 0.59, 0.5, 663, 3, 1, 0, 0, 962, 10, 1], "semantic": {"name": "e1", "arg_names": [], "import_names": [], "rhs_call_name": "extent", "annotation": ""}, "snippet": " e1 = City.objects.extent(field_name='location__point')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L70_C8", "label": "e2 = extent()", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L61_C4", "vector": [14, 2, 0.228, 0.0033, 2, 0.59, 0.625, 254, 3, 1, 0, 0, 962, 10, 2], "semantic": {"name": "e2", "arg_names": [], "import_names": [], "rhs_call_name": "extent", "annotation": ""}, "snippet": " e2 = City.objects.exclude(name='Roswell').extent(field_name='location__point')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L71_C8", "label": "e3 =", "type": "assigned_variable", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L61_C4", "vector": [14, 2, 0.2313, 0.0033, 2, 0.59, 0.75, 61, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "e3", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " e3 = aggs['location__point__extent']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L75_C8", "label": "tol =", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L61_C4", "vector": [14, 2, 0.2443, 0.0033, 2, 0.59, 0.875, 422, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "tol", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tol = 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L76_C8", "label": "for ref, e", "type": "for", "loc": [76, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L61_C4", "vector": [6, 2, 0.2492, 0.0065, 2, 0.59, 1.0, 233, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "ref, e", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for ref, e in [(all_extent, e1), (txpa_extent, e2), (all_extent, e3)]:\n for ref_val, e_val in zip(ref, e): self.assertAlmostEqual(ref_val, e_val, tol)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L77_C12", "label": "for ref_val, e_val", "type": "for", "loc": [77, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L76_C8", "vector": [6, 3, 0.2508, 0.0033, 3, 0.65, 0.0, 449, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "ref_val, e_val", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for ref_val, e_val in zip(ref, e): self.assertAlmostEqual(ref_val, e_val, tol)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L77_C47", "label": "assertAlmostEqual()", "type": "expression", "loc": [77, 77], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L77_C12", "vector": [8, 4, 0.2508, 0.0033, 4, 0.4, 0.0, 448, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "assertAlmostEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertAlmostEqual", "annotation": ""}, "snippet": " for ref_val, e_val in zip(ref, e): self.assertAlmostEqual(ref_val, e_val, tol)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4", "label": "test04b_related_union_aggregate", "type": "function", "loc": [80, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "vector": [2, 1, 0.3078, 0.0977, 1, 0.58, 0.25, 502, 0, 1, 0, 0, 0, 0, 15], "semantic": {"name": "test04b_related_union_aggregate", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test04b_related_union_aggregate(self):\n \"Testing the `unionagg` GeoQuerySet aggregates on related geographic models.\"\n # This combines the Extent and Union aggregates into one query\n aggs = City.objects.aggregate(Union('location__point'))\n\n # These are the points that are components of the aggregate geographic\n # union that is returned.\n p1 = Point(-104.528056, 33.387222)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L81_C8", "label": "expression", "type": "expression", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4", "vector": [8, 2, 0.2638, 0.0033, 2, 0.97, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Testing the `unionagg` GeoQuerySet aggregates on related geographic models.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L83_C8", "label": "aggs = aggregate()", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4", "vector": [14, 2, 0.2704, 0.0033, 2, 0.97, 0.0909, 366, 3, 1, 0, 0, 583, 10, 2], "semantic": {"name": "aggs", "arg_names": [], "import_names": [], "rhs_call_name": "aggregate", "annotation": ""}, "snippet": " aggs = City.objects.aggregate(Union('location__point'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L87_C8", "label": "p1 = Point()", "type": "assigned_variable", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4", "vector": [14, 2, 0.2834, 0.0033, 2, 0.97, 0.1818, 87, 3, 2, 0, 0, 652, 10, 1], "semantic": {"name": "p1", "arg_names": [], "import_names": [], "rhs_call_name": "Point", "annotation": ""}, "snippet": " p1 = Point(-104.528056, 33.387222)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L88_C8", "label": "p2 = Point()", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4", "vector": [14, 2, 0.2866, 0.0033, 2, 0.97, 0.2727, 843, 3, 2, 0, 0, 652, 10, 1], "semantic": {"name": "p2", "arg_names": [], "import_names": [], "rhs_call_name": "Point", "annotation": ""}, "snippet": " p2 = Point(-97.516111, 33.058333)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L89_C8", "label": "p3 = Point()", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4", "vector": [14, 2, 0.2899, 0.0033, 2, 0.97, 0.3636, 80, 3, 2, 0, 0, 652, 10, 1], "semantic": {"name": "p3", "arg_names": [], "import_names": [], "rhs_call_name": "Point", "annotation": ""}, "snippet": " p3 = Point(-79.460734, 40.18476)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L96_C8", "label": "if", "type": "if", "loc": [96, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4", "vector": [4, 2, 0.3208, 0.0195, 2, 0.97, 0.4545, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if oracle:\n ref_u1 = MultiPoint(p3, p1, p2, srid=4326)\n ref_u2 = MultiPoint(p3, p2, srid=4326)\n else:\n ref_u1 = MultiPoint(p1, p2, p3, srid=4326)\n ref_u2 = MultiPoint(p2, p3, srid=4326)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L97_C12", "label": "ref_u1 = MultiPoint()", "type": "assigned_variable", "loc": [97, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L96_C8", "vector": [14, 3, 0.316, 0.0033, 3, 0.74, 0.0, 624, 3, 4, 0, 0, 493, 10, 1], "semantic": {"name": "ref_u1", "arg_names": [], "import_names": [], "rhs_call_name": "MultiPoint", "annotation": ""}, "snippet": " ref_u1 = MultiPoint(p3, p1, p2, srid=4326)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L98_C12", "label": "ref_u2 = MultiPoint()", "type": "assigned_variable", "loc": [98, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L96_C8", "vector": [14, 3, 0.3192, 0.0033, 3, 0.74, 0.3333, 756, 3, 3, 0, 0, 493, 10, 1], "semantic": {"name": "ref_u2", "arg_names": [], "import_names": [], "rhs_call_name": "MultiPoint", "annotation": ""}, "snippet": " ref_u2 = MultiPoint(p3, p2, srid=4326)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L100_C12", "label": "ref_u1 = MultiPoint()", "type": "assigned_variable", "loc": [100, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L96_C8", "vector": [14, 3, 0.3257, 0.0033, 3, 0.74, 0.6667, 624, 3, 4, 0, 0, 493, 10, 1], "semantic": {"name": "ref_u1", "arg_names": [], "import_names": [], "rhs_call_name": "MultiPoint", "annotation": ""}, "snippet": " ref_u1 = MultiPoint(p1, p2, p3, srid=4326)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L101_C12", "label": "ref_u2 = MultiPoint()", "type": "assigned_variable", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L96_C8", "vector": [14, 3, 0.329, 0.0033, 3, 0.74, 1.0, 756, 3, 3, 0, 0, 493, 10, 1], "semantic": {"name": "ref_u2", "arg_names": [], "import_names": [], "rhs_call_name": "MultiPoint", "annotation": ""}, "snippet": " ref_u2 = MultiPoint(p2, p3, srid=4326)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L103_C8", "label": "u1 = unionagg()", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4", "vector": [14, 2, 0.3355, 0.0033, 2, 0.97, 0.5455, 74, 3, 1, 0, 0, 886, 10, 1], "semantic": {"name": "u1", "arg_names": [], "import_names": [], "rhs_call_name": "unionagg", "annotation": ""}, "snippet": " u1 = City.objects.unionagg(field_name='location__point')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L104_C8", "label": "u2 = unionagg()", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4", "vector": [14, 2, 0.3388, 0.0033, 2, 0.97, 0.6364, 420, 3, 1, 0, 0, 886, 10, 2], "semantic": {"name": "u2", "arg_names": [], "import_names": [], "rhs_call_name": "unionagg", "annotation": ""}, "snippet": " u2 = City.objects.exclude(name='Roswell').unionagg(field_name='location__point')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L105_C8", "label": "u3 =", "type": "assigned_variable", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4", "vector": [14, 2, 0.342, 0.0033, 2, 0.97, 0.7273, 164, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "u3", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " u3 = aggs['location__point__union']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L107_C8", "label": "assertEqual()", "type": "expression", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4", "vector": [8, 2, 0.3485, 0.0033, 2, 0.97, 0.8182, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(ref_u1, u1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L108_C8", "label": "assertEqual()", "type": "expression", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4", "vector": [8, 2, 0.3518, 0.0033, 2, 0.97, 0.9091, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(ref_u2, u2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L109_C8", "label": "assertEqual()", "type": "expression", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4", "vector": [8, 2, 0.355, 0.0033, 2, 0.97, 1.0, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(ref_u1, u3)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L111_C4", "label": "test05_select_related_fk_to_subclass", "type": "function", "loc": [111, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "vector": [2, 1, 0.3664, 0.013, 1, 0.58, 0.3125, 466, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "test05_select_related_fk_to_subclass", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test05_select_related_fk_to_subclass(self):\n \"Testing that calling select_related on a query over a model with an FK to a model subclass works\"\n # Regression test for #9752.\n l = list(DirectoryEntry.objects.all().select_related())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L112_C8", "label": "expression", "type": "expression", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L111_C4", "vector": [8, 2, 0.3648, 0.0033, 2, 0.1, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Testing that calling select_related on a query over a model with an FK to a model subclass works\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L114_C8", "label": "l = list()", "type": "assigned_variable", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L111_C4", "vector": [14, 2, 0.3713, 0.0033, 2, 0.1, 1.0, 810, 3, 1, 0, 0, 430, 10, 3], "semantic": {"name": "l", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " l = list(DirectoryEntry.objects.all().select_related())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "label": "test06_f_expressions", "type": "function", "loc": [116, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "vector": [2, 1, 0.4528, 0.1531, 1, 0.58, 0.375, 648, 0, 1, 0, 0, 0, 0, 27], "semantic": {"name": "test06_f_expressions", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test06_f_expressions(self):\n \"Testing F() expressions on GeometryFields.\"\n # Constructing a dummy parcel border and getting the City instance for\n # assigning the FK.\n b1 = GEOSGeometry('POLYGON((-97.501205 33.052520,-97.501205 33.052576,-97.501150 33.052576,-97.501150 33.052520,-97.501205 33.052520))', srid=4326)\n pcity = City.objects.get(name='Aurora')\n\n # First parcel has incorrect center point that is equal to the City;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L117_C8", "label": "expression", "type": "expression", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "vector": [8, 2, 0.3811, 0.0033, 2, 0.58, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Testing F() expressions on GeometryFields.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L120_C8", "label": "b1 = GEOSGeometry()", "type": "assigned_variable", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "vector": [14, 2, 0.3909, 0.0033, 2, 0.58, 0.0588, 341, 3, 2, 0, 0, 958, 10, 1], "semantic": {"name": "b1", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSGeometry", "annotation": ""}, "snippet": " b1 = GEOSGeometry('POLYGON((-97.501205 33.052520,-97.501205 33.052576,-97.501150 33.052576,-97.501150 33.052520,-97.501205 33.052520))', srid=4326)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L121_C8", "label": "pcity = get()", "type": "assigned_variable", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "vector": [14, 2, 0.3941, 0.0033, 2, 0.58, 0.1176, 824, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "pcity", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " pcity = City.objects.get(name='Aurora')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L126_C8", "label": "c1 =", "type": "assigned_variable", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "vector": [14, 2, 0.4104, 0.0033, 2, 0.58, 0.1765, 452, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "c1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c1 = pcity.location.point"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L127_C8", "label": "c2 = transform()", "type": "assigned_variable", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "vector": [14, 2, 0.4137, 0.0033, 2, 0.58, 0.2353, 600, 3, 2, 0, 0, 48, 10, 1], "semantic": {"name": "c2", "arg_names": [], "import_names": [], "rhs_call_name": "transform", "annotation": ""}, "snippet": " c2 = c1.transform(2276, clone=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L128_C8", "label": "b2 = buffer()", "type": "assigned_variable", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "vector": [14, 2, 0.4169, 0.0033, 2, 0.58, 0.2941, 670, 3, 1, 0, 0, 640, 10, 1], "semantic": {"name": "b2", "arg_names": [], "import_names": [], "rhs_call_name": "buffer", "annotation": ""}, "snippet": " b2 = c2.buffer(100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L129_C8", "label": "p1 = create()", "type": "assigned_variable", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "vector": [14, 2, 0.4202, 0.0033, 2, 0.58, 0.3529, 87, 3, 6, 0, 0, 316, 10, 1], "semantic": {"name": "p1", "arg_names": [], "import_names": [], "rhs_call_name": "create", "annotation": ""}, "snippet": " p1 = Parcel.objects.create(name='P1', city=pcity, center1=c1, center2=c2, border1=b1, border2=b2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L135_C8", "label": "c1 =", "type": "assigned_variable", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "vector": [14, 2, 0.4397, 0.0033, 2, 0.58, 0.4118, 452, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "c1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c1 = b1.centroid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L136_C8", "label": "c2 = transform()", "type": "assigned_variable", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "vector": [14, 2, 0.443, 0.0033, 2, 0.58, 0.4706, 600, 3, 2, 0, 0, 48, 10, 1], "semantic": {"name": "c2", "arg_names": [], "import_names": [], "rhs_call_name": "transform", "annotation": ""}, "snippet": " c2 = c1.transform(2276, clone=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L137_C8", "label": "p2 = create()", "type": "assigned_variable", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "vector": [14, 2, 0.4463, 0.0033, 2, 0.58, 0.5294, 843, 3, 6, 0, 0, 316, 10, 1], "semantic": {"name": "p2", "arg_names": [], "import_names": [], "rhs_call_name": "create", "annotation": ""}, "snippet": " p2 = Parcel.objects.create(name='P2', city=pcity, center1=c1, center2=c2, border1=b1, border2=b1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L141_C8", "label": "qs = filter()", "type": "assigned_variable", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "vector": [14, 2, 0.4593, 0.0033, 2, 0.58, 0.5882, 251, 3, 1, 0, 0, 526, 10, 2], "semantic": {"name": "qs", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " qs = Parcel.objects.filter(center1__within=F('border1'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L142_C8", "label": "assertEqual()", "type": "expression", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "vector": [8, 2, 0.4625, 0.0033, 2, 0.58, 0.6471, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(1, len(qs))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L143_C8", "label": "assertEqual()", "type": "expression", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "vector": [8, 2, 0.4658, 0.0033, 2, 0.58, 0.7059, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('P2', qs[0].name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L145_C8", "label": "if", "type": "if", "loc": [145, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "vector": [4, 2, 0.4805, 0.0195, 2, 0.58, 0.7647, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not mysql:\n # This time center2 is in a different coordinate system and needs\n # to be wrapped in transformation SQL.\n qs = Parcel.objects.filter(center2__within=F('border1'))\n self.assertEqual(1, len(qs))\n self.assertEqual('P2', qs[0].name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L148_C12", "label": "qs = filter()", "type": "assigned_variable", "loc": [148, 148], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L145_C8", "vector": [14, 3, 0.4821, 0.0033, 3, 0.38, 0.0, 251, 3, 1, 0, 0, 526, 10, 2], "semantic": {"name": "qs", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " qs = Parcel.objects.filter(center2__within=F('border1'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L149_C12", "label": "assertEqual()", "type": "expression", "loc": [149, 149], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L145_C8", "vector": [8, 3, 0.4853, 0.0033, 3, 0.38, 0.5, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(1, len(qs))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L150_C12", "label": "assertEqual()", "type": "expression", "loc": [150, 150], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L145_C8", "vector": [8, 3, 0.4886, 0.0033, 3, 0.38, 1.0, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('P2', qs[0].name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L154_C8", "label": "qs = filter()", "type": "assigned_variable", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "vector": [14, 2, 0.5016, 0.0033, 2, 0.58, 0.8235, 251, 3, 1, 0, 0, 526, 10, 2], "semantic": {"name": "qs", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " qs = Parcel.objects.filter(center1=F('city__location__point'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L155_C8", "label": "assertEqual()", "type": "expression", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "vector": [8, 2, 0.5049, 0.0033, 2, 0.58, 0.8824, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(1, len(qs))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L156_C8", "label": "assertEqual()", "type": "expression", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "vector": [8, 2, 0.5081, 0.0033, 2, 0.58, 0.9412, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('P1', qs[0].name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L158_C8", "label": "if", "type": "if", "loc": [158, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "vector": [4, 2, 0.5212, 0.0163, 2, 0.58, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not mysql:\n # This time the city column should be wrapped in transformation SQL.\n qs = Parcel.objects.filter(border2__contains=F('city__location__point'))\n self.assertEqual(1, len(qs))\n self.assertEqual('P1', qs[0].name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L160_C12", "label": "qs = filter()", "type": "assigned_variable", "loc": [160, 160], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L158_C8", "vector": [14, 3, 0.5212, 0.0033, 3, 0.78, 0.0, 251, 3, 1, 0, 0, 526, 10, 2], "semantic": {"name": "qs", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " qs = Parcel.objects.filter(border2__contains=F('city__location__point'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L161_C12", "label": "assertEqual()", "type": "expression", "loc": [161, 161], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L158_C8", "vector": [8, 3, 0.5244, 0.0033, 3, 0.78, 0.5, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(1, len(qs))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L162_C12", "label": "assertEqual()", "type": "expression", "loc": [162, 162], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L158_C8", "vector": [8, 3, 0.5277, 0.0033, 3, 0.78, 1.0, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('P1', qs[0].name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L164_C4", "label": "test07_values", "type": "function", "loc": [164, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "vector": [2, 1, 0.5586, 0.0521, 1, 0.58, 0.4375, 952, 0, 1, 0, 0, 0, 0, 10], "semantic": {"name": "test07_values", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test07_values(self):\n \"Testing values() and values_list() and GeoQuerySets.\"\n # GeoQuerySet and GeoValuesQuerySet, and GeoValuesListQuerySet respectively.\n gqs = Location.objects.all()\n gvqs = Location.objects.values()\n gvlqs = Location.objects.values_list()\n\n # Incrementing through each of the models, dictionaries, and tuples"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L165_C8", "label": "expression", "type": "expression", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L164_C4", "vector": [8, 2, 0.5375, 0.0033, 2, 0.47, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Testing values() and values_list() and GeoQuerySets.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L167_C8", "label": "gqs = all()", "type": "assigned_variable", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L164_C4", "vector": [14, 2, 0.544, 0.0033, 2, 0.47, 0.25, 296, 3, 0, 0, 0, 895, 10, 1], "semantic": {"name": "gqs", "arg_names": [], "import_names": [], "rhs_call_name": "all", "annotation": ""}, "snippet": " gqs = Location.objects.all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L168_C8", "label": "gvqs = values()", "type": "assigned_variable", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L164_C4", "vector": [14, 2, 0.5472, 0.0033, 2, 0.47, 0.5, 745, 3, 0, 0, 0, 721, 10, 1], "semantic": {"name": "gvqs", "arg_names": [], "import_names": [], "rhs_call_name": "values", "annotation": ""}, "snippet": " gvqs = Location.objects.values()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L169_C8", "label": "gvlqs = values_list()", "type": "assigned_variable", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L164_C4", "vector": [14, 2, 0.5505, 0.0033, 2, 0.47, 0.75, 32, 3, 0, 0, 0, 253, 10, 1], "semantic": {"name": "gvlqs", "arg_names": [], "import_names": [], "rhs_call_name": "values_list", "annotation": ""}, "snippet": " gvlqs = Location.objects.values_list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L173_C8", "label": "for m, d, t", "type": "for", "loc": [173, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L164_C4", "vector": [6, 2, 0.5733, 0.0228, 2, 0.47, 1.0, 358, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "m, d, t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for m, d, t in zip(gqs, gvqs, gvlqs):\n # The values should be Geometry objects and not raw strings returned\n # by the spatial database.\n self.failUnless(isinstance(d['point'], Geometry))\n self.failUnless(isinstance(t[1], Geometry))\n self.assertEqual(m.point, d['point'])\n self.assertEqual(m.point, t[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L176_C12", "label": "failUnless()", "type": "expression", "loc": [176, 176], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L173_C8", "vector": [8, 3, 0.5733, 0.0033, 3, 0.27, 0.0, 252, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "failUnless", "arg_names": [], "import_names": [], "rhs_call_name": "failUnless", "annotation": ""}, "snippet": " self.failUnless(isinstance(d['point'], Geometry))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L177_C12", "label": "failUnless()", "type": "expression", "loc": [177, 177], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L173_C8", "vector": [8, 3, 0.5765, 0.0033, 3, 0.27, 0.3333, 252, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "failUnless", "arg_names": [], "import_names": [], "rhs_call_name": "failUnless", "annotation": ""}, "snippet": " self.failUnless(isinstance(t[1], Geometry))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L178_C12", "label": "assertEqual()", "type": "expression", "loc": [178, 178], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L173_C8", "vector": [8, 3, 0.5798, 0.0033, 3, 0.27, 0.6667, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(m.point, d['point'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L179_C12", "label": "assertEqual()", "type": "expression", "loc": [179, 179], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L173_C8", "vector": [8, 3, 0.5831, 0.0033, 3, 0.27, 1.0, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(m.point, t[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L181_C4", "label": "test08_defer_only", "type": "function", "loc": [181, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "vector": [2, 1, 0.5977, 0.0195, 1, 0.58, 0.5, 977, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "test08_defer_only", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test08_defer_only(self):\n \"Testing defer() and only() on Geographic models.\"\n qs = Location.objects.all()\n def_qs = Location.objects.defer('point')\n for loc, def_loc in zip(qs, def_qs):\n self.assertEqual(loc.point, def_loc.point)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L182_C8", "label": "expression", "type": "expression", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L181_C4", "vector": [8, 2, 0.5928, 0.0033, 2, 0.53, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Testing defer() and only() on Geographic models.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L183_C8", "label": "qs = all()", "type": "assigned_variable", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L181_C4", "vector": [14, 2, 0.5961, 0.0033, 2, 0.53, 0.3333, 251, 3, 0, 0, 0, 895, 10, 1], "semantic": {"name": "qs", "arg_names": [], "import_names": [], "rhs_call_name": "all", "annotation": ""}, "snippet": " qs = Location.objects.all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L184_C8", "label": "def_qs = defer()", "type": "assigned_variable", "loc": [184, 184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L181_C4", "vector": [14, 2, 0.5993, 0.0033, 2, 0.53, 0.6667, 971, 3, 1, 0, 0, 826, 10, 1], "semantic": {"name": "def_qs", "arg_names": [], "import_names": [], "rhs_call_name": "defer", "annotation": ""}, "snippet": " def_qs = Location.objects.defer('point')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L185_C8", "label": "for loc, def_loc", "type": "for", "loc": [185, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L181_C4", "vector": [6, 2, 0.6042, 0.0065, 2, 0.53, 1.0, 362, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "loc, def_loc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for loc, def_loc in zip(qs, def_qs):\n self.assertEqual(loc.point, def_loc.point)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L186_C12", "label": "assertEqual()", "type": "expression", "loc": [186, 186], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L185_C8", "vector": [8, 3, 0.6059, 0.0033, 3, 0.12, 0.0, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(loc.point, def_loc.point)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L188_C4", "label": "test09_pk_relations", "type": "function", "loc": [188, 206], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "vector": [2, 1, 0.6417, 0.0619, 1, 0.58, 0.5625, 334, 0, 1, 0, 0, 0, 0, 9], "semantic": {"name": "test09_pk_relations", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test09_pk_relations(self):\n \"Ensuring correct primary key column is selected across relations. See #10757.\"\n # Adding two more cities, but this time making sure that their location\n # ID values do not match their City ID values.\n loc1 = Location.objects.create(point='POINT (-95.363151 29.763374)')\n loc2 = Location.objects.create(point='POINT (-96.801611 32.782057)')\n dallas = City.objects.create(name='Dallas', state='TX', location=loc2)\n houston = City.objects.create(name='Houston', state='TX', location=loc1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L189_C8", "label": "expression", "type": "expression", "loc": [189, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L188_C4", "vector": [8, 2, 0.6156, 0.0033, 2, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Ensuring correct primary key column is selected across relations. See #10757.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L192_C8", "label": "loc1 = create()", "type": "assigned_variable", "loc": [192, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L188_C4", "vector": [14, 2, 0.6254, 0.0033, 2, 0.49, 0.125, 901, 3, 1, 0, 0, 316, 10, 1], "semantic": {"name": "loc1", "arg_names": [], "import_names": [], "rhs_call_name": "create", "annotation": ""}, "snippet": " loc1 = Location.objects.create(point='POINT (-95.363151 29.763374)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L193_C8", "label": "loc2 = create()", "type": "assigned_variable", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L188_C4", "vector": [14, 2, 0.6287, 0.0033, 2, 0.49, 0.25, 95, 3, 1, 0, 0, 316, 10, 1], "semantic": {"name": "loc2", "arg_names": [], "import_names": [], "rhs_call_name": "create", "annotation": ""}, "snippet": " loc2 = Location.objects.create(point='POINT (-96.801611 32.782057)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L194_C8", "label": "dallas = create()", "type": "assigned_variable", "loc": [194, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L188_C4", "vector": [14, 2, 0.6319, 0.0033, 2, 0.49, 0.375, 703, 3, 3, 0, 0, 316, 10, 1], "semantic": {"name": "dallas", "arg_names": [], "import_names": [], "rhs_call_name": "create", "annotation": ""}, "snippet": " dallas = City.objects.create(name='Dallas', state='TX', location=loc2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L195_C8", "label": "houston = create()", "type": "assigned_variable", "loc": [195, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L188_C4", "vector": [14, 2, 0.6352, 0.0033, 2, 0.49, 0.5, 402, 3, 3, 0, 0, 316, 10, 1], "semantic": {"name": "houston", "arg_names": [], "import_names": [], "rhs_call_name": "create", "annotation": ""}, "snippet": " houston = City.objects.create(name='Houston', state='TX', location=loc1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L201_C8", "label": "city_ids =", "type": "assigned_variable", "loc": [201, 201], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L188_C4", "vector": [14, 2, 0.6547, 0.0033, 2, 0.49, 0.625, 955, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "city_ids", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " city_ids = (1, 2, 3, 4, 5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L202_C8", "label": "loc_ids =", "type": "assigned_variable", "loc": [202, 202], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L188_C4", "vector": [14, 2, 0.658, 0.0033, 2, 0.49, 0.75, 791, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "loc_ids", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " loc_ids = (1, 2, 3, 5, 4)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L203_C8", "label": "ids_qs = values()", "type": "assigned_variable", "loc": [203, 203], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L188_C4", "vector": [14, 2, 0.6612, 0.0033, 2, 0.49, 0.875, 128, 3, 2, 0, 0, 721, 10, 2], "semantic": {"name": "ids_qs", "arg_names": [], "import_names": [], "rhs_call_name": "values", "annotation": ""}, "snippet": " ids_qs = City.objects.order_by('id').values('id', 'location__id')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L204_C8", "label": "for val_dict, c_id, l_id", "type": "for", "loc": [204, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L188_C4", "vector": [6, 2, 0.6678, 0.0098, 2, 0.49, 1.0, 130, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "val_dict, c_id, l_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for val_dict, c_id, l_id in zip(ids_qs, city_ids, loc_ids):\n self.assertEqual(val_dict['id'], c_id)\n self.assertEqual(val_dict['location__id'], l_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L205_C12", "label": "assertEqual()", "type": "expression", "loc": [205, 205], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L204_C8", "vector": [8, 3, 0.6678, 0.0033, 3, 0.57, 0.0, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(val_dict['id'], c_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L206_C12", "label": "assertEqual()", "type": "expression", "loc": [206, 206], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L204_C8", "vector": [8, 3, 0.671, 0.0033, 3, 0.57, 1.0, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(val_dict['location__id'], l_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L208_C4", "label": "test10_combine", "type": "function", "loc": [208, 218], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "vector": [2, 1, 0.6938, 0.0358, 1, 0.58, 0.625, 684, 0, 1, 0, 0, 0, 0, 10], "semantic": {"name": "test10_combine", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test10_combine(self):\n \"Testing the combination of two GeoQuerySets. See #10807.\"\n buf1 = City.objects.get(name='Aurora').location.point.buffer(0.1)\n buf2 = City.objects.get(name='Kecksburg').location.point.buffer(0.1)\n qs1 = City.objects.filter(location__point__within=buf1)\n qs2 = City.objects.filter(location__point__within=buf2)\n combined = qs1 | qs2\n names = [c.name for c in combined]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L209_C8", "label": "expression", "type": "expression", "loc": [209, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L208_C4", "vector": [8, 2, 0.6808, 0.0033, 2, 0.82, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Testing the combination of two GeoQuerySets. See #10807.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L210_C8", "label": "buf1 = buffer()", "type": "assigned_variable", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L208_C4", "vector": [14, 2, 0.684, 0.0033, 2, 0.82, 0.1111, 943, 3, 1, 0, 0, 640, 10, 2], "semantic": {"name": "buf1", "arg_names": [], "import_names": [], "rhs_call_name": "buffer", "annotation": ""}, "snippet": " buf1 = City.objects.get(name='Aurora').location.point.buffer(0.1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L211_C8", "label": "buf2 = buffer()", "type": "assigned_variable", "loc": [211, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L208_C4", "vector": [14, 2, 0.6873, 0.0033, 2, 0.82, 0.2222, 846, 3, 1, 0, 0, 640, 10, 2], "semantic": {"name": "buf2", "arg_names": [], "import_names": [], "rhs_call_name": "buffer", "annotation": ""}, "snippet": " buf2 = City.objects.get(name='Kecksburg').location.point.buffer(0.1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L212_C8", "label": "qs1 = filter()", "type": "assigned_variable", "loc": [212, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L208_C4", "vector": [14, 2, 0.6906, 0.0033, 2, 0.82, 0.3333, 811, 3, 1, 0, 0, 526, 10, 1], "semantic": {"name": "qs1", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " qs1 = City.objects.filter(location__point__within=buf1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L213_C8", "label": "qs2 = filter()", "type": "assigned_variable", "loc": [213, 213], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L208_C4", "vector": [14, 2, 0.6938, 0.0033, 2, 0.82, 0.4444, 595, 3, 1, 0, 0, 526, 10, 1], "semantic": {"name": "qs2", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " qs2 = City.objects.filter(location__point__within=buf2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L214_C8", "label": "combined =", "type": "assigned_variable", "loc": [214, 214], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L208_C4", "vector": [14, 2, 0.6971, 0.0033, 2, 0.82, 0.5556, 339, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "combined", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " combined = qs1 | qs2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L215_C8", "label": "names =", "type": "assigned_variable", "loc": [215, 215], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L208_C4", "vector": [14, 2, 0.7003, 0.0033, 2, 0.82, 0.6667, 382, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "names", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " names = [c.name for c in combined]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L216_C8", "label": "assertEqual()", "type": "expression", "loc": [216, 216], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L208_C4", "vector": [8, 2, 0.7036, 0.0033, 2, 0.82, 0.7778, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(2, len(names))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L217_C8", "label": "failUnless()", "type": "expression", "loc": [217, 217], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L208_C4", "vector": [8, 2, 0.7068, 0.0033, 2, 0.82, 0.8889, 252, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "failUnless", "arg_names": [], "import_names": [], "rhs_call_name": "failUnless", "annotation": ""}, "snippet": " self.failUnless('Aurora' in names)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L218_C8", "label": "failUnless()", "type": "expression", "loc": [218, 218], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L208_C4", "vector": [8, 2, 0.7101, 0.0033, 2, 0.82, 1.0, 252, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "failUnless", "arg_names": [], "import_names": [], "rhs_call_name": "failUnless", "annotation": ""}, "snippet": " self.failUnless('Kecksburg' in names)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L220_C4", "label": "test11_geoquery_pickle", "type": "function", "loc": [220, 227], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "vector": [2, 1, 0.728, 0.0261, 1, 0.58, 0.6875, 551, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "test11_geoquery_pickle", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test11_geoquery_pickle(self):\n \"Ensuring GeoQuery objects are unpickled correctly. See #10839.\"\n import pickle\n from django.contrib.gis.db.models.sql import GeoQuery\n qs = City.objects.all()\n q_str = pickle.dumps(qs.query)\n q = pickle.loads(q_str)\n self.assertEqual(GeoQuery, q.__class__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L221_C8", "label": "expression", "type": "expression", "loc": [221, 221], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L220_C4", "vector": [8, 2, 0.7199, 0.0033, 2, 0.95, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Ensuring GeoQuery objects are unpickled correctly. See #10839.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Import_L222_C8", "label": "pickle import pickle", "type": "import", "loc": [222, 222], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L220_C4", "vector": [1, 2, 0.7231, 0.0033, 2, 0.95, 0.1667, 848, 0, 1, 0, 0, 848, 0, 0], "semantic": {"name": "pickle", "arg_names": [], "import_names": ["pickle"], "rhs_call_name": "", "annotation": ""}, "snippet": " import pickle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:ImportFrom_L223_C8", "label": "from django.contrib.gis.db.models.sql import GeoQuery", "type": "import", "loc": [223, 223], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L220_C4", "vector": [1, 2, 0.7264, 0.0033, 2, 0.95, 0.3333, 437, 0, 1, 0, 0, 437, 0, 0], "semantic": {"name": "django.contrib.gis.db.models.sql", "arg_names": [], "import_names": ["GeoQuery"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.db.models.sql import GeoQuery"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L224_C8", "label": "qs = all()", "type": "assigned_variable", "loc": [224, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L220_C4", "vector": [14, 2, 0.7296, 0.0033, 2, 0.95, 0.5, 251, 3, 0, 0, 0, 895, 10, 1], "semantic": {"name": "qs", "arg_names": [], "import_names": [], "rhs_call_name": "all", "annotation": ""}, "snippet": " qs = City.objects.all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L225_C8", "label": "q_str = dumps()", "type": "assigned_variable", "loc": [225, 225], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L220_C4", "vector": [14, 2, 0.7329, 0.0033, 2, 0.95, 0.6667, 195, 3, 1, 0, 0, 160, 10, 1], "semantic": {"name": "q_str", "arg_names": [], "import_names": [], "rhs_call_name": "dumps", "annotation": ""}, "snippet": " q_str = pickle.dumps(qs.query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L226_C8", "label": "q = loads()", "type": "assigned_variable", "loc": [226, 226], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L220_C4", "vector": [14, 2, 0.7362, 0.0033, 2, 0.95, 0.8333, 516, 3, 1, 0, 0, 88, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "loads", "annotation": ""}, "snippet": " q = pickle.loads(q_str)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L227_C8", "label": "assertEqual()", "type": "expression", "loc": [227, 227], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L220_C4", "vector": [8, 2, 0.7394, 0.0033, 2, 0.95, 1.0, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(GeoQuery, q.__class__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L233_C4", "label": "test12a_count", "type": "function", "loc": [233, 242], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "vector": [2, 1, 0.7736, 0.0326, 1, 0.58, 0.75, 203, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "test12a_count", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test12a_count(self):\n \"Testing `Count` aggregate use with the `GeoManager` on geo-fields.\"\n # Creating a new City, 'Fort Worth', that uses the same location\n # as Dallas.\n dallas = City.objects.get(name='Dallas')\n ftworth = City.objects.create(name='Fort Worth', state='TX', location=dallas.location)\n\n # Count annotation should be 2 for the Dallas location now."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L234_C8", "label": "expression", "type": "expression", "loc": [234, 234], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L233_C4", "vector": [8, 2, 0.7622, 0.0033, 2, 0.48, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Testing `Count` aggregate use with the `GeoManager` on geo-fields.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L237_C8", "label": "dallas = get()", "type": "assigned_variable", "loc": [237, 237], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L233_C4", "vector": [14, 2, 0.772, 0.0033, 2, 0.48, 0.25, 703, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "dallas", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " dallas = City.objects.get(name='Dallas')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L238_C8", "label": "ftworth = create()", "type": "assigned_variable", "loc": [238, 238], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L233_C4", "vector": [14, 2, 0.7752, 0.0033, 2, 0.48, 0.5, 637, 3, 3, 0, 0, 316, 10, 1], "semantic": {"name": "ftworth", "arg_names": [], "import_names": [], "rhs_call_name": "create", "annotation": ""}, "snippet": " ftworth = City.objects.create(name='Fort Worth', state='TX', location=dallas.location)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L241_C8", "label": "loc = get()", "type": "assigned_variable", "loc": [241, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L233_C4", "vector": [14, 2, 0.785, 0.0033, 2, 0.48, 0.75, 822, 3, 1, 0, 0, 607, 10, 3], "semantic": {"name": "loc", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " loc = Location.objects.annotate(num_cities=Count('city')).get(id=dallas.location.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L242_C8", "label": "assertEqual()", "type": "expression", "loc": [242, 242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L233_C4", "vector": [8, 2, 0.7883, 0.0033, 2, 0.48, 1.0, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(2, loc.num_cities)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "label": "test12b_count", "type": "function", "loc": [244, 263], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "vector": [2, 1, 0.8257, 0.0651, 1, 0.58, 0.8125, 544, 0, 1, 0, 0, 0, 0, 19], "semantic": {"name": "test12b_count", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test12b_count(self):\n \"Testing `Count` aggregate use with the `GeoManager` on non geo-fields. See #11087.\"\n # Creating some data for the Book/Author non-geo models that\n # use GeoManager. See #11087.\n tp = Author.objects.create(name='Trevor Paglen')\n Book.objects.create(title='Torture Taxi', author=tp)\n Book.objects.create(title='I Could Tell You But Then You Would Have to be Destroyed by Me', author=tp)\n Book.objects.create(title='Blank Spots on the Map', author=tp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L245_C8", "label": "expression", "type": "expression", "loc": [245, 245], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "vector": [8, 2, 0.798, 0.0033, 2, 0.8, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Testing `Count` aggregate use with the `GeoManager` on non geo-fields. See #11087.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L248_C8", "label": "tp = create()", "type": "assigned_variable", "loc": [248, 248], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "vector": [14, 2, 0.8078, 0.0033, 2, 0.8, 0.0833, 53, 3, 1, 0, 0, 316, 10, 1], "semantic": {"name": "tp", "arg_names": [], "import_names": [], "rhs_call_name": "create", "annotation": ""}, "snippet": " tp = Author.objects.create(name='Trevor Paglen')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L249_C8", "label": "create()", "type": "expression", "loc": [249, 249], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "vector": [8, 2, 0.8111, 0.0033, 2, 0.8, 0.1667, 316, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "create", "arg_names": [], "import_names": [], "rhs_call_name": "create", "annotation": ""}, "snippet": " Book.objects.create(title='Torture Taxi', author=tp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L250_C8", "label": "create()", "type": "expression", "loc": [250, 250], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "vector": [8, 2, 0.8143, 0.0033, 2, 0.8, 0.25, 316, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "create", "arg_names": [], "import_names": [], "rhs_call_name": "create", "annotation": ""}, "snippet": " Book.objects.create(title='I Could Tell You But Then You Would Have to be Destroyed by Me', author=tp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L251_C8", "label": "create()", "type": "expression", "loc": [251, 251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "vector": [8, 2, 0.8176, 0.0033, 2, 0.8, 0.3333, 316, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "create", "arg_names": [], "import_names": [], "rhs_call_name": "create", "annotation": ""}, "snippet": " Book.objects.create(title='Blank Spots on the Map', author=tp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L252_C8", "label": "wp = create()", "type": "assigned_variable", "loc": [252, 252], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "vector": [14, 2, 0.8208, 0.0033, 2, 0.8, 0.4167, 976, 3, 1, 0, 0, 316, 10, 1], "semantic": {"name": "wp", "arg_names": [], "import_names": [], "rhs_call_name": "create", "annotation": ""}, "snippet": " wp = Author.objects.create(name='William Patry')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L253_C8", "label": "create()", "type": "expression", "loc": [253, 253], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "vector": [8, 2, 0.8241, 0.0033, 2, 0.8, 0.5, 316, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "create", "arg_names": [], "import_names": [], "rhs_call_name": "create", "annotation": ""}, "snippet": " Book.objects.create(title='Patry on Copyright', author=wp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L258_C8", "label": "qs = filter()", "type": "assigned_variable", "loc": [258, 258], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "vector": [14, 2, 0.8404, 0.0033, 2, 0.8, 0.5833, 251, 3, 1, 0, 0, 526, 10, 3], "semantic": {"name": "qs", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " qs = Author.objects.annotate(num_books=Count('books')).filter(num_books__gt=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L259_C8", "label": "vqs = filter()", "type": "assigned_variable", "loc": [259, 259], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "vector": [14, 2, 0.8436, 0.0033, 2, 0.8, 0.6667, 694, 3, 1, 0, 0, 526, 10, 4], "semantic": {"name": "vqs", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " vqs = Author.objects.values('name').annotate(num_books=Count('books')).filter(num_books__gt=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L260_C8", "label": "assertEqual()", "type": "expression", "loc": [260, 260], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "vector": [8, 2, 0.8469, 0.0033, 2, 0.8, 0.75, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(1, len(qs))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L261_C8", "label": "assertEqual()", "type": "expression", "loc": [261, 261], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "vector": [8, 2, 0.8502, 0.0033, 2, 0.8, 0.8333, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(3, qs[0].num_books)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L262_C8", "label": "assertEqual()", "type": "expression", "loc": [262, 262], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "vector": [8, 2, 0.8534, 0.0033, 2, 0.8, 0.9167, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(1, len(vqs))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L263_C8", "label": "assertEqual()", "type": "expression", "loc": [263, 263], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "vector": [8, 2, 0.8567, 0.0033, 2, 0.8, 1.0, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(3, vqs[0]['num_books'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L267_C4", "label": "test13_select_related_null_fk", "type": "function", "loc": [267, 272], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "vector": [2, 1, 0.8779, 0.0195, 1, 0.58, 0.875, 6, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "test13_select_related_null_fk", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test13_select_related_null_fk(self):\n \"Testing `select_related` on a nullable ForeignKey via `GeoManager`. See #11381.\"\n no_author = Book.objects.create(title='Without Author')\n b = Book.objects.select_related('author').get(title='Without Author')\n # Should be `None`, and not a 'dummy' model.\n self.assertEqual(None, b.author)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L268_C8", "label": "expression", "type": "expression", "loc": [268, 268], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L267_C4", "vector": [8, 2, 0.873, 0.0033, 2, 0.9, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Testing `select_related` on a nullable ForeignKey via `GeoManager`. See #11381.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L269_C8", "label": "no_author = create()", "type": "assigned_variable", "loc": [269, 269], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L267_C4", "vector": [14, 2, 0.8762, 0.0033, 2, 0.9, 0.3333, 654, 3, 1, 0, 0, 316, 10, 1], "semantic": {"name": "no_author", "arg_names": [], "import_names": [], "rhs_call_name": "create", "annotation": ""}, "snippet": " no_author = Book.objects.create(title='Without Author')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L270_C8", "label": "b = get()", "type": "assigned_variable", "loc": [270, 270], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L267_C4", "vector": [14, 2, 0.8795, 0.0033, 2, 0.9, 0.6667, 756, 3, 1, 0, 0, 607, 10, 2], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " b = Book.objects.select_related('author').get(title='Without Author')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L272_C8", "label": "assertEqual()", "type": "expression", "loc": [272, 272], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L267_C4", "vector": [8, 2, 0.886, 0.0033, 2, 0.9, 1.0, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(None, b.author)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L277_C4", "label": "test14_collect", "type": "function", "loc": [277, 292], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "vector": [2, 1, 0.9267, 0.0521, 1, 0.58, 0.9375, 596, 0, 1, 0, 0, 0, 0, 9], "semantic": {"name": "test14_collect", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test14_collect(self):\n \"Testing the `collect` GeoQuerySet method and `Collect` aggregate.\"\n # Reference query:\n # SELECT AsText(ST_Collect(\"relatedapp_location\".\"point\")) FROM \"relatedapp_city\" LEFT OUTER JOIN\n # \"relatedapp_location\" ON (\"relatedapp_city\".\"location_id\" = \"relatedapp_location\".\"id\")\n # WHERE \"relatedapp_city\".\"state\" = 'TX';\n ref_geom = fromstr('MULTIPOINT(-97.516111 33.058333,-96.801611 32.782057,-95.363151 29.763374,-96.801611 32.782057)')\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L278_C8", "label": "expression", "type": "expression", "loc": [278, 278], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L277_C4", "vector": [8, 2, 0.9055, 0.0033, 2, 0.87, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Testing the `collect` GeoQuerySet method and `Collect` aggregate.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L283_C8", "label": "ref_geom = fromstr()", "type": "assigned_variable", "loc": [283, 283], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L277_C4", "vector": [14, 2, 0.9218, 0.0033, 2, 0.87, 0.25, 653, 3, 1, 0, 0, 946, 10, 1], "semantic": {"name": "ref_geom", "arg_names": [], "import_names": [], "rhs_call_name": "fromstr", "annotation": ""}, "snippet": " ref_geom = fromstr('MULTIPOINT(-97.516111 33.058333,-96.801611 32.782057,-95.363151 29.763374,-96.801611 32.782057)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L285_C8", "label": "c1 = collect()", "type": "assigned_variable", "loc": [285, 285], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L277_C4", "vector": [14, 2, 0.9283, 0.0033, 2, 0.87, 0.5, 452, 3, 1, 0, 0, 34, 10, 2], "semantic": {"name": "c1", "arg_names": [], "import_names": [], "rhs_call_name": "collect", "annotation": ""}, "snippet": " c1 = City.objects.filter(state='TX').collect(field_name='location__point')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L286_C8", "label": "c2 =", "type": "assigned_variable", "loc": [286, 286], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L277_C4", "vector": [14, 2, 0.9316, 0.0033, 2, 0.87, 0.75, 600, 6, 0, 0, 0, 0, 0, 3], "semantic": {"name": "c2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c2 = City.objects.filter(state='TX').aggregate(Collect('location__point'))['location__point__collect']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L288_C8", "label": "for coll", "type": "for", "loc": [288, 292], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L277_C4", "vector": [6, 2, 0.9446, 0.0163, 2, 0.87, 1.0, 599, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "coll", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for coll in (c1, c2):\n # Even though Dallas and Ft. Worth share same point, Collect doesn't\n # consolidate -- that's why 4 points in MultiPoint.\n self.assertEqual(4, len(coll))\n self.assertEqual(ref_geom, coll)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L291_C12", "label": "assertEqual()", "type": "expression", "loc": [291, 291], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L288_C8", "vector": [8, 3, 0.9479, 0.0033, 3, 0.71, 0.0, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(4, len(coll))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L292_C12", "label": "assertEqual()", "type": "expression", "loc": [292, 292], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L288_C8", "vector": [8, 3, 0.9511, 0.0033, 3, 0.71, 1.0, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(ref_geom, coll)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L294_C4", "label": "test15_invalid_select_related", "type": "function", "loc": [294, 300], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "vector": [2, 1, 0.9674, 0.0228, 1, 0.58, 1.0, 382, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "test15_invalid_select_related", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test15_invalid_select_related(self):\n \"Testing doing select_related on the related name manager of a unique FK. See #13934.\"\n qs = Article.objects.select_related('author__article')\n # This triggers TypeError when `get_default_columns` has no `local_only`\n # keyword. The TypeError is swallowed if QuerySet is actually\n # evaluated as list generation swallows TypeError in CPython.\n sql = str(qs.query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L295_C8", "label": "expression", "type": "expression", "loc": [295, 295], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L294_C4", "vector": [8, 2, 0.9609, 0.0033, 2, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Testing doing select_related on the related name manager of a unique FK. See #13934.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L296_C8", "label": "qs = select_related()", "type": "assigned_variable", "loc": [296, 296], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L294_C4", "vector": [14, 2, 0.9642, 0.0033, 2, 0.44, 0.5, 251, 3, 1, 0, 0, 595, 10, 1], "semantic": {"name": "qs", "arg_names": [], "import_names": [], "rhs_call_name": "select_related", "annotation": ""}, "snippet": " qs = Article.objects.select_related('author__article')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L300_C8", "label": "sql = str()", "type": "assigned_variable", "loc": [300, 300], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L294_C4", "vector": [14, 2, 0.9772, 0.0033, 2, 0.44, 1.0, 736, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "sql", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " sql = str(qs.query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L304_C0", "label": "suite", "type": "function", "loc": [304, 307], "level": 0, "parent": null, "vector": [2, 0, 0.9951, 0.013, 0, 0.66, 1.0, 425, 0, 0, 1, 0, 0, 0, 3], "semantic": {"name": "suite", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def suite():\n s = unittest.TestSuite()\n s.addTest(unittest.makeSuite(RelatedGeoModelTest))\n return s"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L305_C4", "label": "s = TestSuite()", "type": "assigned_variable", "loc": [305, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L304_C0", "vector": [14, 1, 0.9935, 0.0033, 1, 0.73, 0.0, 553, 3, 0, 0, 0, 75, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "TestSuite", "annotation": ""}, "snippet": " s = unittest.TestSuite()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L306_C4", "label": "addTest()", "type": "expression", "loc": [306, 306], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L304_C0", "vector": [8, 1, 0.9967, 0.0033, 1, 0.73, 0.5, 786, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "addTest", "arg_names": [], "import_names": [], "rhs_call_name": "addTest", "annotation": ""}, "snippet": " s.addTest(unittest.makeSuite(RelatedGeoModelTest))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98693:Return_L307_C4", "label": "return", "type": "return", "loc": [307, 307], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L304_C0", "vector": [13, 1, 1.0, 0.0033, 1, 0.73, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return s"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L18_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L19_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L18_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L20_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L29_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L29_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L30_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L29_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L31_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L29_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L32_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L29_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L33_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L43_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L44_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L45_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L53_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L56_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L53_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L76_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L77_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L77_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L77_C47"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L96_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L96_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L98_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L96_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L100_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L96_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L101_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L126_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L145_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L148_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L145_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L149_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L145_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L150_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L158_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L160_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L158_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L161_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:If_L158_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L162_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L173_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L173_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L176_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L173_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L177_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L173_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L178_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L173_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L179_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L181_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L182_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L181_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L181_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L181_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L185_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L185_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L186_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L192_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L194_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L195_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L201_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L202_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L203_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L204_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L204_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L205_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L204_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L206_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L208_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L209_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L210_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L211_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L212_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L213_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L214_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L215_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L216_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L217_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L218_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L220_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L220_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L221_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L220_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Import_L222_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L220_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:ImportFrom_L223_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L220_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L224_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L220_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L225_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L220_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L226_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L220_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L227_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L233_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L233_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L234_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L233_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L237_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L233_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L238_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L233_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L241_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L233_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L242_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L245_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L248_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L249_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L250_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L252_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L253_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L258_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L259_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L260_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L261_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L262_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L263_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L267_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L267_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L268_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L267_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L269_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L267_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L270_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L267_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L272_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L277_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L277_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L278_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L277_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L283_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L277_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L285_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L277_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L286_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L277_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L288_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L288_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L291_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:For_L288_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L292_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L294_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L294_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L295_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L294_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L296_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L294_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L300_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L304_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Assign_L305_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L304_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L306_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L304_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Return_L307_C4"}] |
from django.conf import settings
from django.db import DEFAULT_DB_ALIAS
# function that will pass a test.
def pass_test(*args): return
def no_backend(test_func, backend):
"Use this decorator to disable test on specified backend."
if settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'].rsplit('.')[-1] == backend:
return pass_test
else:
return test_func
# Decorators to disable entire test functions for specific
# spatial backends.
def no_oracle(func): return no_backend(func, 'oracle')
def no_postgis(func): return no_backend(func, 'postgis')
def no_mysql(func): return no_backend(func, 'mysql')
def no_spatialite(func): return no_backend(func, 'spatialite')
# Shortcut booleans to omit only portions of tests.
_default_db = settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'].rsplit('.')[-1]
oracle = _default_db == 'oracle'
postgis = _default_db == 'postgis'
mysql = _default_db == 'mysql'
spatialite = _default_db == 'spatialite'
| ajibawa-2023/Python-Code-Large/train/row_98694 | 22 | 26 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98694:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0385, 0.0385, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98694:ImportFrom_L2_C0", "label": "from django.db import DEFAULT_DB_ALIAS", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0385, 0, 0.66, 0.0833, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["DEFAULT_DB_ALIAS"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db import DEFAULT_DB_ALIAS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98694:FunctionDef_L5_C0", "label": "pass_test", "type": "function", "loc": [5, 5], "level": 0, "parent": null, "vector": [2, 0, 0.1923, 0.0385, 0, 0.66, 0.1667, 391, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "pass_test", "arg_names": ["args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def pass_test(*args): return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98694:Return_L5_C22", "label": "return", "type": "return", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98694:FunctionDef_L5_C0", "vector": [13, 1, 0.1923, 0.0385, 1, 0.89, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def pass_test(*args): return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98694:FunctionDef_L7_C0", "label": "no_backend", "type": "function", "loc": [7, 12], "level": 0, "parent": null, "vector": [2, 0, 0.3654, 0.2308, 0, 0.66, 0.25, 537, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "no_backend", "arg_names": ["test_func", "backend"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def no_backend(test_func, backend):\n \"Use this decorator to disable test on specified backend.\"\n if settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'].rsplit('.')[-1] == backend:\n return pass_test\n else:\n return test_func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98694:Expr_L8_C4", "label": "expression", "type": "expression", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98694:FunctionDef_L7_C0", "vector": [8, 1, 0.3077, 0.0385, 1, 0.24, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Use this decorator to disable test on specified backend.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98694:If_L9_C4", "label": "if", "type": "if", "loc": [9, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98694:FunctionDef_L7_C0", "vector": [4, 1, 0.4038, 0.1538, 1, 0.24, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'].rsplit('.')[-1] == backend:\n return pass_test\n else:\n return test_func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98694:Return_L10_C8", "label": "return", "type": "return", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98694:If_L9_C4", "vector": [13, 2, 0.3846, 0.0385, 2, 0.07, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return pass_test"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98694:Return_L12_C8", "label": "return", "type": "return", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98694:If_L9_C4", "vector": [13, 2, 0.4615, 0.0385, 2, 0.07, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return test_func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98694:FunctionDef_L16_C0", "label": "no_oracle", "type": "function", "loc": [16, 16], "level": 0, "parent": null, "vector": [2, 0, 0.6154, 0.0385, 0, 0.66, 0.3333, 884, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "no_oracle", "arg_names": ["func"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def no_oracle(func): return no_backend(func, 'oracle')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98694:Return_L16_C21", "label": "return", "type": "return", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98694:FunctionDef_L16_C0", "vector": [13, 1, 0.6154, 0.0385, 1, 0.12, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def no_oracle(func): return no_backend(func, 'oracle')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98694:FunctionDef_L17_C0", "label": "no_postgis", "type": "function", "loc": [17, 17], "level": 0, "parent": null, "vector": [2, 0, 0.6538, 0.0385, 0, 0.66, 0.4167, 924, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "no_postgis", "arg_names": ["func"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def no_postgis(func): return no_backend(func, 'postgis')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98694:Return_L17_C22", "label": "return", "type": "return", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98694:FunctionDef_L17_C0", "vector": [13, 1, 0.6538, 0.0385, 1, 0.98, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def no_postgis(func): return no_backend(func, 'postgis')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98694:FunctionDef_L18_C0", "label": "no_mysql", "type": "function", "loc": [18, 18], "level": 0, "parent": null, "vector": [2, 0, 0.6923, 0.0385, 0, 0.66, 0.5, 8, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "no_mysql", "arg_names": ["func"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def no_mysql(func): return no_backend(func, 'mysql')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98694:Return_L18_C20", "label": "return", "type": "return", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98694:FunctionDef_L18_C0", "vector": [13, 1, 0.6923, 0.0385, 1, 0.22, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def no_mysql(func): return no_backend(func, 'mysql')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98694:FunctionDef_L19_C0", "label": "no_spatialite", "type": "function", "loc": [19, 19], "level": 0, "parent": null, "vector": [2, 0, 0.7308, 0.0385, 0, 0.66, 0.5833, 738, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "no_spatialite", "arg_names": ["func"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def no_spatialite(func): return no_backend(func, 'spatialite')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98694:Return_L19_C25", "label": "return", "type": "return", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98694:FunctionDef_L19_C0", "vector": [13, 1, 0.7308, 0.0385, 1, 0.95, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def no_spatialite(func): return no_backend(func, 'spatialite')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98694:Assign_L22_C0", "label": "_default_db =", "type": "assigned_variable", "loc": [22, 22], "level": 0, "parent": null, "vector": [14, 0, 0.8462, 0.0385, 0, 0.66, 0.6667, 862, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_default_db", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_default_db = settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'].rsplit('.')[-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98694:Assign_L23_C0", "label": "oracle =", "type": "assigned_variable", "loc": [23, 23], "level": 0, "parent": null, "vector": [14, 0, 0.8846, 0.0385, 0, 0.66, 0.75, 86, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "oracle", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "oracle = _default_db == 'oracle'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98694:Assign_L24_C0", "label": "postgis =", "type": "assigned_variable", "loc": [24, 24], "level": 0, "parent": null, "vector": [14, 0, 0.9231, 0.0385, 0, 0.66, 0.8333, 526, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "postgis", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "postgis = _default_db == 'postgis'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98694:Assign_L25_C0", "label": "mysql =", "type": "assigned_variable", "loc": [25, 25], "level": 0, "parent": null, "vector": [14, 0, 0.9615, 0.0385, 0, 0.66, 0.9167, 855, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "mysql", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "mysql = _default_db == 'mysql'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98694:Assign_L26_C0", "label": "spatialite =", "type": "assigned_variable", "loc": [26, 26], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.0385, 0, 0.66, 1.0, 932, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "spatialite", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "spatialite = _default_db == 'spatialite'"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98694:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98694:Return_L5_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98694:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98694:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98694:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98694:If_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98694:If_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98694:Return_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98694:If_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98694:Return_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98694:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98694:Return_L16_C21"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98694:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98694:Return_L17_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98694:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98694:Return_L18_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98694:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98694:Return_L19_C25"}] |
import sys
from django.conf import settings
from django.db.models import get_app
from django.test.simple import build_suite, DjangoTestSuiteRunner
from django.utils import unittest
def run_tests(*args, **kwargs):
from django.test.simple import run_tests as base_run_tests
return base_run_tests(*args, **kwargs)
def run_gis_tests(test_labels, verbosity=1, interactive=True, failfast=False, extra_tests=None):
import warnings
warnings.warn(
'The run_gis_tests() test runner has been deprecated in favor of GeoDjangoTestSuiteRunner.',
DeprecationWarning
)
test_runner = GeoDjangoTestSuiteRunner(verbosity=verbosity, interactive=interactive, failfast=failfast)
return test_runner.run_tests(test_labels, extra_tests=extra_tests)
class GeoDjangoTestSuiteRunner(DjangoTestSuiteRunner):
def setup_test_environment(self, **kwargs):
super(GeoDjangoTestSuiteRunner, self).setup_test_environment(**kwargs)
from django.db import connection
from django.contrib.gis.geos import GEOS_PREPARE
from django.contrib.gis.gdal import HAS_GDAL
# Getting and storing the original values of INSTALLED_APPS and
# the ROOT_URLCONF.
self.old_installed = settings.INSTALLED_APPS
self.old_root_urlconf = settings.ROOT_URLCONF
# Tests that require use of a spatial database (e.g., creation of models)
self.geo_apps = ['geoapp', 'relatedapp']
if connection.ops.postgis and connection.ops.geography:
# Test geography support with PostGIS 1.5+.
self.geo_apps.append('geogapp')
if HAS_GDAL:
# The following GeoDjango test apps depend on GDAL support.
if not connection.ops.mysql:
self.geo_apps.append('distapp')
# 3D apps use LayerMapping, which uses GDAL.
if connection.ops.postgis and GEOS_PREPARE:
self.geo_apps.append('geo3d')
self.geo_apps.append('layermap')
# Constructing the new INSTALLED_APPS, and including applications
# within the GeoDjango test namespace (`self.geo_apps`).
new_installed = ['django.contrib.sites',
'django.contrib.sitemaps',
'django.contrib.gis',
]
new_installed.extend(['django.contrib.gis.tests.%s' % app
for app in self.geo_apps])
settings.INSTALLED_APPS = new_installed
# Setting the URLs.
settings.ROOT_URLCONF = 'django.contrib.gis.tests.urls'
def teardown_test_environment(self, **kwargs):
super(GeoDjangoTestSuiteRunner, self).teardown_test_environment(**kwargs)
settings.INSTALLED_APPS = self.old_installed
settings.ROOT_URLCONF = self.old_root_urlconf
def build_suite(self, test_labels, extra_tests=None, **kwargs):
"""
This method is overridden to construct a suite consisting only of tests
for GeoDjango.
"""
suite = unittest.TestSuite()
# Adding the GEOS tests.
from django.contrib.gis.geos import tests as geos_tests
suite.addTest(geos_tests.suite())
# Adding the measurment tests.
from django.contrib.gis.tests import test_measure
suite.addTest(test_measure.suite())
# Adding GDAL tests, and any test suite that depends on GDAL, to the
# suite if GDAL is available.
from django.contrib.gis.gdal import HAS_GDAL
if HAS_GDAL:
from django.contrib.gis.gdal import tests as gdal_tests
suite.addTest(gdal_tests.suite())
from django.contrib.gis.tests import test_spatialrefsys, test_geoforms
suite.addTest(test_spatialrefsys.suite())
suite.addTest(test_geoforms.suite())
else:
sys.stderr.write('GDAL not available - no tests requiring GDAL will be run.\n')
# Add GeoIP tests to the suite, if the library and data is available.
from django.contrib.gis.utils import HAS_GEOIP
if HAS_GEOIP and hasattr(settings, 'GEOIP_PATH'):
from django.contrib.gis.tests import test_geoip
suite.addTest(test_geoip.suite())
# Finally, adding the suites for each of the GeoDjango test apps.
for app_name in self.geo_apps:
suite.addTest(build_suite(get_app(app_name)))
return suite
| ajibawa-2023/Python-Code-Large/train/row_98695 | 60 | 109 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Import_L1_C0", "label": "sys import sys", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0092, 0.0092, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L3_C0", "label": "from django.conf import settings", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0275, 0.0092, 0, 0.66, 0.1429, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L4_C0", "label": "from django.db.models import get_app", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0367, 0.0092, 0, 0.66, 0.2857, 680, 0, 1, 0, 0, 680, 0, 0], "semantic": {"name": "django.db.models", "arg_names": [], "import_names": ["get_app"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.models import get_app"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L5_C0", "label": "from django.test.simple import build_suite, DjangoTestSuiteRunner", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0459, 0.0092, 0, 0.66, 0.4286, 655, 0, 2, 0, 0, 655, 0, 0], "semantic": {"name": "django.test.simple", "arg_names": [], "import_names": ["build_suite", "DjangoTestSuiteRunner"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.test.simple import build_suite, DjangoTestSuiteRunner"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L6_C0", "label": "from django.utils import unittest", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.055, 0.0092, 0, 0.66, 0.5714, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "django.utils", "arg_names": [], "import_names": ["unittest"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils import unittest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L9_C0", "label": "run_tests", "type": "function", "loc": [9, 11], "level": 0, "parent": null, "vector": [2, 0, 0.0917, 0.0275, 0, 0.66, 0.7143, 630, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "run_tests", "arg_names": ["args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def run_tests(*args, **kwargs):\n from django.test.simple import run_tests as base_run_tests\n return base_run_tests(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L10_C4", "label": "from django.test.simple import base_run_tests", "type": "import", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L9_C0", "vector": [1, 1, 0.0917, 0.0092, 1, 0.66, 0.0, 655, 0, 1, 0, 0, 655, 0, 0], "semantic": {"name": "django.test.simple", "arg_names": [], "import_names": ["base_run_tests"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.test.simple import run_tests as base_run_tests"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Return_L11_C4", "label": "return", "type": "return", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L9_C0", "vector": [13, 1, 0.1009, 0.0092, 1, 0.66, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return base_run_tests(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L13_C0", "label": "run_gis_tests", "type": "function", "loc": [13, 20], "level": 0, "parent": null, "vector": [2, 0, 0.1514, 0.0734, 0, 0.66, 0.8571, 462, 0, 5, 1, 0, 0, 0, 3], "semantic": {"name": "run_gis_tests", "arg_names": ["test_labels", "verbosity", "interactive", "failfast", "extra_tests"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def run_gis_tests(test_labels, verbosity=1, interactive=True, failfast=False, extra_tests=None):\n import warnings\n warnings.warn(\n 'The run_gis_tests() test runner has been deprecated in favor of GeoDjangoTestSuiteRunner.',\n DeprecationWarning\n )\n test_runner = GeoDjangoTestSuiteRunner(verbosity=verbosity, interactive=interactive, failfast=failfast)\n return test_runner.run_tests(test_labels, extra_tests=extra_tests)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Import_L14_C4", "label": "warnings import warnings", "type": "import", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L13_C0", "vector": [1, 1, 0.1284, 0.0092, 1, 0.2, 0.0, 358, 0, 1, 0, 0, 358, 0, 0], "semantic": {"name": "warnings", "arg_names": [], "import_names": ["warnings"], "rhs_call_name": "", "annotation": ""}, "snippet": " import warnings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L15_C4", "label": "warn()", "type": "expression", "loc": [15, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L13_C0", "vector": [8, 1, 0.1514, 0.0367, 1, 0.2, 0.3333, 960, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "warn", "arg_names": [], "import_names": [], "rhs_call_name": "warn", "annotation": ""}, "snippet": " warnings.warn(\n 'The run_gis_tests() test runner has been deprecated in favor of GeoDjangoTestSuiteRunner.',\n DeprecationWarning\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Assign_L19_C4", "label": "test_runner = GeoDjangoTestSuiteRunner()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L13_C0", "vector": [14, 1, 0.1743, 0.0092, 1, 0.2, 0.6667, 530, 3, 3, 0, 0, 267, 10, 1], "semantic": {"name": "test_runner", "arg_names": [], "import_names": [], "rhs_call_name": "GeoDjangoTestSuiteRunner", "annotation": ""}, "snippet": " test_runner = GeoDjangoTestSuiteRunner(verbosity=verbosity, interactive=interactive, failfast=failfast)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Return_L20_C4", "label": "return", "type": "return", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L13_C0", "vector": [13, 1, 0.1835, 0.0092, 1, 0.2, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return test_runner.run_tests(test_labels, extra_tests=extra_tests)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:ClassDef_L22_C0", "label": "GeoDjangoTestSuiteRunner", "type": "class", "loc": [22, 109], "level": 0, "parent": null, "vector": [3, 0, 0.6009, 0.8073, 0, 0.66, 1.0, 267, 0, 3, 0, 0, 102, 0, 27], "semantic": {"name": "GeoDjangoTestSuiteRunner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GeoDjangoTestSuiteRunner(DjangoTestSuiteRunner):\n\n def setup_test_environment(self, **kwargs):\n super(GeoDjangoTestSuiteRunner, self).setup_test_environment(**kwargs)\n\n from django.db import connection\n from django.contrib.gis.geos import GEOS_PREPARE\n from django.contrib.gis.gdal import HAS_GDAL"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "label": "setup_test_environment", "type": "function", "loc": [24, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:ClassDef_L22_C0", "vector": [2, 1, 0.4037, 0.3761, 1, 0.26, 0.0, 182, 0, 2, 0, 0, 0, 0, 7], "semantic": {"name": "setup_test_environment", "arg_names": ["self", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def setup_test_environment(self, **kwargs):\n super(GeoDjangoTestSuiteRunner, self).setup_test_environment(**kwargs)\n\n from django.db import connection\n from django.contrib.gis.geos import GEOS_PREPARE\n from django.contrib.gis.gdal import HAS_GDAL\n\n # Getting and storing the original values of INSTALLED_APPS and"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L25_C8", "label": "setup_test_environment()", "type": "expression", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "vector": [8, 2, 0.2294, 0.0092, 2, 0.04, 0.0, 182, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "setup_test_environment", "arg_names": [], "import_names": [], "rhs_call_name": "setup_test_environment", "annotation": ""}, "snippet": " super(GeoDjangoTestSuiteRunner, self).setup_test_environment(**kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L27_C8", "label": "from django.db import connection", "type": "import", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "vector": [1, 2, 0.2477, 0.0092, 2, 0.04, 0.0833, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["connection"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.db import connection"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L28_C8", "label": "from django.contrib.gis.geos import GEOS_PREPARE", "type": "import", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "vector": [1, 2, 0.2569, 0.0092, 2, 0.04, 0.1667, 886, 0, 1, 0, 0, 886, 0, 0], "semantic": {"name": "django.contrib.gis.geos", "arg_names": [], "import_names": ["GEOS_PREPARE"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.geos import GEOS_PREPARE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L29_C8", "label": "from django.contrib.gis.gdal import HAS_GDAL", "type": "import", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "vector": [1, 2, 0.2661, 0.0092, 2, 0.04, 0.25, 793, 0, 1, 0, 0, 793, 0, 0], "semantic": {"name": "django.contrib.gis.gdal", "arg_names": [], "import_names": ["HAS_GDAL"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.gdal import HAS_GDAL"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Assign_L33_C8", "label": "self.old_installed =", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "vector": [14, 2, 0.3028, 0.0092, 2, 0.04, 0.3333, 377, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.old_installed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.old_installed = settings.INSTALLED_APPS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Assign_L34_C8", "label": "self.old_root_urlconf =", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "vector": [14, 2, 0.3119, 0.0092, 2, 0.04, 0.4167, 717, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.old_root_urlconf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.old_root_urlconf = settings.ROOT_URLCONF"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Assign_L37_C8", "label": "self.geo_apps =", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "vector": [14, 2, 0.3394, 0.0092, 2, 0.04, 0.5, 601, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.geo_apps", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.geo_apps = ['geoapp', 'relatedapp']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L38_C8", "label": "if", "type": "if", "loc": [38, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "vector": [4, 2, 0.3578, 0.0275, 2, 0.04, 0.5833, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if connection.ops.postgis and connection.ops.geography:\n # Test geography support with PostGIS 1.5+.\n self.geo_apps.append('geogapp')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L40_C12", "label": "append()", "type": "expression", "loc": [40, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L38_C8", "vector": [8, 3, 0.367, 0.0092, 3, 0.51, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.geo_apps.append('geogapp')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L42_C8", "label": "if", "type": "if", "loc": [42, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "vector": [4, 2, 0.4266, 0.0917, 2, 0.04, 0.6667, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if HAS_GDAL:\n # The following GeoDjango test apps depend on GDAL support.\n if not connection.ops.mysql:\n self.geo_apps.append('distapp')\n\n # 3D apps use LayerMapping, which uses GDAL.\n if connection.ops.postgis and GEOS_PREPARE:\n self.geo_apps.append('geo3d')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L44_C12", "label": "if", "type": "if", "loc": [44, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L42_C8", "vector": [4, 3, 0.4083, 0.0183, 3, 0.04, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not connection.ops.mysql:\n self.geo_apps.append('distapp')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L45_C16", "label": "append()", "type": "expression", "loc": [45, 45], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L44_C12", "vector": [8, 4, 0.4128, 0.0092, 4, 0.73, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.geo_apps.append('distapp')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L48_C12", "label": "if", "type": "if", "loc": [48, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L42_C8", "vector": [4, 3, 0.445, 0.0183, 3, 0.04, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if connection.ops.postgis and GEOS_PREPARE:\n self.geo_apps.append('geo3d')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L49_C16", "label": "append()", "type": "expression", "loc": [49, 49], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L48_C12", "vector": [8, 4, 0.4495, 0.0092, 4, 0.34, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.geo_apps.append('geo3d')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L51_C12", "label": "append()", "type": "expression", "loc": [51, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L42_C8", "vector": [8, 3, 0.4679, 0.0092, 3, 0.04, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.geo_apps.append('layermap')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Assign_L55_C8", "label": "new_installed =", "type": "assigned_variable", "loc": [55, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "vector": [14, 2, 0.5183, 0.0367, 2, 0.04, 0.75, 626, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "new_installed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_installed = ['django.contrib.sites',\n 'django.contrib.sitemaps',\n 'django.contrib.gis',\n ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L59_C8", "label": "extend()", "type": "expression", "loc": [59, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "vector": [8, 2, 0.5459, 0.0183, 2, 0.04, 0.8333, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " new_installed.extend(['django.contrib.gis.tests.%s' % app\n for app in self.geo_apps])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Assign_L61_C8", "label": "settings.INSTALLED_APPS =", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "vector": [14, 2, 0.5596, 0.0092, 2, 0.04, 0.9167, 762, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "settings.INSTALLED_APPS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " settings.INSTALLED_APPS = new_installed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Assign_L64_C8", "label": "settings.ROOT_URLCONF =", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "vector": [14, 2, 0.5872, 0.0092, 2, 0.04, 1.0, 200, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "settings.ROOT_URLCONF", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " settings.ROOT_URLCONF = 'django.contrib.gis.tests.urls'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L66_C4", "label": "teardown_test_environment", "type": "function", "loc": [66, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:ClassDef_L22_C0", "vector": [2, 1, 0.6193, 0.0367, 1, 0.26, 0.5, 187, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "teardown_test_environment", "arg_names": ["self", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def teardown_test_environment(self, **kwargs):\n super(GeoDjangoTestSuiteRunner, self).teardown_test_environment(**kwargs)\n settings.INSTALLED_APPS = self.old_installed\n settings.ROOT_URLCONF = self.old_root_urlconf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L67_C8", "label": "teardown_test_environment()", "type": "expression", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L66_C4", "vector": [8, 2, 0.6147, 0.0092, 2, 0.49, 0.0, 187, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "teardown_test_environment", "arg_names": [], "import_names": [], "rhs_call_name": "teardown_test_environment", "annotation": ""}, "snippet": " super(GeoDjangoTestSuiteRunner, self).teardown_test_environment(**kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Assign_L68_C8", "label": "settings.INSTALLED_APPS =", "type": "assigned_variable", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L66_C4", "vector": [14, 2, 0.6239, 0.0092, 2, 0.49, 0.5, 762, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "settings.INSTALLED_APPS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " settings.INSTALLED_APPS = self.old_installed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Assign_L69_C8", "label": "settings.ROOT_URLCONF =", "type": "assigned_variable", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L66_C4", "vector": [14, 2, 0.633, 0.0092, 2, 0.49, 1.0, 200, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "settings.ROOT_URLCONF", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " settings.ROOT_URLCONF = self.old_root_urlconf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4", "label": "build_suite", "type": "function", "loc": [71, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:ClassDef_L22_C0", "vector": [2, 1, 0.8257, 0.3578, 1, 0.26, 1.0, 952, 0, 4, 1, 0, 0, 0, 18], "semantic": {"name": "build_suite", "arg_names": ["self", "test_labels", "extra_tests", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_suite(self, test_labels, extra_tests=None, **kwargs):\n \"\"\"\n This method is overridden to construct a suite consisting only of tests\n for GeoDjango.\n \"\"\"\n suite = unittest.TestSuite()\n\n # Adding the GEOS tests."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L72_C8", "label": "expression", "type": "expression", "loc": [72, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4", "vector": [8, 2, 0.6743, 0.0367, 2, 0.78, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n This method is overridden to construct a suite consisting only of tests\n for GeoDjango.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Assign_L76_C8", "label": "suite = TestSuite()", "type": "assigned_variable", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4", "vector": [14, 2, 0.6972, 0.0092, 2, 0.78, 0.0909, 425, 3, 0, 0, 0, 75, 10, 1], "semantic": {"name": "suite", "arg_names": [], "import_names": [], "rhs_call_name": "TestSuite", "annotation": ""}, "snippet": " suite = unittest.TestSuite()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L79_C8", "label": "from django.contrib.gis.geos import geos_tests", "type": "import", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4", "vector": [1, 2, 0.7248, 0.0092, 2, 0.78, 0.1818, 886, 0, 1, 0, 0, 886, 0, 0], "semantic": {"name": "django.contrib.gis.geos", "arg_names": [], "import_names": ["geos_tests"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.geos import tests as geos_tests"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L80_C8", "label": "addTest()", "type": "expression", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4", "vector": [8, 2, 0.7339, 0.0092, 2, 0.78, 0.2727, 786, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "addTest", "arg_names": [], "import_names": [], "rhs_call_name": "addTest", "annotation": ""}, "snippet": " suite.addTest(geos_tests.suite())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L83_C8", "label": "from django.contrib.gis.tests import test_measure", "type": "import", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4", "vector": [1, 2, 0.7615, 0.0092, 2, 0.78, 0.3636, 53, 0, 1, 0, 0, 53, 0, 0], "semantic": {"name": "django.contrib.gis.tests", "arg_names": [], "import_names": ["test_measure"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.tests import test_measure"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L84_C8", "label": "addTest()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4", "vector": [8, 2, 0.7706, 0.0092, 2, 0.78, 0.4545, 786, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "addTest", "arg_names": [], "import_names": [], "rhs_call_name": "addTest", "annotation": ""}, "snippet": " suite.addTest(test_measure.suite())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L88_C8", "label": "from django.contrib.gis.gdal import HAS_GDAL", "type": "import", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4", "vector": [1, 2, 0.8073, 0.0092, 2, 0.78, 0.5455, 793, 0, 1, 0, 0, 793, 0, 0], "semantic": {"name": "django.contrib.gis.gdal", "arg_names": [], "import_names": ["HAS_GDAL"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.gdal import HAS_GDAL"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L89_C8", "label": "if", "type": "if", "loc": [89, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4", "vector": [4, 2, 0.8532, 0.0826, 2, 0.78, 0.6364, 0, 2, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if HAS_GDAL:\n from django.contrib.gis.gdal import tests as gdal_tests\n suite.addTest(gdal_tests.suite())\n\n from django.contrib.gis.tests import test_spatialrefsys, test_geoforms\n suite.addTest(test_spatialrefsys.suite())\n suite.addTest(test_geoforms.suite())\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L90_C12", "label": "from django.contrib.gis.gdal import gdal_tests", "type": "import", "loc": [90, 90], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L89_C8", "vector": [1, 3, 0.8257, 0.0092, 3, 0.99, 0.0, 793, 0, 1, 0, 0, 793, 0, 0], "semantic": {"name": "django.contrib.gis.gdal", "arg_names": [], "import_names": ["gdal_tests"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.gdal import tests as gdal_tests"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L91_C12", "label": "addTest()", "type": "expression", "loc": [91, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L89_C8", "vector": [8, 3, 0.8349, 0.0092, 3, 0.99, 0.2, 786, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "addTest", "arg_names": [], "import_names": [], "rhs_call_name": "addTest", "annotation": ""}, "snippet": " suite.addTest(gdal_tests.suite())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L93_C12", "label": "from django.contrib.gis.tests import test_spatialrefsys, test_geoforms", "type": "import", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L89_C8", "vector": [1, 3, 0.8532, 0.0092, 3, 0.99, 0.4, 53, 0, 2, 0, 0, 53, 0, 0], "semantic": {"name": "django.contrib.gis.tests", "arg_names": [], "import_names": ["test_spatialrefsys", "test_geoforms"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.tests import test_spatialrefsys, test_geoforms"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L94_C12", "label": "addTest()", "type": "expression", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L89_C8", "vector": [8, 3, 0.8624, 0.0092, 3, 0.99, 0.6, 786, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "addTest", "arg_names": [], "import_names": [], "rhs_call_name": "addTest", "annotation": ""}, "snippet": " suite.addTest(test_spatialrefsys.suite())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L95_C12", "label": "addTest()", "type": "expression", "loc": [95, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L89_C8", "vector": [8, 3, 0.8716, 0.0092, 3, 0.99, 0.8, 786, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "addTest", "arg_names": [], "import_names": [], "rhs_call_name": "addTest", "annotation": ""}, "snippet": " suite.addTest(test_geoforms.suite())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L97_C12", "label": "write()", "type": "expression", "loc": [97, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L89_C8", "vector": [8, 3, 0.8899, 0.0092, 3, 0.99, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " sys.stderr.write('GDAL not available - no tests requiring GDAL will be run.\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L100_C8", "label": "from django.contrib.gis.utils import HAS_GEOIP", "type": "import", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4", "vector": [1, 2, 0.9174, 0.0092, 2, 0.78, 0.7273, 917, 0, 1, 0, 0, 917, 0, 0], "semantic": {"name": "django.contrib.gis.utils", "arg_names": [], "import_names": ["HAS_GEOIP"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.utils import HAS_GEOIP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L101_C8", "label": "if", "type": "if", "loc": [101, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4", "vector": [4, 2, 0.9358, 0.0275, 2, 0.78, 0.8182, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if HAS_GEOIP and hasattr(settings, 'GEOIP_PATH'):\n from django.contrib.gis.tests import test_geoip\n suite.addTest(test_geoip.suite())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L102_C12", "label": "from django.contrib.gis.tests import test_geoip", "type": "import", "loc": [102, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L101_C8", "vector": [1, 3, 0.9358, 0.0092, 3, 0.34, 0.0, 53, 0, 1, 0, 0, 53, 0, 0], "semantic": {"name": "django.contrib.gis.tests", "arg_names": [], "import_names": ["test_geoip"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.tests import test_geoip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L103_C12", "label": "addTest()", "type": "expression", "loc": [103, 103], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L101_C8", "vector": [8, 3, 0.945, 0.0092, 3, 0.34, 1.0, 786, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "addTest", "arg_names": [], "import_names": [], "rhs_call_name": "addTest", "annotation": ""}, "snippet": " suite.addTest(test_geoip.suite())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:For_L106_C8", "label": "for app_name", "type": "for", "loc": [106, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4", "vector": [6, 2, 0.9771, 0.0183, 2, 0.78, 0.9091, 443, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "app_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for app_name in self.geo_apps:\n suite.addTest(build_suite(get_app(app_name)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L107_C12", "label": "addTest()", "type": "expression", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:For_L106_C8", "vector": [8, 3, 0.9817, 0.0092, 3, 0.33, 0.0, 786, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "addTest", "arg_names": [], "import_names": [], "rhs_call_name": "addTest", "annotation": ""}, "snippet": " suite.addTest(build_suite(get_app(app_name)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98695:Return_L109_C8", "label": "return", "type": "return", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4", "vector": [13, 2, 1.0, 0.0092, 2, 0.78, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return suite"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Return_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Import_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Return_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L44_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L44_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L45_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L48_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L49_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Assign_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Assign_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Assign_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L90_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L91_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L93_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L94_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L95_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L102_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L103_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:For_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:For_L106_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Expr_L107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Return_L109_C8"}] |
# Copyright (c) 2007, Robert Coup <robert.coup@onetrackmind.co.nz>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of Distance nor the names of its contributors may be used
# to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
"""
Distance and Area objects to allow for sensible and convienient calculation
and conversions.
Authors: Robert Coup, Justin Bronn
Inspired by GeoPy (http://exogen.case.edu/projects/geopy/)
and Geoff Biggs' PhD work on dimensioned units for robotics.
"""
__all__ = ['A', 'Area', 'D', 'Distance']
from decimal import Decimal
class MeasureBase(object):
def default_units(self, kwargs):
"""
Return the unit value and the default units specified
from the given keyword arguments dictionary.
"""
val = 0.0
for unit, value in kwargs.iteritems():
if not isinstance(value, float): value = float(value)
if unit in self.UNITS:
val += self.UNITS[unit] * value
default_unit = unit
elif unit in self.ALIAS:
u = self.ALIAS[unit]
val += self.UNITS[u] * value
default_unit = u
else:
lower = unit.lower()
if lower in self.UNITS:
val += self.UNITS[lower] * value
default_unit = lower
elif lower in self.LALIAS:
u = self.LALIAS[lower]
val += self.UNITS[u] * value
default_unit = u
else:
raise AttributeError('Unknown unit type: %s' % unit)
return val, default_unit
@classmethod
def unit_attname(cls, unit_str):
"""
Retrieves the unit attribute name for the given unit string.
For example, if the given unit string is 'metre', 'm' would be returned.
An exception is raised if an attribute cannot be found.
"""
lower = unit_str.lower()
if unit_str in cls.UNITS:
return unit_str
elif lower in cls.UNITS:
return lower
elif lower in cls.LALIAS:
return cls.LALIAS[lower]
else:
raise Exception('Could not find a unit keyword associated with "%s"' % unit_str)
class Distance(MeasureBase):
UNITS = {
'chain' : 20.1168,
'chain_benoit' : 20.116782,
'chain_sears' : 20.1167645,
'british_chain_benoit' : 20.1167824944,
'british_chain_sears' : 20.1167651216,
'british_chain_sears_truncated' : 20.116756,
'cm' : 0.01,
'british_ft' : 0.304799471539,
'british_yd' : 0.914398414616,
'clarke_ft' : 0.3047972654,
'clarke_link' : 0.201166195164,
'fathom' : 1.8288,
'ft': 0.3048,
'german_m' : 1.0000135965,
'gold_coast_ft' : 0.304799710181508,
'indian_yd' : 0.914398530744,
'inch' : 0.0254,
'km': 1000.0,
'link' : 0.201168,
'link_benoit' : 0.20116782,
'link_sears' : 0.20116765,
'm': 1.0,
'mi': 1609.344,
'mm' : 0.001,
'nm': 1852.0,
'nm_uk' : 1853.184,
'rod' : 5.0292,
'sears_yd' : 0.91439841,
'survey_ft' : 0.304800609601,
'um' : 0.000001,
'yd': 0.9144,
}
# Unit aliases for `UNIT` terms encountered in Spatial Reference WKT.
ALIAS = {
'centimeter' : 'cm',
'foot' : 'ft',
'inches' : 'inch',
'kilometer' : 'km',
'kilometre' : 'km',
'meter' : 'm',
'metre' : 'm',
'micrometer' : 'um',
'micrometre' : 'um',
'millimeter' : 'mm',
'millimetre' : 'mm',
'mile' : 'mi',
'yard' : 'yd',
'British chain (Benoit 1895 B)' : 'british_chain_benoit',
'British chain (Sears 1922)' : 'british_chain_sears',
'British chain (Sears 1922 truncated)' : 'british_chain_sears_truncated',
'British foot (Sears 1922)' : 'british_ft',
'British foot' : 'british_ft',
'British yard (Sears 1922)' : 'british_yd',
'British yard' : 'british_yd',
"Clarke's Foot" : 'clarke_ft',
"Clarke's link" : 'clarke_link',
'Chain (Benoit)' : 'chain_benoit',
'Chain (Sears)' : 'chain_sears',
'Foot (International)' : 'ft',
'German legal metre' : 'german_m',
'Gold Coast foot' : 'gold_coast_ft',
'Indian yard' : 'indian_yd',
'Link (Benoit)': 'link_benoit',
'Link (Sears)': 'link_sears',
'Nautical Mile' : 'nm',
'Nautical Mile (UK)' : 'nm_uk',
'US survey foot' : 'survey_ft',
'U.S. Foot' : 'survey_ft',
'Yard (Indian)' : 'indian_yd',
'Yard (Sears)' : 'sears_yd'
}
LALIAS = dict([(k.lower(), v) for k, v in ALIAS.items()])
def __init__(self, default_unit=None, **kwargs):
# The base unit is in meters.
self.m, self._default_unit = self.default_units(kwargs)
if default_unit and isinstance(default_unit, str):
self._default_unit = default_unit
def __getattr__(self, name):
if name in self.UNITS:
return self.m / self.UNITS[name]
else:
raise AttributeError('Unknown unit type: %s' % name)
def __repr__(self):
return 'Distance(%s=%s)' % (self._default_unit, getattr(self, self._default_unit))
def __str__(self):
return '%s %s' % (getattr(self, self._default_unit), self._default_unit)
def __cmp__(self, other):
if isinstance(other, Distance):
return cmp(self.m, other.m)
else:
return NotImplemented
def __add__(self, other):
if isinstance(other, Distance):
return Distance(default_unit=self._default_unit, m=(self.m + other.m))
else:
raise TypeError('Distance must be added with Distance')
def __iadd__(self, other):
if isinstance(other, Distance):
self.m += other.m
return self
else:
raise TypeError('Distance must be added with Distance')
def __sub__(self, other):
if isinstance(other, Distance):
return Distance(default_unit=self._default_unit, m=(self.m - other.m))
else:
raise TypeError('Distance must be subtracted from Distance')
def __isub__(self, other):
if isinstance(other, Distance):
self.m -= other.m
return self
else:
raise TypeError('Distance must be subtracted from Distance')
def __mul__(self, other):
if isinstance(other, (int, float, long, Decimal)):
return Distance(default_unit=self._default_unit, m=(self.m * float(other)))
elif isinstance(other, Distance):
return Area(default_unit='sq_' + self._default_unit, sq_m=(self.m * other.m))
else:
raise TypeError('Distance must be multiplied with number or Distance')
def __imul__(self, other):
if isinstance(other, (int, float, long, Decimal)):
self.m *= float(other)
return self
else:
raise TypeError('Distance must be multiplied with number')
def __rmul__(self, other):
return self * other
def __div__(self, other):
if isinstance(other, (int, float, long, Decimal)):
return Distance(default_unit=self._default_unit, m=(self.m / float(other)))
else:
raise TypeError('Distance must be divided with number')
def __idiv__(self, other):
if isinstance(other, (int, float, long, Decimal)):
self.m /= float(other)
return self
else:
raise TypeError('Distance must be divided with number')
def __nonzero__(self):
return bool(self.m)
class Area(MeasureBase):
# Getting the square units values and the alias dictionary.
UNITS = dict([('sq_%s' % k, v ** 2) for k, v in Distance.UNITS.items()])
ALIAS = dict([(k, 'sq_%s' % v) for k, v in Distance.ALIAS.items()])
LALIAS = dict([(k.lower(), v) for k, v in ALIAS.items()])
def __init__(self, default_unit=None, **kwargs):
self.sq_m, self._default_unit = self.default_units(kwargs)
if default_unit and isinstance(default_unit, str):
self._default_unit = default_unit
def __getattr__(self, name):
if name in self.UNITS:
return self.sq_m / self.UNITS[name]
else:
raise AttributeError('Unknown unit type: ' + name)
def __repr__(self):
return 'Area(%s=%s)' % (self._default_unit, getattr(self, self._default_unit))
def __str__(self):
return '%s %s' % (getattr(self, self._default_unit), self._default_unit)
def __cmp__(self, other):
if isinstance(other, Area):
return cmp(self.sq_m, other.sq_m)
else:
return NotImplemented
def __add__(self, other):
if isinstance(other, Area):
return Area(default_unit=self._default_unit, sq_m=(self.sq_m + other.sq_m))
else:
raise TypeError('Area must be added with Area')
def __iadd__(self, other):
if isinstance(other, Area):
self.sq_m += other.sq_m
return self
else:
raise TypeError('Area must be added with Area')
def __sub__(self, other):
if isinstance(other, Area):
return Area(default_unit=self._default_unit, sq_m=(self.sq_m - other.sq_m))
else:
raise TypeError('Area must be subtracted from Area')
def __isub__(self, other):
if isinstance(other, Area):
self.sq_m -= other.sq_m
return self
else:
raise TypeError('Area must be subtracted from Area')
def __mul__(self, other):
if isinstance(other, (int, float, long, Decimal)):
return Area(default_unit=self._default_unit, sq_m=(self.sq_m * float(other)))
else:
raise TypeError('Area must be multiplied with number')
def __imul__(self, other):
if isinstance(other, (int, float, long, Decimal)):
self.sq_m *= float(other)
return self
else:
raise TypeError('Area must be multiplied with number')
def __rmul__(self, other):
return self * other
def __div__(self, other):
if isinstance(other, (int, float, long, Decimal)):
return Area(default_unit=self._default_unit, sq_m=(self.sq_m / float(other)))
else:
raise TypeError('Area must be divided with number')
def __idiv__(self, other):
if isinstance(other, (int, float, long, Decimal)):
self.sq_m /= float(other)
return self
else:
raise TypeError('Area must be divided with number')
def __nonzero__(self):
return bool(self.sq_m)
# Shortcuts
D = Distance
A = Area
| ajibawa-2023/Python-Code-Large/train/row_98696 | 129 | 336 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Expr_L29_C0", "label": "expression", "type": "expression", "loc": [29, 37], "level": 0, "parent": null, "vector": [8, 0, 0.0982, 0.0268, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nDistance and Area objects to allow for sensible and convienient calculation\nand conversions.\n\nAuthors: Robert Coup, Justin Bronn\n\nInspired by GeoPy (http://exogen.case.edu/projects/geopy/)\nand Geoff Biggs' PhD work on dimensioned units for robotics."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L38_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [38, 38], "level": 0, "parent": null, "vector": [14, 0, 0.1131, 0.003, 0, 0.66, 0.1429, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = ['A', 'Area', 'D', 'Distance']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:ImportFrom_L39_C0", "label": "from decimal import Decimal", "type": "import", "loc": [39, 39], "level": 0, "parent": null, "vector": [1, 0, 0.1161, 0.003, 0, 0.66, 0.2857, 349, 0, 1, 0, 0, 349, 0, 0], "semantic": {"name": "decimal", "arg_names": [], "import_names": ["Decimal"], "rhs_call_name": "", "annotation": ""}, "snippet": "from decimal import Decimal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L41_C0", "label": "MeasureBase", "type": "class", "loc": [41, 85], "level": 0, "parent": null, "vector": [3, 0, 0.1875, 0.1339, 0, 0.66, 0.4286, 119, 0, 2, 0, 0, 186, 0, 7], "semantic": {"name": "MeasureBase", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MeasureBase(object):\n def default_units(self, kwargs):\n \"\"\"\n Return the unit value and the default units specified\n from the given keyword arguments dictionary.\n \"\"\"\n val = 0.0\n for unit, value in kwargs.iteritems():"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L42_C4", "label": "default_units", "type": "function", "loc": [42, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L41_C0", "vector": [2, 1, 0.1637, 0.0804, 1, 0.08, 0.0, 74, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "default_units", "arg_names": ["self", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def default_units(self, kwargs):\n \"\"\"\n Return the unit value and the default units specified\n from the given keyword arguments dictionary.\n \"\"\"\n val = 0.0\n for unit, value in kwargs.iteritems():\n if not isinstance(value, float): value = float(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Expr_L43_C8", "label": "expression", "type": "expression", "loc": [43, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L42_C4", "vector": [8, 2, 0.1324, 0.0119, 2, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Return the unit value and the default units specified\n from the given keyword arguments dictionary.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L47_C8", "label": "val =", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L42_C4", "vector": [14, 2, 0.1399, 0.003, 2, 0.91, 0.3333, 618, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "val", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " val = 0.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:For_L48_C8", "label": "for unit, value", "type": "for", "loc": [48, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L42_C4", "vector": [6, 2, 0.1711, 0.0595, 2, 0.91, 0.6667, 295, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "unit, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for unit, value in kwargs.iteritems():\n if not isinstance(value, float): value = float(value)\n if unit in self.UNITS:\n val += self.UNITS[unit] * value\n default_unit = unit\n elif unit in self.ALIAS:\n u = self.ALIAS[unit]\n val += self.UNITS[u] * value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L49_C12", "label": "if", "type": "if", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:For_L48_C8", "vector": [4, 3, 0.1458, 0.003, 3, 0.96, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(value, float): value = float(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L49_C45", "label": "value = float()", "type": "assigned_variable", "loc": [49, 49], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L49_C12", "vector": [14, 4, 0.1458, 0.003, 4, 0.91, 0.0, 441, 3, 1, 0, 0, 639, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "float", "annotation": ""}, "snippet": " if not isinstance(value, float): value = float(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L50_C12", "label": "if", "type": "if", "loc": [50, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:For_L48_C8", "vector": [4, 3, 0.1741, 0.0536, 3, 0.96, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if unit in self.UNITS:\n val += self.UNITS[unit] * value\n default_unit = unit\n elif unit in self.ALIAS:\n u = self.ALIAS[unit]\n val += self.UNITS[u] * value\n default_unit = u\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L52_C16", "label": "default_unit =", "type": "assigned_variable", "loc": [52, 52], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L50_C12", "vector": [14, 4, 0.1548, 0.003, 4, 0.8, 0.0, 175, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "default_unit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " default_unit = unit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L53_C12", "label": "if", "type": "if", "loc": [53, 67], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L50_C12", "vector": [4, 4, 0.1786, 0.0446, 4, 0.8, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif unit in self.ALIAS:\n u = self.ALIAS[unit]\n val += self.UNITS[u] * value\n default_unit = u\n else:\n lower = unit.lower()\n if lower in self.UNITS:\n val += self.UNITS[lower] * value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L54_C16", "label": "u =", "type": "assigned_variable", "loc": [54, 54], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L53_C12", "vector": [14, 5, 0.1607, 0.003, 5, 0.29, 0.0, 609, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "u", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " u = self.ALIAS[unit]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L56_C16", "label": "default_unit =", "type": "assigned_variable", "loc": [56, 56], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L53_C12", "vector": [14, 5, 0.1667, 0.003, 5, 0.29, 0.3333, 175, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "default_unit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " default_unit = u"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L58_C16", "label": "lower = lower()", "type": "assigned_variable", "loc": [58, 58], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L53_C12", "vector": [14, 5, 0.1726, 0.003, 5, 0.29, 0.6667, 432, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "lower", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " lower = unit.lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L59_C16", "label": "if", "type": "if", "loc": [59, 67], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L53_C12", "vector": [4, 5, 0.1875, 0.0268, 5, 0.29, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lower in self.UNITS:\n val += self.UNITS[lower] * value\n default_unit = lower\n elif lower in self.LALIAS:\n u = self.LALIAS[lower]\n val += self.UNITS[u] * value\n default_unit = u\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L61_C20", "label": "default_unit =", "type": "assigned_variable", "loc": [61, 61], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L59_C16", "vector": [14, 6, 0.1815, 0.003, 6, 0.14, 0.0, 175, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "default_unit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " default_unit = lower"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L62_C16", "label": "if", "type": "if", "loc": [62, 67], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L59_C16", "vector": [4, 6, 0.192, 0.0179, 6, 0.14, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif lower in self.LALIAS:\n u = self.LALIAS[lower]\n val += self.UNITS[u] * value\n default_unit = u\n else:\n raise AttributeError('Unknown unit type: %s' % unit)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L63_C20", "label": "u =", "type": "assigned_variable", "loc": [63, 63], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L62_C16", "vector": [14, 7, 0.1875, 0.003, 7, 0.48, 0.0, 609, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "u", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " u = self.LALIAS[lower]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L65_C20", "label": "default_unit =", "type": "assigned_variable", "loc": [65, 65], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L62_C16", "vector": [14, 7, 0.1935, 0.003, 7, 0.48, 1.0, 175, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "default_unit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " default_unit = u"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L68_C8", "label": "return", "type": "return", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L42_C4", "vector": [13, 2, 0.2024, 0.003, 2, 0.91, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return val, default_unit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L71_C4", "label": "unit_attname", "type": "function", "loc": [71, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L41_C0", "vector": [2, 1, 0.2321, 0.0446, 1, 0.08, 1.0, 503, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "unit_attname", "arg_names": ["cls", "unit_str"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def unit_attname(cls, unit_str):\n \"\"\"\n Retrieves the unit attribute name for the given unit string.\n For example, if the given unit string is 'metre', 'm' would be returned.\n An exception is raised if an attribute cannot be found.\n \"\"\"\n lower = unit_str.lower()\n if unit_str in cls.UNITS:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Expr_L72_C8", "label": "expression", "type": "expression", "loc": [72, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L71_C4", "vector": [8, 2, 0.2202, 0.0149, 2, 0.87, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Retrieves the unit attribute name for the given unit string.\n For example, if the given unit string is 'metre', 'm' would be returned.\n An exception is raised if an attribute cannot be found.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L77_C8", "label": "lower = lower()", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L71_C4", "vector": [14, 2, 0.2292, 0.003, 2, 0.87, 0.5, 432, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "lower", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " lower = unit_str.lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L78_C8", "label": "if", "type": "if", "loc": [78, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L71_C4", "vector": [4, 2, 0.2426, 0.0238, 2, 0.87, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if unit_str in cls.UNITS:\n return unit_str\n elif lower in cls.UNITS:\n return lower\n elif lower in cls.LALIAS:\n return cls.LALIAS[lower]\n else:\n raise Exception('Could not find a unit keyword associated with \"%s\"' % unit_str)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L79_C12", "label": "return", "type": "return", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L78_C8", "vector": [13, 3, 0.2351, 0.003, 3, 0.25, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return unit_str"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L80_C8", "label": "if", "type": "if", "loc": [80, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L78_C8", "vector": [4, 3, 0.2455, 0.0179, 3, 0.25, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif lower in cls.UNITS:\n return lower\n elif lower in cls.LALIAS:\n return cls.LALIAS[lower]\n else:\n raise Exception('Could not find a unit keyword associated with \"%s\"' % unit_str)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L81_C12", "label": "return", "type": "return", "loc": [81, 81], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L80_C8", "vector": [13, 4, 0.2411, 0.003, 4, 0.3, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return lower"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L82_C8", "label": "if", "type": "if", "loc": [82, 85], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L80_C8", "vector": [4, 4, 0.2485, 0.0119, 4, 0.3, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif lower in cls.LALIAS:\n return cls.LALIAS[lower]\n else:\n raise Exception('Could not find a unit keyword associated with \"%s\"' % unit_str)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L83_C12", "label": "return", "type": "return", "loc": [83, 83], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L82_C8", "vector": [13, 5, 0.247, 0.003, 5, 0.15, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return cls.LALIAS[lower]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "label": "Distance", "type": "class", "loc": [87, 245], "level": 0, "parent": null, "vector": [3, 0, 0.494, 0.4732, 0, 0.66, 0.5714, 420, 0, 15, 0, 0, 119, 0, 37], "semantic": {"name": "Distance", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Distance(MeasureBase):\n UNITS = {\n 'chain' : 20.1168,\n 'chain_benoit' : 20.116782,\n 'chain_sears' : 20.1167645,\n 'british_chain_benoit' : 20.1167824944,\n 'british_chain_sears' : 20.1167651216,\n 'british_chain_sears_truncated' : 20.116756,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L88_C4", "label": "UNITS =", "type": "assigned_variable", "loc": [88, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "vector": [14, 1, 0.3095, 0.0982, 1, 0.15, 0.0, 103, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "UNITS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " UNITS = {\n 'chain' : 20.1168,\n 'chain_benoit' : 20.116782,\n 'chain_sears' : 20.1167645,\n 'british_chain_benoit' : 20.1167824944,\n 'british_chain_sears' : 20.1167651216,\n 'british_chain_sears_truncated' : 20.116756,\n 'cm' : 0.01,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L123_C4", "label": "ALIAS =", "type": "assigned_variable", "loc": [123, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "vector": [14, 1, 0.4211, 0.1131, 1, 0.15, 0.0588, 160, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "ALIAS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ALIAS = {\n 'centimeter' : 'cm',\n 'foot' : 'ft',\n 'inches' : 'inch',\n 'kilometer' : 'km',\n 'kilometre' : 'km',\n 'meter' : 'm',\n 'metre' : 'm',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L161_C4", "label": "LALIAS = dict()", "type": "assigned_variable", "loc": [161, 161], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "vector": [14, 1, 0.4792, 0.003, 1, 0.15, 0.1176, 688, 3, 1, 0, 0, 827, 10, 3], "semantic": {"name": "LALIAS", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " LALIAS = dict([(k.lower(), v) for k, v in ALIAS.items()])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L163_C4", "label": "__init__", "type": "function", "loc": [163, 167], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "vector": [2, 1, 0.4911, 0.0149, 1, 0.15, 0.1765, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "default_unit", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, default_unit=None, **kwargs):\n # The base unit is in meters.\n self.m, self._default_unit = self.default_units(kwargs)\n if default_unit and isinstance(default_unit, str):\n self._default_unit = default_unit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L165_C8", "label": " = default_units()", "type": "assigned_variable", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L163_C4", "vector": [14, 2, 0.4911, 0.003, 2, 0.46, 0.0, 0, 3, 1, 0, 0, 74, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "default_units", "annotation": ""}, "snippet": " self.m, self._default_unit = self.default_units(kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L166_C8", "label": "if", "type": "if", "loc": [166, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L163_C4", "vector": [4, 2, 0.4955, 0.006, 2, 0.46, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if default_unit and isinstance(default_unit, str):\n self._default_unit = default_unit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L167_C12", "label": "self._default_unit =", "type": "assigned_variable", "loc": [167, 167], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L166_C8", "vector": [14, 3, 0.497, 0.003, 3, 0.2, 0.0, 319, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._default_unit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._default_unit = default_unit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L169_C4", "label": "__getattr__", "type": "function", "loc": [169, 173], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "vector": [2, 1, 0.5089, 0.0149, 1, 0.15, 0.2353, 210, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__getattr__", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getattr__(self, name):\n if name in self.UNITS:\n return self.m / self.UNITS[name]\n else:\n raise AttributeError('Unknown unit type: %s' % name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L170_C8", "label": "if", "type": "if", "loc": [170, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L169_C4", "vector": [4, 2, 0.5104, 0.0119, 2, 0.63, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if name in self.UNITS:\n return self.m / self.UNITS[name]\n else:\n raise AttributeError('Unknown unit type: %s' % name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L171_C12", "label": "return", "type": "return", "loc": [171, 171], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L170_C8", "vector": [13, 3, 0.5089, 0.003, 3, 0.04, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.m / self.UNITS[name]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L175_C4", "label": "__repr__", "type": "function", "loc": [175, 176], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "vector": [2, 1, 0.5223, 0.006, 1, 0.15, 0.2941, 204, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__repr__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __repr__(self):\n return 'Distance(%s=%s)' % (self._default_unit, getattr(self, self._default_unit))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L176_C8", "label": "return", "type": "return", "loc": [176, 176], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L175_C4", "vector": [13, 2, 0.5238, 0.003, 2, 0.1, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'Distance(%s=%s)' % (self._default_unit, getattr(self, self._default_unit))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L178_C4", "label": "__str__", "type": "function", "loc": [178, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "vector": [2, 1, 0.5312, 0.006, 1, 0.15, 0.3529, 527, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n return '%s %s' % (getattr(self, self._default_unit), self._default_unit)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L179_C8", "label": "return", "type": "return", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L178_C4", "vector": [13, 2, 0.5327, 0.003, 2, 0.81, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s %s' % (getattr(self, self._default_unit), self._default_unit)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L181_C4", "label": "__cmp__", "type": "function", "loc": [181, 185], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "vector": [2, 1, 0.5446, 0.0149, 1, 0.15, 0.4118, 271, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__cmp__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __cmp__(self, other):\n if isinstance(other, Distance):\n return cmp(self.m, other.m)\n else:\n return NotImplemented"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L182_C8", "label": "if", "type": "if", "loc": [182, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L181_C4", "vector": [4, 2, 0.5461, 0.0119, 2, 0.02, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, Distance):\n return cmp(self.m, other.m)\n else:\n return NotImplemented"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L183_C12", "label": "return", "type": "return", "loc": [183, 183], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L182_C8", "vector": [13, 3, 0.5446, 0.003, 3, 0.1, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return cmp(self.m, other.m)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L185_C12", "label": "return", "type": "return", "loc": [185, 185], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L182_C8", "vector": [13, 3, 0.5506, 0.003, 3, 0.1, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return NotImplemented"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L187_C4", "label": "__add__", "type": "function", "loc": [187, 191], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "vector": [2, 1, 0.5625, 0.0149, 1, 0.15, 0.4706, 899, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "__add__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __add__(self, other):\n if isinstance(other, Distance):\n return Distance(default_unit=self._default_unit, m=(self.m + other.m))\n else:\n raise TypeError('Distance must be added with Distance')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L188_C8", "label": "if", "type": "if", "loc": [188, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L187_C4", "vector": [4, 2, 0.564, 0.0119, 2, 0.07, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, Distance):\n return Distance(default_unit=self._default_unit, m=(self.m + other.m))\n else:\n raise TypeError('Distance must be added with Distance')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L189_C12", "label": "return", "type": "return", "loc": [189, 189], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L188_C8", "vector": [13, 3, 0.5625, 0.003, 3, 0.75, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Distance(default_unit=self._default_unit, m=(self.m + other.m))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L193_C4", "label": "__iadd__", "type": "function", "loc": [193, 198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "vector": [2, 1, 0.5818, 0.0179, 1, 0.15, 0.5294, 944, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__iadd__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iadd__(self, other):\n if isinstance(other, Distance):\n self.m += other.m\n return self\n else:\n raise TypeError('Distance must be added with Distance')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L194_C8", "label": "if", "type": "if", "loc": [194, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L193_C4", "vector": [4, 2, 0.5833, 0.0149, 2, 0.34, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, Distance):\n self.m += other.m\n return self\n else:\n raise TypeError('Distance must be added with Distance')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L196_C12", "label": "return", "type": "return", "loc": [196, 196], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L194_C8", "vector": [13, 3, 0.5833, 0.003, 3, 0.94, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L200_C4", "label": "__sub__", "type": "function", "loc": [200, 204], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "vector": [2, 1, 0.6012, 0.0149, 1, 0.15, 0.5882, 555, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "__sub__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __sub__(self, other):\n if isinstance(other, Distance):\n return Distance(default_unit=self._default_unit, m=(self.m - other.m))\n else:\n raise TypeError('Distance must be subtracted from Distance')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L201_C8", "label": "if", "type": "if", "loc": [201, 204], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L200_C4", "vector": [4, 2, 0.6027, 0.0119, 2, 0.85, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, Distance):\n return Distance(default_unit=self._default_unit, m=(self.m - other.m))\n else:\n raise TypeError('Distance must be subtracted from Distance')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L202_C12", "label": "return", "type": "return", "loc": [202, 202], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L201_C8", "vector": [13, 3, 0.6012, 0.003, 3, 0.94, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Distance(default_unit=self._default_unit, m=(self.m - other.m))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L206_C4", "label": "__isub__", "type": "function", "loc": [206, 211], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "vector": [2, 1, 0.6205, 0.0179, 1, 0.15, 0.6471, 400, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__isub__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __isub__(self, other):\n if isinstance(other, Distance):\n self.m -= other.m\n return self\n else:\n raise TypeError('Distance must be subtracted from Distance')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L207_C8", "label": "if", "type": "if", "loc": [207, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L206_C4", "vector": [4, 2, 0.622, 0.0149, 2, 0.03, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, Distance):\n self.m -= other.m\n return self\n else:\n raise TypeError('Distance must be subtracted from Distance')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L209_C12", "label": "return", "type": "return", "loc": [209, 209], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L207_C8", "vector": [13, 3, 0.622, 0.003, 3, 0.69, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L213_C4", "label": "__mul__", "type": "function", "loc": [213, 219], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "vector": [2, 1, 0.6429, 0.0208, 1, 0.15, 0.7059, 215, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "__mul__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __mul__(self, other):\n if isinstance(other, (int, float, long, Decimal)):\n return Distance(default_unit=self._default_unit, m=(self.m * float(other)))\n elif isinstance(other, Distance):\n return Area(default_unit='sq_' + self._default_unit, sq_m=(self.m * other.m))\n else:\n raise TypeError('Distance must be multiplied with number or Distance')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L214_C8", "label": "if", "type": "if", "loc": [214, 219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L213_C4", "vector": [4, 2, 0.6443, 0.0179, 2, 0.9, 0.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, (int, float, long, Decimal)):\n return Distance(default_unit=self._default_unit, m=(self.m * float(other)))\n elif isinstance(other, Distance):\n return Area(default_unit='sq_' + self._default_unit, sq_m=(self.m * other.m))\n else:\n raise TypeError('Distance must be multiplied with number or Distance')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L215_C12", "label": "return", "type": "return", "loc": [215, 215], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L214_C8", "vector": [13, 3, 0.6399, 0.003, 3, 0.36, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Distance(default_unit=self._default_unit, m=(self.m * float(other)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L216_C8", "label": "if", "type": "if", "loc": [216, 219], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L214_C8", "vector": [4, 3, 0.6473, 0.0119, 3, 0.36, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(other, Distance):\n return Area(default_unit='sq_' + self._default_unit, sq_m=(self.m * other.m))\n else:\n raise TypeError('Distance must be multiplied with number or Distance')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L217_C12", "label": "return", "type": "return", "loc": [217, 217], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L216_C8", "vector": [13, 4, 0.6458, 0.003, 4, 0.35, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Area(default_unit='sq_' + self._default_unit, sq_m=(self.m * other.m))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L221_C4", "label": "__imul__", "type": "function", "loc": [221, 226], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "vector": [2, 1, 0.6652, 0.0179, 1, 0.15, 0.7647, 845, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "__imul__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __imul__(self, other):\n if isinstance(other, (int, float, long, Decimal)):\n self.m *= float(other)\n return self\n else:\n raise TypeError('Distance must be multiplied with number')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L222_C8", "label": "if", "type": "if", "loc": [222, 226], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L221_C4", "vector": [4, 2, 0.6667, 0.0149, 2, 0.55, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, (int, float, long, Decimal)):\n self.m *= float(other)\n return self\n else:\n raise TypeError('Distance must be multiplied with number')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L224_C12", "label": "return", "type": "return", "loc": [224, 224], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L222_C8", "vector": [13, 3, 0.6667, 0.003, 3, 0.23, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L228_C4", "label": "__rmul__", "type": "function", "loc": [228, 229], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "vector": [2, 1, 0.6801, 0.006, 1, 0.15, 0.8235, 612, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__rmul__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __rmul__(self, other):\n return self * other"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L229_C8", "label": "return", "type": "return", "loc": [229, 229], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L228_C4", "vector": [13, 2, 0.6815, 0.003, 2, 0.99, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self * other"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L231_C4", "label": "__div__", "type": "function", "loc": [231, 235], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "vector": [2, 1, 0.6935, 0.0149, 1, 0.15, 0.8824, 399, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "__div__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __div__(self, other):\n if isinstance(other, (int, float, long, Decimal)):\n return Distance(default_unit=self._default_unit, m=(self.m / float(other)))\n else:\n raise TypeError('Distance must be divided with number')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L232_C8", "label": "if", "type": "if", "loc": [232, 235], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L231_C4", "vector": [4, 2, 0.6949, 0.0119, 2, 0.24, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, (int, float, long, Decimal)):\n return Distance(default_unit=self._default_unit, m=(self.m / float(other)))\n else:\n raise TypeError('Distance must be divided with number')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L233_C12", "label": "return", "type": "return", "loc": [233, 233], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L232_C8", "vector": [13, 3, 0.6935, 0.003, 3, 0.29, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Distance(default_unit=self._default_unit, m=(self.m / float(other)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L237_C4", "label": "__idiv__", "type": "function", "loc": [237, 242], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "vector": [2, 1, 0.7128, 0.0179, 1, 0.15, 0.9412, 741, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "__idiv__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __idiv__(self, other):\n if isinstance(other, (int, float, long, Decimal)):\n self.m /= float(other)\n return self\n else:\n raise TypeError('Distance must be divided with number')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L238_C8", "label": "if", "type": "if", "loc": [238, 242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L237_C4", "vector": [4, 2, 0.7143, 0.0149, 2, 0.59, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, (int, float, long, Decimal)):\n self.m /= float(other)\n return self\n else:\n raise TypeError('Distance must be divided with number')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L240_C12", "label": "return", "type": "return", "loc": [240, 240], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L238_C8", "vector": [13, 3, 0.7143, 0.003, 3, 0.24, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L244_C4", "label": "__nonzero__", "type": "function", "loc": [244, 245], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "vector": [2, 1, 0.7277, 0.006, 1, 0.15, 1.0, 322, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__nonzero__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __nonzero__(self):\n return bool(self.m)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L245_C8", "label": "return", "type": "return", "loc": [245, 245], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L244_C4", "vector": [13, 2, 0.7292, 0.003, 2, 0.4, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bool(self.m)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "label": "Area", "type": "class", "loc": [247, 332], "level": 0, "parent": null, "vector": [3, 0, 0.8616, 0.256, 0, 0.66, 0.7143, 116, 0, 15, 0, 0, 119, 0, 39], "semantic": {"name": "Area", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Area(MeasureBase):\n # Getting the square units values and the alias dictionary.\n UNITS = dict([('sq_%s' % k, v ** 2) for k, v in Distance.UNITS.items()])\n ALIAS = dict([(k, 'sq_%s' % v) for k, v in Distance.ALIAS.items()])\n LALIAS = dict([(k.lower(), v) for k, v in ALIAS.items()])\n\n def __init__(self, default_unit=None, **kwargs):\n self.sq_m, self._default_unit = self.default_units(kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L249_C4", "label": "UNITS = dict()", "type": "assigned_variable", "loc": [249, 249], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "vector": [14, 1, 0.7411, 0.003, 1, 0.14, 0.0, 103, 3, 1, 0, 0, 827, 10, 2], "semantic": {"name": "UNITS", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " UNITS = dict([('sq_%s' % k, v ** 2) for k, v in Distance.UNITS.items()])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L250_C4", "label": "ALIAS = dict()", "type": "assigned_variable", "loc": [250, 250], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "vector": [14, 1, 0.744, 0.003, 1, 0.14, 0.0588, 160, 3, 1, 0, 0, 827, 10, 2], "semantic": {"name": "ALIAS", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " ALIAS = dict([(k, 'sq_%s' % v) for k, v in Distance.ALIAS.items()])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L251_C4", "label": "LALIAS = dict()", "type": "assigned_variable", "loc": [251, 251], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "vector": [14, 1, 0.747, 0.003, 1, 0.14, 0.1176, 688, 3, 1, 0, 0, 827, 10, 3], "semantic": {"name": "LALIAS", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " LALIAS = dict([(k.lower(), v) for k, v in ALIAS.items()])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L253_C4", "label": "__init__", "type": "function", "loc": [253, 256], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "vector": [2, 1, 0.7574, 0.0119, 1, 0.14, 0.1765, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "default_unit", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, default_unit=None, **kwargs):\n self.sq_m, self._default_unit = self.default_units(kwargs)\n if default_unit and isinstance(default_unit, str):\n self._default_unit = default_unit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L254_C8", "label": " = default_units()", "type": "assigned_variable", "loc": [254, 254], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L253_C4", "vector": [14, 2, 0.756, 0.003, 2, 0.32, 0.0, 0, 3, 1, 0, 0, 74, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "default_units", "annotation": ""}, "snippet": " self.sq_m, self._default_unit = self.default_units(kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L255_C8", "label": "if", "type": "if", "loc": [255, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L253_C4", "vector": [4, 2, 0.7604, 0.006, 2, 0.32, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if default_unit and isinstance(default_unit, str):\n self._default_unit = default_unit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L256_C12", "label": "self._default_unit =", "type": "assigned_variable", "loc": [256, 256], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L255_C8", "vector": [14, 3, 0.7619, 0.003, 3, 0.36, 0.0, 319, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._default_unit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._default_unit = default_unit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L258_C4", "label": "__getattr__", "type": "function", "loc": [258, 262], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "vector": [2, 1, 0.7738, 0.0149, 1, 0.14, 0.2353, 210, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__getattr__", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getattr__(self, name):\n if name in self.UNITS:\n return self.sq_m / self.UNITS[name]\n else:\n raise AttributeError('Unknown unit type: ' + name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L259_C8", "label": "if", "type": "if", "loc": [259, 262], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L258_C4", "vector": [4, 2, 0.7753, 0.0119, 2, 0.23, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if name in self.UNITS:\n return self.sq_m / self.UNITS[name]\n else:\n raise AttributeError('Unknown unit type: ' + name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L260_C12", "label": "return", "type": "return", "loc": [260, 260], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L259_C8", "vector": [13, 3, 0.7738, 0.003, 3, 0.34, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.sq_m / self.UNITS[name]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L264_C4", "label": "__repr__", "type": "function", "loc": [264, 265], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "vector": [2, 1, 0.7872, 0.006, 1, 0.14, 0.2941, 204, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__repr__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __repr__(self):\n return 'Area(%s=%s)' % (self._default_unit, getattr(self, self._default_unit))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L265_C8", "label": "return", "type": "return", "loc": [265, 265], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L264_C4", "vector": [13, 2, 0.7887, 0.003, 2, 0.65, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'Area(%s=%s)' % (self._default_unit, getattr(self, self._default_unit))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L267_C4", "label": "__str__", "type": "function", "loc": [267, 268], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "vector": [2, 1, 0.7961, 0.006, 1, 0.14, 0.3529, 527, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n return '%s %s' % (getattr(self, self._default_unit), self._default_unit)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L268_C8", "label": "return", "type": "return", "loc": [268, 268], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L267_C4", "vector": [13, 2, 0.7976, 0.003, 2, 0.48, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s %s' % (getattr(self, self._default_unit), self._default_unit)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L270_C4", "label": "__cmp__", "type": "function", "loc": [270, 274], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "vector": [2, 1, 0.8095, 0.0149, 1, 0.14, 0.4118, 271, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__cmp__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __cmp__(self, other):\n if isinstance(other, Area):\n return cmp(self.sq_m, other.sq_m)\n else:\n return NotImplemented"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L271_C8", "label": "if", "type": "if", "loc": [271, 274], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L270_C4", "vector": [4, 2, 0.811, 0.0119, 2, 0.28, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, Area):\n return cmp(self.sq_m, other.sq_m)\n else:\n return NotImplemented"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L272_C12", "label": "return", "type": "return", "loc": [272, 272], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L271_C8", "vector": [13, 3, 0.8095, 0.003, 3, 0.09, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return cmp(self.sq_m, other.sq_m)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L274_C12", "label": "return", "type": "return", "loc": [274, 274], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L271_C8", "vector": [13, 3, 0.8155, 0.003, 3, 0.09, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return NotImplemented"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L276_C4", "label": "__add__", "type": "function", "loc": [276, 280], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "vector": [2, 1, 0.8274, 0.0149, 1, 0.14, 0.4706, 899, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "__add__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __add__(self, other):\n if isinstance(other, Area):\n return Area(default_unit=self._default_unit, sq_m=(self.sq_m + other.sq_m))\n else:\n raise TypeError('Area must be added with Area')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L277_C8", "label": "if", "type": "if", "loc": [277, 280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L276_C4", "vector": [4, 2, 0.8289, 0.0119, 2, 0.56, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, Area):\n return Area(default_unit=self._default_unit, sq_m=(self.sq_m + other.sq_m))\n else:\n raise TypeError('Area must be added with Area')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L278_C12", "label": "return", "type": "return", "loc": [278, 278], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L277_C8", "vector": [13, 3, 0.8274, 0.003, 3, 0.3, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Area(default_unit=self._default_unit, sq_m=(self.sq_m + other.sq_m))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L282_C4", "label": "__iadd__", "type": "function", "loc": [282, 287], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "vector": [2, 1, 0.8467, 0.0179, 1, 0.14, 0.5294, 944, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__iadd__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iadd__(self, other):\n if isinstance(other, Area):\n self.sq_m += other.sq_m\n return self\n else:\n raise TypeError('Area must be added with Area')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L283_C8", "label": "if", "type": "if", "loc": [283, 287], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L282_C4", "vector": [4, 2, 0.8482, 0.0149, 2, 0.88, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, Area):\n self.sq_m += other.sq_m\n return self\n else:\n raise TypeError('Area must be added with Area')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L285_C12", "label": "return", "type": "return", "loc": [285, 285], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L283_C8", "vector": [13, 3, 0.8482, 0.003, 3, 0.66, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L289_C4", "label": "__sub__", "type": "function", "loc": [289, 293], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "vector": [2, 1, 0.8661, 0.0149, 1, 0.14, 0.5882, 555, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "__sub__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __sub__(self, other):\n if isinstance(other, Area):\n return Area(default_unit=self._default_unit, sq_m=(self.sq_m - other.sq_m))\n else:\n raise TypeError('Area must be subtracted from Area')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L290_C8", "label": "if", "type": "if", "loc": [290, 293], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L289_C4", "vector": [4, 2, 0.8676, 0.0119, 2, 0.58, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, Area):\n return Area(default_unit=self._default_unit, sq_m=(self.sq_m - other.sq_m))\n else:\n raise TypeError('Area must be subtracted from Area')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L291_C12", "label": "return", "type": "return", "loc": [291, 291], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L290_C8", "vector": [13, 3, 0.8661, 0.003, 3, 0.32, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Area(default_unit=self._default_unit, sq_m=(self.sq_m - other.sq_m))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L295_C4", "label": "__isub__", "type": "function", "loc": [295, 300], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "vector": [2, 1, 0.8854, 0.0179, 1, 0.14, 0.6471, 400, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__isub__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __isub__(self, other):\n if isinstance(other, Area):\n self.sq_m -= other.sq_m\n return self\n else:\n raise TypeError('Area must be subtracted from Area')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L296_C8", "label": "if", "type": "if", "loc": [296, 300], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L295_C4", "vector": [4, 2, 0.8869, 0.0149, 2, 0.71, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, Area):\n self.sq_m -= other.sq_m\n return self\n else:\n raise TypeError('Area must be subtracted from Area')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L298_C12", "label": "return", "type": "return", "loc": [298, 298], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L296_C8", "vector": [13, 3, 0.8869, 0.003, 3, 0.59, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L302_C4", "label": "__mul__", "type": "function", "loc": [302, 306], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "vector": [2, 1, 0.9048, 0.0149, 1, 0.14, 0.7059, 215, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "__mul__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __mul__(self, other):\n if isinstance(other, (int, float, long, Decimal)):\n return Area(default_unit=self._default_unit, sq_m=(self.sq_m * float(other)))\n else:\n raise TypeError('Area must be multiplied with number')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L303_C8", "label": "if", "type": "if", "loc": [303, 306], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L302_C4", "vector": [4, 2, 0.9062, 0.0119, 2, 0.51, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, (int, float, long, Decimal)):\n return Area(default_unit=self._default_unit, sq_m=(self.sq_m * float(other)))\n else:\n raise TypeError('Area must be multiplied with number')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L304_C12", "label": "return", "type": "return", "loc": [304, 304], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L303_C8", "vector": [13, 3, 0.9048, 0.003, 3, 0.33, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Area(default_unit=self._default_unit, sq_m=(self.sq_m * float(other)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L308_C4", "label": "__imul__", "type": "function", "loc": [308, 313], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "vector": [2, 1, 0.9241, 0.0179, 1, 0.14, 0.7647, 845, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "__imul__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __imul__(self, other):\n if isinstance(other, (int, float, long, Decimal)):\n self.sq_m *= float(other)\n return self\n else:\n raise TypeError('Area must be multiplied with number')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L309_C8", "label": "if", "type": "if", "loc": [309, 313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L308_C4", "vector": [4, 2, 0.9256, 0.0149, 2, 0.73, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, (int, float, long, Decimal)):\n self.sq_m *= float(other)\n return self\n else:\n raise TypeError('Area must be multiplied with number')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L311_C12", "label": "return", "type": "return", "loc": [311, 311], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L309_C8", "vector": [13, 3, 0.9256, 0.003, 3, 0.96, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L315_C4", "label": "__rmul__", "type": "function", "loc": [315, 316], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "vector": [2, 1, 0.939, 0.006, 1, 0.14, 0.8235, 612, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__rmul__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __rmul__(self, other):\n return self * other"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L316_C8", "label": "return", "type": "return", "loc": [316, 316], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L315_C4", "vector": [13, 2, 0.9405, 0.003, 2, 0.87, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self * other"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L318_C4", "label": "__div__", "type": "function", "loc": [318, 322], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "vector": [2, 1, 0.9524, 0.0149, 1, 0.14, 0.8824, 399, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "__div__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __div__(self, other):\n if isinstance(other, (int, float, long, Decimal)):\n return Area(default_unit=self._default_unit, sq_m=(self.sq_m / float(other)))\n else:\n raise TypeError('Area must be divided with number')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L319_C8", "label": "if", "type": "if", "loc": [319, 322], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L318_C4", "vector": [4, 2, 0.9539, 0.0119, 2, 0.2, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, (int, float, long, Decimal)):\n return Area(default_unit=self._default_unit, sq_m=(self.sq_m / float(other)))\n else:\n raise TypeError('Area must be divided with number')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L320_C12", "label": "return", "type": "return", "loc": [320, 320], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L319_C8", "vector": [13, 3, 0.9524, 0.003, 3, 0.64, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Area(default_unit=self._default_unit, sq_m=(self.sq_m / float(other)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L324_C4", "label": "__idiv__", "type": "function", "loc": [324, 329], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "vector": [2, 1, 0.9717, 0.0179, 1, 0.14, 0.9412, 741, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "__idiv__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __idiv__(self, other):\n if isinstance(other, (int, float, long, Decimal)):\n self.sq_m /= float(other)\n return self\n else:\n raise TypeError('Area must be divided with number')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L325_C8", "label": "if", "type": "if", "loc": [325, 329], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L324_C4", "vector": [4, 2, 0.9732, 0.0149, 2, 0.36, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, (int, float, long, Decimal)):\n self.sq_m /= float(other)\n return self\n else:\n raise TypeError('Area must be divided with number')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L327_C12", "label": "return", "type": "return", "loc": [327, 327], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L325_C8", "vector": [13, 3, 0.9732, 0.003, 3, 0.25, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L331_C4", "label": "__nonzero__", "type": "function", "loc": [331, 332], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "vector": [2, 1, 0.9866, 0.006, 1, 0.14, 1.0, 322, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__nonzero__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __nonzero__(self):\n return bool(self.sq_m)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L332_C8", "label": "return", "type": "return", "loc": [332, 332], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L331_C4", "vector": [13, 2, 0.9881, 0.003, 2, 0.55, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bool(self.sq_m)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L335_C0", "label": "D =", "type": "assigned_variable", "loc": [335, 335], "level": 0, "parent": null, "vector": [14, 0, 0.997, 0.003, 0, 0.66, 0.8571, 939, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "D", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "D = Distance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L336_C0", "label": "A =", "type": "assigned_variable", "loc": [336, 336], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.003, 0, 0.66, 1.0, 429, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "A", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "A = Area"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Expr_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:For_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:For_L48_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L49_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L49_C45"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:For_L48_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L50_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L50_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L52_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L50_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L53_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L54_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L53_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L56_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L53_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L58_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L53_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L59_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L59_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L61_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L59_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L62_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L62_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L63_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L62_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L65_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Expr_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L78_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L78_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L80_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L81_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L80_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L83_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L161_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L166_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L167_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L169_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L169_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L170_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L171_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L175_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L181_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L182_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L182_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L183_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L182_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L185_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L187_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L188_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L188_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L189_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L193_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L193_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L194_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L194_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L196_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L200_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L200_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L201_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L201_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L202_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L206_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L206_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L207_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L207_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L209_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L213_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L213_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L214_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L214_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L215_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L214_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L216_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L216_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L217_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L221_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L221_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L222_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L222_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L224_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L228_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L228_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L229_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L231_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L231_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L232_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L232_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L233_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L237_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L237_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L238_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L238_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L240_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L244_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L245_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L249_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L250_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L251_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L253_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L254_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L255_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L255_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Assign_L256_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L258_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L258_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L259_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L259_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L260_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L264_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L264_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L265_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L267_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L267_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L268_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L270_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L270_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L271_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L271_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L272_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L271_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L274_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L276_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L276_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L277_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L278_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L282_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L283_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L283_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L285_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L289_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L289_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L290_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L290_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L291_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L295_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L295_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L296_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L296_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L298_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L302_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L303_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L303_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L304_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L308_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L308_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L309_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L309_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L311_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L315_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L315_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L316_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L318_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L318_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L319_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L319_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L320_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L324_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L324_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L325_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:If_L325_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L327_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:ClassDef_L247_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L331_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L331_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:Return_L332_C8"}] |
"""
DataSource is a wrapper for the OGR Data Source object, which provides
an interface for reading vector geometry data from many different file
formats (including ESRI shapefiles).
When instantiating a DataSource object, use the filename of a
GDAL-supported data source. For example, a SHP file or a
TIGER/Line file from the government.
The ds_driver keyword is used internally when a ctypes pointer
is passed in directly.
Example:
ds = DataSource('/home/foo/bar.shp')
for layer in ds:
for feature in layer:
# Getting the geometry for the feature.
g = feature.geom
# Getting the 'description' field for the feature.
desc = feature['description']
# We can also increment through all of the fields
# attached to this feature.
for field in feature:
# Get the name of the field (e.g. 'description')
nm = field.name
# Get the type (integer) of the field, e.g. 0 => OFTInteger
t = field.type
# Returns the value the field; OFTIntegers return ints,
# OFTReal returns floats, all else returns string.
val = field.value
"""
# ctypes prerequisites.
from ctypes import byref, c_void_p
# The GDAL C library, OGR exceptions, and the Layer object.
from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.driver import Driver
from django.contrib.gis.gdal.error import OGRException, OGRIndexError
from django.contrib.gis.gdal.layer import Layer
# Getting the ctypes prototypes for the DataSource.
from django.contrib.gis.gdal.prototypes import ds as capi
# For more information, see the OGR C API source code:
# http://www.gdal.org/ogr/ogr__api_8h.html
#
# The OGR_DS_* routines are relevant here.
class DataSource(GDALBase):
"Wraps an OGR Data Source object."
#### Python 'magic' routines ####
def __init__(self, ds_input, ds_driver=False, write=False):
# The write flag.
if write:
self._write = 1
else:
self._write = 0
# Registering all the drivers, this needs to be done
# _before_ we try to open up a data source.
if not capi.get_driver_count():
capi.register_all()
if isinstance(ds_input, basestring):
# The data source driver is a void pointer.
ds_driver = Driver.ptr_type()
try:
# OGROpen will auto-detect the data source type.
ds = capi.open_ds(ds_input, self._write, byref(ds_driver))
except OGRException:
# Making the error message more clear rather than something
# like "Invalid pointer returned from OGROpen".
raise OGRException('Could not open the datasource at "%s"' % ds_input)
elif isinstance(ds_input, self.ptr_type) and isinstance(ds_driver, Driver.ptr_type):
ds = ds_input
else:
raise OGRException('Invalid data source input type: %s' % type(ds_input))
if bool(ds):
self.ptr = ds
self.driver = Driver(ds_driver)
else:
# Raise an exception if the returned pointer is NULL
raise OGRException('Invalid data source file "%s"' % ds_input)
def __del__(self):
"Destroys this DataStructure object."
if self._ptr: capi.destroy_ds(self._ptr)
def __iter__(self):
"Allows for iteration over the layers in a data source."
for i in xrange(self.layer_count):
yield self[i]
def __getitem__(self, index):
"Allows use of the index [] operator to get a layer at the index."
if isinstance(index, basestring):
l = capi.get_layer_by_name(self.ptr, index)
if not l: raise OGRIndexError('invalid OGR Layer name given: "%s"' % index)
elif isinstance(index, int):
if index < 0 or index >= self.layer_count:
raise OGRIndexError('index out of range')
l = capi.get_layer(self._ptr, index)
else:
raise TypeError('Invalid index type: %s' % type(index))
return Layer(l, self)
def __len__(self):
"Returns the number of layers within the data source."
return self.layer_count
def __str__(self):
"Returns OGR GetName and Driver for the Data Source."
return '%s (%s)' % (self.name, str(self.driver))
@property
def layer_count(self):
"Returns the number of layers in the data source."
return capi.get_layer_count(self._ptr)
@property
def name(self):
"Returns the name of the data source."
return capi.get_ds_name(self._ptr)
| ajibawa-2023/Python-Code-Large/train/row_98697 | 53 | 128 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 35], "level": 0, "parent": null, "vector": [8, 0, 0.1406, 0.2734, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n DataSource is a wrapper for the OGR Data Source object, which provides\n an interface for reading vector geometry data from many different file\n formats (including ESRI shapefiles).\n\n When instantiating a DataSource object, use the filename of a\n GDAL-supported data source. For example, a SHP file or a\n TIGER/Line file from the government."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:ImportFrom_L37_C0", "label": "from ctypes import byref, c_void_p", "type": "import", "loc": [37, 37], "level": 0, "parent": null, "vector": [1, 0, 0.2891, 0.0078, 0, 0.66, 0.1429, 182, 0, 2, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["byref", "c_void_p"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import byref, c_void_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:ImportFrom_L40_C0", "label": "from django.contrib.gis.gdal.base import GDALBase", "type": "import", "loc": [40, 40], "level": 0, "parent": null, "vector": [1, 0, 0.3125, 0.0078, 0, 0.66, 0.2857, 771, 0, 1, 0, 0, 771, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.base", "arg_names": [], "import_names": ["GDALBase"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.base import GDALBase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:ImportFrom_L41_C0", "label": "from django.contrib.gis.gdal.driver import Driver", "type": "import", "loc": [41, 41], "level": 0, "parent": null, "vector": [1, 0, 0.3203, 0.0078, 0, 0.66, 0.4286, 489, 0, 1, 0, 0, 489, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.driver", "arg_names": [], "import_names": ["Driver"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.driver import Driver"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:ImportFrom_L42_C0", "label": "from django.contrib.gis.gdal.error import OGRException, OGRIndexError", "type": "import", "loc": [42, 42], "level": 0, "parent": null, "vector": [1, 0, 0.3281, 0.0078, 0, 0.66, 0.5714, 76, 0, 2, 0, 0, 76, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.error", "arg_names": [], "import_names": ["OGRException", "OGRIndexError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.error import OGRException, OGRIndexError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:ImportFrom_L43_C0", "label": "from django.contrib.gis.gdal.layer import Layer", "type": "import", "loc": [43, 43], "level": 0, "parent": null, "vector": [1, 0, 0.3359, 0.0078, 0, 0.66, 0.7143, 502, 0, 1, 0, 0, 502, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.layer", "arg_names": [], "import_names": ["Layer"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.layer import Layer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:ImportFrom_L46_C0", "label": "from django.contrib.gis.gdal.prototypes import capi", "type": "import", "loc": [46, 46], "level": 0, "parent": null, "vector": [1, 0, 0.3594, 0.0078, 0, 0.66, 0.8571, 730, 0, 1, 0, 0, 730, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.prototypes", "arg_names": [], "import_names": ["capi"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.prototypes import ds as capi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:ClassDef_L52_C0", "label": "DataSource", "type": "class", "loc": [52, 128], "level": 0, "parent": null, "vector": [3, 0, 0.7031, 0.6016, 0, 0.66, 1.0, 717, 0, 8, 0, 0, 436, 0, 28], "semantic": {"name": "DataSource", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DataSource(GDALBase):\n \"Wraps an OGR Data Source object.\"\n\n #### Python 'magic' routines ####\n def __init__(self, ds_input, ds_driver=False, write=False):\n # The write flag.\n if write:\n self._write = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Expr_L53_C4", "label": "expression", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:ClassDef_L52_C0", "vector": [8, 1, 0.4141, 0.0078, 1, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Wraps an OGR Data Source object.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L56_C4", "label": "__init__", "type": "function", "loc": [56, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:ClassDef_L52_C0", "vector": [2, 1, 0.5625, 0.2578, 1, 0.74, 0.125, 555, 0, 4, 0, 0, 0, 0, 14], "semantic": {"name": "__init__", "arg_names": ["self", "ds_input", "ds_driver", "write"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, ds_input, ds_driver=False, write=False):\n # The write flag.\n if write:\n self._write = 1\n else:\n self._write = 0\n\n # Registering all the drivers, this needs to be done"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L58_C8", "label": "if", "type": "if", "loc": [58, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L56_C4", "vector": [4, 2, 0.4648, 0.0312, 2, 0.28, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if write:\n self._write = 1\n else:\n self._write = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Assign_L59_C12", "label": "self._write =", "type": "assigned_variable", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L58_C8", "vector": [14, 3, 0.4609, 0.0078, 3, 0.79, 0.0, 686, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self._write", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._write = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Assign_L61_C12", "label": "self._write =", "type": "assigned_variable", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L58_C8", "vector": [14, 3, 0.4766, 0.0078, 3, 0.79, 1.0, 686, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self._write", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._write = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L65_C8", "label": "if", "type": "if", "loc": [65, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L56_C4", "vector": [4, 2, 0.5117, 0.0156, 2, 0.28, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not capi.get_driver_count():\n capi.register_all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Expr_L66_C12", "label": "register_all()", "type": "expression", "loc": [66, 66], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L65_C8", "vector": [8, 3, 0.5156, 0.0078, 3, 0.58, 0.0, 55, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "register_all", "arg_names": [], "import_names": [], "rhs_call_name": "register_all", "annotation": ""}, "snippet": " capi.register_all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L68_C8", "label": "if", "type": "if", "loc": [68, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L56_C4", "vector": [4, 2, 0.582, 0.1094, 2, 0.28, 0.6667, 0, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(ds_input, basestring):\n # The data source driver is a void pointer.\n ds_driver = Driver.ptr_type()\n try:\n # OGROpen will auto-detect the data source type.\n ds = capi.open_ds(ds_input, self._write, byref(ds_driver))\n except OGRException:\n # Making the error message more clear rather than something"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Assign_L70_C12", "label": "ds_driver = ptr_type()", "type": "assigned_variable", "loc": [70, 70], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L68_C8", "vector": [14, 3, 0.5469, 0.0078, 3, 0.12, 0.0, 366, 3, 0, 0, 0, 247, 10, 1], "semantic": {"name": "ds_driver", "arg_names": [], "import_names": [], "rhs_call_name": "ptr_type", "annotation": ""}, "snippet": " ds_driver = Driver.ptr_type()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Try_L71_C12", "label": "try", "type": "try", "loc": [71, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L68_C8", "vector": [7, 3, 0.5781, 0.0547, 3, 0.12, 0.5, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # OGROpen will auto-detect the data source type.\n ds = capi.open_ds(ds_input, self._write, byref(ds_driver))\n except OGRException:\n # Making the error message more clear rather than something\n # like \"Invalid pointer returned from OGROpen\".\n raise OGRException('Could not open the datasource at \"%s\"' % ds_input)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Assign_L73_C16", "label": "ds = open_ds()", "type": "assigned_variable", "loc": [73, 73], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:Try_L71_C12", "vector": [14, 4, 0.5703, 0.0078, 4, 0.98, 0.0, 263, 3, 3, 0, 0, 359, 10, 2], "semantic": {"name": "ds", "arg_names": [], "import_names": [], "rhs_call_name": "open_ds", "annotation": ""}, "snippet": " ds = capi.open_ds(ds_input, self._write, byref(ds_driver))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L78_C8", "label": "if", "type": "if", "loc": [78, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L68_C8", "vector": [4, 3, 0.6211, 0.0312, 3, 0.12, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(ds_input, self.ptr_type) and isinstance(ds_driver, Driver.ptr_type):\n ds = ds_input\n else:\n raise OGRException('Invalid data source input type: %s' % type(ds_input))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Assign_L79_C12", "label": "ds =", "type": "assigned_variable", "loc": [79, 79], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L78_C8", "vector": [14, 4, 0.6172, 0.0078, 4, 0.92, 0.0, 263, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ds", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ds = ds_input"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L83_C8", "label": "if", "type": "if", "loc": [83, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L56_C4", "vector": [4, 2, 0.668, 0.0469, 2, 0.28, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if bool(ds):\n self.ptr = ds\n self.driver = Driver(ds_driver)\n else:\n # Raise an exception if the returned pointer is NULL \n raise OGRException('Invalid data source file \"%s\"' % ds_input)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Assign_L84_C12", "label": "self.ptr =", "type": "assigned_variable", "loc": [84, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L83_C8", "vector": [14, 3, 0.6562, 0.0078, 3, 0.56, 0.0, 386, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.ptr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ptr = ds"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Assign_L85_C12", "label": "self.driver = Driver()", "type": "assigned_variable", "loc": [85, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L83_C8", "vector": [14, 3, 0.6641, 0.0078, 3, 0.56, 1.0, 578, 3, 1, 0, 0, 85, 10, 1], "semantic": {"name": "self.driver", "arg_names": [], "import_names": [], "rhs_call_name": "Driver", "annotation": ""}, "snippet": " self.driver = Driver(ds_driver)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L90_C4", "label": "__del__", "type": "function", "loc": [90, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:ClassDef_L52_C0", "vector": [2, 1, 0.7109, 0.0234, 1, 0.74, 0.25, 258, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__del__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __del__(self):\n \"Destroys this DataStructure object.\"\n if self._ptr: capi.destroy_ds(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Expr_L91_C8", "label": "expression", "type": "expression", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L90_C4", "vector": [8, 2, 0.7109, 0.0078, 2, 0.36, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Destroys this DataStructure object.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L92_C8", "label": "if", "type": "if", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L90_C4", "vector": [4, 2, 0.7188, 0.0078, 2, 0.36, 1.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._ptr: capi.destroy_ds(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Expr_L92_C22", "label": "destroy_ds()", "type": "expression", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L92_C8", "vector": [8, 3, 0.7188, 0.0078, 3, 0.7, 0.0, 709, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "destroy_ds", "arg_names": [], "import_names": [], "rhs_call_name": "destroy_ds", "annotation": ""}, "snippet": " if self._ptr: capi.destroy_ds(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L94_C4", "label": "__iter__", "type": "function", "loc": [94, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:ClassDef_L52_C0", "vector": [2, 1, 0.7461, 0.0312, 1, 0.74, 0.375, 891, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n \"Allows for iteration over the layers in a data source.\"\n for i in xrange(self.layer_count):\n yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Expr_L95_C8", "label": "expression", "type": "expression", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L94_C4", "vector": [8, 2, 0.7422, 0.0078, 2, 0.29, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Allows for iteration over the layers in a data source.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:For_L96_C8", "label": "for i", "type": "for", "loc": [96, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L94_C4", "vector": [6, 2, 0.7539, 0.0156, 2, 0.29, 1.0, 826, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange(self.layer_count):\n yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Expr_L97_C12", "label": "expression", "type": "expression", "loc": [97, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:For_L96_C8", "vector": [8, 3, 0.7578, 0.0078, 3, 0.7, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L99_C4", "label": "__getitem__", "type": "function", "loc": [99, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:ClassDef_L52_C0", "vector": [2, 1, 0.8164, 0.0938, 1, 0.74, 0.5, 698, 0, 2, 1, 0, 0, 0, 9], "semantic": {"name": "__getitem__", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getitem__(self, index):\n \"Allows use of the index [] operator to get a layer at the index.\"\n if isinstance(index, basestring):\n l = capi.get_layer_by_name(self.ptr, index)\n if not l: raise OGRIndexError('invalid OGR Layer name given: \"%s\"' % index)\n elif isinstance(index, int):\n if index < 0 or index >= self.layer_count:\n raise OGRIndexError('index out of range')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Expr_L100_C8", "label": "expression", "type": "expression", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L99_C4", "vector": [8, 2, 0.7812, 0.0078, 2, 0.24, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Allows use of the index [] operator to get a layer at the index.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L101_C8", "label": "if", "type": "if", "loc": [101, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L99_C4", "vector": [4, 2, 0.8203, 0.0703, 2, 0.24, 0.5, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(index, basestring):\n l = capi.get_layer_by_name(self.ptr, index)\n if not l: raise OGRIndexError('invalid OGR Layer name given: \"%s\"' % index)\n elif isinstance(index, int):\n if index < 0 or index >= self.layer_count:\n raise OGRIndexError('index out of range')\n l = capi.get_layer(self._ptr, index)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Assign_L102_C12", "label": "l = get_layer_by_name()", "type": "assigned_variable", "loc": [102, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L101_C8", "vector": [14, 3, 0.7969, 0.0078, 3, 0.72, 0.0, 810, 3, 2, 0, 0, 153, 10, 1], "semantic": {"name": "l", "arg_names": [], "import_names": [], "rhs_call_name": "get_layer_by_name", "annotation": ""}, "snippet": " l = capi.get_layer_by_name(self.ptr, index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L103_C12", "label": "if", "type": "if", "loc": [103, 103], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L101_C8", "vector": [4, 3, 0.8047, 0.0078, 3, 0.72, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not l: raise OGRIndexError('invalid OGR Layer name given: \"%s\"' % index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L104_C8", "label": "if", "type": "if", "loc": [104, 109], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L101_C8", "vector": [4, 3, 0.832, 0.0469, 3, 0.72, 1.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(index, int):\n if index < 0 or index >= self.layer_count:\n raise OGRIndexError('index out of range')\n l = capi.get_layer(self._ptr, index)\n else:\n raise TypeError('Invalid index type: %s' % type(index))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L105_C12", "label": "if", "type": "if", "loc": [105, 106], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L104_C8", "vector": [4, 4, 0.8242, 0.0156, 4, 0.1, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if index < 0 or index >= self.layer_count:\n raise OGRIndexError('index out of range')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Assign_L107_C12", "label": "l = get_layer()", "type": "assigned_variable", "loc": [107, 107], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L104_C8", "vector": [14, 4, 0.8359, 0.0078, 4, 0.1, 1.0, 810, 3, 2, 0, 0, 369, 10, 1], "semantic": {"name": "l", "arg_names": [], "import_names": [], "rhs_call_name": "get_layer", "annotation": ""}, "snippet": " l = capi.get_layer(self._ptr, index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Return_L110_C8", "label": "return", "type": "return", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L99_C4", "vector": [13, 2, 0.8594, 0.0078, 2, 0.24, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Layer(l, self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L112_C4", "label": "__len__", "type": "function", "loc": [112, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:ClassDef_L52_C0", "vector": [2, 1, 0.8828, 0.0234, 1, 0.74, 0.625, 76, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__len__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __len__(self):\n \"Returns the number of layers within the data source.\"\n return self.layer_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Expr_L113_C8", "label": "expression", "type": "expression", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L112_C4", "vector": [8, 2, 0.8828, 0.0078, 2, 0.95, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the number of layers within the data source.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Return_L114_C8", "label": "return", "type": "return", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L112_C4", "vector": [13, 2, 0.8906, 0.0078, 2, 0.95, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.layer_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L116_C4", "label": "__str__", "type": "function", "loc": [116, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:ClassDef_L52_C0", "vector": [2, 1, 0.9141, 0.0234, 1, 0.74, 0.75, 527, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n \"Returns OGR GetName and Driver for the Data Source.\"\n return '%s (%s)' % (self.name, str(self.driver))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Expr_L117_C8", "label": "expression", "type": "expression", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L116_C4", "vector": [8, 2, 0.9141, 0.0078, 2, 0.31, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns OGR GetName and Driver for the Data Source.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Return_L118_C8", "label": "return", "type": "return", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L116_C4", "vector": [13, 2, 0.9219, 0.0078, 2, 0.31, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s (%s)' % (self.name, str(self.driver))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L121_C4", "label": "layer_count", "type": "function", "loc": [121, 123], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:ClassDef_L52_C0", "vector": [2, 1, 0.9531, 0.0234, 1, 0.74, 0.875, 276, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "layer_count", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def layer_count(self):\n \"Returns the number of layers in the data source.\"\n return capi.get_layer_count(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Expr_L122_C8", "label": "expression", "type": "expression", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L121_C4", "vector": [8, 2, 0.9531, 0.0078, 2, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the number of layers in the data source.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Return_L123_C8", "label": "return", "type": "return", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L121_C4", "vector": [13, 2, 0.9609, 0.0078, 2, 0.75, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_layer_count(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L126_C4", "label": "name", "type": "function", "loc": [126, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:ClassDef_L52_C0", "vector": [2, 1, 0.9922, 0.0234, 1, 0.74, 1.0, 57, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def name(self):\n \"Returns the name of the data source.\"\n return capi.get_ds_name(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Expr_L127_C8", "label": "expression", "type": "expression", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L126_C4", "vector": [8, 2, 0.9922, 0.0078, 2, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the name of the data source.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98697:Return_L128_C8", "label": "return", "type": "return", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L126_C4", "vector": [13, 2, 1.0, 0.0078, 2, 0.43, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_ds_name(self._ptr)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98697:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Expr_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Assign_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Assign_L61_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L65_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Expr_L66_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L68_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Assign_L70_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L68_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Try_L71_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:Try_L71_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Assign_L73_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L68_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L78_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Assign_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L83_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Assign_L84_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L83_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Assign_L85_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L90_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Expr_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L90_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L92_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Expr_L92_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Expr_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:For_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:For_L96_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Expr_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Expr_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Assign_L102_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L103_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L104_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L105_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:If_L104_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Assign_L107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Return_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Expr_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Return_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Expr_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Return_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Expr_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Return_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Expr_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Return_L128_C8"}] |
"""
This module houses the OGR & SRS Exception objects, and the
check_err() routine which checks the status code returned by
OGR methods.
"""
#### OGR & SRS Exceptions ####
class GDALException(Exception): pass
class OGRException(Exception): pass
class SRSException(Exception): pass
class OGRIndexError(OGRException, KeyError):
"""
This exception is raised when an invalid index is encountered, and has
the 'silent_variable_feature' attribute set to true. This ensures that
django's templates proceed to use the next lookup type gracefully when
an Exception is raised. Fixes ticket #4740.
"""
silent_variable_failure = True
#### OGR error checking codes and routine ####
# OGR Error Codes
OGRERR_DICT = { 1 : (OGRException, 'Not enough data.'),
2 : (OGRException, 'Not enough memory.'),
3 : (OGRException, 'Unsupported geometry type.'),
4 : (OGRException, 'Unsupported operation.'),
5 : (OGRException, 'Corrupt data.'),
6 : (OGRException, 'OGR failure.'),
7 : (SRSException, 'Unsupported SRS.'),
8 : (OGRException, 'Invalid handle.'),
}
OGRERR_NONE = 0
def check_err(code):
"Checks the given OGRERR, and raises an exception where appropriate."
if code == OGRERR_NONE:
return
elif code in OGRERR_DICT:
e, msg = OGRERR_DICT[code]
raise e, msg
else:
raise OGRException('Unknown error code: "%s"' % code)
| ajibawa-2023/Python-Code-Large/train/row_98698 | 15 | 41 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98698:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0732, 0.122, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n This module houses the OGR & SRS Exception objects, and the\n check_err() routine which checks the status code returned by\n OGR methods.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98698:ClassDef_L7_C0", "label": "GDALException", "type": "class", "loc": [7, 7], "level": 0, "parent": null, "vector": [3, 0, 0.1707, 0.0244, 0, 0.66, 0.1429, 355, 0, 0, 0, 0, 645, 0, 0], "semantic": {"name": "GDALException", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GDALException(Exception): pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98698:ClassDef_L8_C0", "label": "OGRException", "type": "class", "loc": [8, 8], "level": 0, "parent": null, "vector": [3, 0, 0.1951, 0.0244, 0, 0.66, 0.2857, 521, 0, 0, 0, 0, 645, 0, 0], "semantic": {"name": "OGRException", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OGRException(Exception): pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98698:ClassDef_L9_C0", "label": "SRSException", "type": "class", "loc": [9, 9], "level": 0, "parent": null, "vector": [3, 0, 0.2195, 0.0244, 0, 0.66, 0.4286, 258, 0, 0, 0, 0, 645, 0, 0], "semantic": {"name": "SRSException", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SRSException(Exception): pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98698:ClassDef_L10_C0", "label": "OGRIndexError", "type": "class", "loc": [10, 17], "level": 0, "parent": null, "vector": [3, 0, 0.3293, 0.1951, 0, 0.66, 0.5714, 288, 0, 0, 0, 0, 521, 0, 0], "semantic": {"name": "OGRIndexError", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OGRIndexError(OGRException, KeyError):\n \"\"\"\n This exception is raised when an invalid index is encountered, and has\n the 'silent_variable_feature' attribute set to true. This ensures that\n django's templates proceed to use the next lookup type gracefully when\n an Exception is raised. Fixes ticket #4740.\n \"\"\"\n silent_variable_failure = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98698:Expr_L11_C4", "label": "expression", "type": "expression", "loc": [11, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98698:ClassDef_L10_C0", "vector": [8, 1, 0.3293, 0.1463, 1, 0.36, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n This exception is raised when an invalid index is encountered, and has\n the 'silent_variable_feature' attribute set to true. This ensures that\n django's templates proceed to use the next lookup type gracefully when\n an Exception is raised. Fixes ticket #4740.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98698:Assign_L17_C4", "label": "silent_variable_failure =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98698:ClassDef_L10_C0", "vector": [14, 1, 0.4146, 0.0244, 1, 0.36, 1.0, 884, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "silent_variable_failure", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " silent_variable_failure = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98698:Assign_L22_C0", "label": "OGRERR_DICT =", "type": "assigned_variable", "loc": [22, 30], "level": 0, "parent": null, "vector": [14, 0, 0.6341, 0.2195, 0, 0.66, 0.7143, 981, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "OGRERR_DICT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "OGRERR_DICT = { 1 : (OGRException, 'Not enough data.'),\n 2 : (OGRException, 'Not enough memory.'),\n 3 : (OGRException, 'Unsupported geometry type.'),\n 4 : (OGRException, 'Unsupported operation.'),\n 5 : (OGRException, 'Corrupt data.'),\n 6 : (OGRException, 'OGR failure.'),\n 7 : (SRSException, 'Unsupported SRS.'),\n 8 : (OGRException, 'Invalid handle.'),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98698:Assign_L31_C0", "label": "OGRERR_NONE =", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.7561, 0.0244, 0, 0.66, 0.8571, 607, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "OGRERR_NONE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "OGRERR_NONE = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98698:FunctionDef_L33_C0", "label": "check_err", "type": "function", "loc": [33, 41], "level": 0, "parent": null, "vector": [2, 0, 0.9024, 0.2195, 0, 0.66, 1.0, 825, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "check_err", "arg_names": ["code"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_err(code):\n \"Checks the given OGRERR, and raises an exception where appropriate.\"\n \n if code == OGRERR_NONE:\n return\n elif code in OGRERR_DICT:\n e, msg = OGRERR_DICT[code]\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98698:Expr_L34_C4", "label": "expression", "type": "expression", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98698:FunctionDef_L33_C0", "vector": [8, 1, 0.8293, 0.0244, 1, 0.03, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Checks the given OGRERR, and raises an exception where appropriate.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98698:If_L36_C4", "label": "if", "type": "if", "loc": [36, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98698:FunctionDef_L33_C0", "vector": [4, 1, 0.939, 0.1463, 1, 0.03, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if code == OGRERR_NONE:\n return\n elif code in OGRERR_DICT:\n e, msg = OGRERR_DICT[code]\n else:\n raise OGRException('Unknown error code: \"%s\"' % code)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98698:Return_L37_C8", "label": "return", "type": "return", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98698:If_L36_C4", "vector": [13, 2, 0.9024, 0.0244, 2, 0.34, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98698:If_L38_C4", "label": "if", "type": "if", "loc": [38, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98698:If_L36_C4", "vector": [4, 2, 0.9634, 0.0976, 2, 0.34, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif code in OGRERR_DICT:\n e, msg = OGRERR_DICT[code]\n else:\n raise OGRException('Unknown error code: \"%s\"' % code)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98698:Assign_L39_C8", "label": "e, msg =", "type": "assigned_variable", "loc": [39, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98698:If_L38_C4", "vector": [14, 3, 0.9512, 0.0244, 3, 0.71, 0.0, 677, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "e, msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " e, msg = OGRERR_DICT[code]"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98698:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98698:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98698:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98698:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98698:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98698:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98698:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98698:If_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98698:If_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98698:Return_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98698:If_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98698:If_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98698:If_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98698:Assign_L39_C8"}] |
from ctypes import byref, c_int
from datetime import date, datetime, time
from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.error import OGRException
from django.contrib.gis.gdal.prototypes import ds as capi
# For more information, see the OGR C API source code:
# http://www.gdal.org/ogr/ogr__api_8h.html
#
# The OGR_Fld_* routines are relevant here.
class Field(GDALBase):
"A class that wraps an OGR Field, needs to be instantiated from a Feature object."
#### Python 'magic' routines ####
def __init__(self, feat, index):
"""
Initializes on the feature pointer and the integer index of
the field within the feature.
"""
# Setting the feature pointer and index.
self._feat = feat
self._index = index
# Getting the pointer for this field.
fld_ptr = capi.get_feat_field_defn(feat, index)
if not fld_ptr:
raise OGRException('Cannot create OGR Field, invalid pointer given.')
self.ptr = fld_ptr
# Setting the class depending upon the OGR Field Type (OFT)
self.__class__ = OGRFieldTypes[self.type]
# OFTReal with no precision should be an OFTInteger.
if isinstance(self, OFTReal) and self.precision == 0:
self.__class__ = OFTInteger
def __str__(self):
"Returns the string representation of the Field."
return str(self.value).strip()
#### Field Methods ####
def as_double(self):
"Retrieves the Field's value as a double (float)."
return capi.get_field_as_double(self._feat, self._index)
def as_int(self):
"Retrieves the Field's value as an integer."
return capi.get_field_as_integer(self._feat, self._index)
def as_string(self):
"Retrieves the Field's value as a string."
return capi.get_field_as_string(self._feat, self._index)
def as_datetime(self):
"Retrieves the Field's value as a tuple of date & time components."
yy, mm, dd, hh, mn, ss, tz = [c_int() for i in range(7)]
status = capi.get_field_as_datetime(self._feat, self._index, byref(yy), byref(mm), byref(dd),
byref(hh), byref(mn), byref(ss), byref(tz))
if status:
return (yy, mm, dd, hh, mn, ss, tz)
else:
raise OGRException('Unable to retrieve date & time information from the field.')
#### Field Properties ####
@property
def name(self):
"Returns the name of this Field."
return capi.get_field_name(self.ptr)
@property
def precision(self):
"Returns the precision of this Field."
return capi.get_field_precision(self.ptr)
@property
def type(self):
"Returns the OGR type of this Field."
return capi.get_field_type(self.ptr)
@property
def type_name(self):
"Return the OGR field type name for this Field."
return capi.get_field_type_name(self.type)
@property
def value(self):
"Returns the value of this Field."
# Default is to get the field as a string.
return self.as_string()
@property
def width(self):
"Returns the width of this Field."
return capi.get_field_width(self.ptr)
### The Field sub-classes for each OGR Field type. ###
class OFTInteger(Field):
@property
def value(self):
"Returns an integer contained in this field."
return self.as_int()
@property
def type(self):
"""
GDAL uses OFTReals to represent OFTIntegers in created
shapefiles -- forcing the type here since the underlying field
type may actually be OFTReal.
"""
return 0
class OFTReal(Field):
@property
def value(self):
"Returns a float contained in this field."
return self.as_double()
# String & Binary fields, just subclasses
class OFTString(Field): pass
class OFTWideString(Field): pass
class OFTBinary(Field): pass
# OFTDate, OFTTime, OFTDateTime fields.
class OFTDate(Field):
@property
def value(self):
"Returns a Python `date` object for the OFTDate field."
try:
yy, mm, dd, hh, mn, ss, tz = self.as_datetime()
return date(yy.value, mm.value, dd.value)
except (ValueError, OGRException):
return None
class OFTDateTime(Field):
@property
def value(self):
"Returns a Python `datetime` object for this OFTDateTime field."
# TODO: Adapt timezone information.
# See http://lists.maptools.org/pipermail/gdal-dev/2006-February/007990.html
# The `tz` variable has values of: 0=unknown, 1=localtime (ambiguous),
# 100=GMT, 104=GMT+1, 80=GMT-5, etc.
try:
yy, mm, dd, hh, mn, ss, tz = self.as_datetime()
return datetime(yy.value, mm.value, dd.value, hh.value, mn.value, ss.value)
except (ValueError, OGRException):
return None
class OFTTime(Field):
@property
def value(self):
"Returns a Python `time` object for this OFTTime field."
try:
yy, mm, dd, hh, mn, ss, tz = self.as_datetime()
return time(hh.value, mn.value, ss.value)
except (ValueError, OGRException):
return None
# List fields are also just subclasses
class OFTIntegerList(Field): pass
class OFTRealList(Field): pass
class OFTStringList(Field): pass
class OFTWideStringList(Field): pass
# Class mapping dictionary for OFT Types and reverse mapping.
OGRFieldTypes = { 0 : OFTInteger,
1 : OFTIntegerList,
2 : OFTReal,
3 : OFTRealList,
4 : OFTString,
5 : OFTStringList,
6 : OFTWideString,
7 : OFTWideStringList,
8 : OFTBinary,
9 : OFTDate,
10 : OFTTime,
11 : OFTDateTime,
}
ROGRFieldTypes = dict([(cls, num) for num, cls in OGRFieldTypes.items()])
| ajibawa-2023/Python-Code-Large/train/row_98699 | 94 | 178 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98699:ImportFrom_L1_C0", "label": "from ctypes import byref, c_int", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0056, 0.0056, 0, 0.66, 0.0, 182, 0, 2, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["byref", "c_int"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import byref, c_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:ImportFrom_L2_C0", "label": "from datetime import date, datetime, time", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0112, 0.0056, 0, 0.66, 0.0526, 426, 0, 3, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["date", "datetime", "time"], "rhs_call_name": "", "annotation": ""}, "snippet": "from datetime import date, datetime, time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:ImportFrom_L3_C0", "label": "from django.contrib.gis.gdal.base import GDALBase", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0169, 0.0056, 0, 0.66, 0.1053, 771, 0, 1, 0, 0, 771, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.base", "arg_names": [], "import_names": ["GDALBase"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.base import GDALBase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:ImportFrom_L4_C0", "label": "from django.contrib.gis.gdal.error import OGRException", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0225, 0.0056, 0, 0.66, 0.1579, 76, 0, 1, 0, 0, 76, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.error", "arg_names": [], "import_names": ["OGRException"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.error import OGRException"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:ImportFrom_L5_C0", "label": "from django.contrib.gis.gdal.prototypes import capi", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0281, 0.0056, 0, 0.66, 0.2105, 730, 0, 1, 0, 0, 730, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.prototypes", "arg_names": [], "import_names": ["capi"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.prototypes import ds as capi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "label": "Field", "type": "class", "loc": [11, 94], "level": 0, "parent": null, "vector": [3, 0, 0.2949, 0.4719, 0, 0.66, 0.2632, 949, 0, 12, 0, 0, 436, 0, 25], "semantic": {"name": "Field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Field(GDALBase):\n \"A class that wraps an OGR Field, needs to be instantiated from a Feature object.\"\n\n #### Python 'magic' routines ####\n def __init__(self, feat, index):\n \"\"\"\n Initializes on the feature pointer and the integer index of\n the field within the feature."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L12_C4", "label": "expression", "type": "expression", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "vector": [8, 1, 0.0674, 0.0056, 1, 0.1, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"A class that wraps an OGR Field, needs to be instantiated from a Feature object.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L15_C4", "label": "__init__", "type": "function", "loc": [15, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "vector": [2, 1, 0.1404, 0.118, 1, 0.1, 0.0833, 555, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "feat", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, feat, index):\n \"\"\"\n Initializes on the feature pointer and the integer index of\n the field within the feature.\n \"\"\"\n # Setting the feature pointer and index.\n self._feat = feat\n self._index = index"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L16_C8", "label": "expression", "type": "expression", "loc": [16, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L15_C4", "vector": [8, 2, 0.0983, 0.0225, 2, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Initializes on the feature pointer and the integer index of\n the field within the feature.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Assign_L21_C8", "label": "self._feat =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L15_C4", "vector": [14, 2, 0.118, 0.0056, 2, 0.49, 0.1429, 392, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._feat", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._feat = feat"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Assign_L22_C8", "label": "self._index =", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L15_C4", "vector": [14, 2, 0.1236, 0.0056, 2, 0.49, 0.2857, 679, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._index = index"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Assign_L25_C8", "label": "fld_ptr = get_feat_field_defn()", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L15_C4", "vector": [14, 2, 0.1404, 0.0056, 2, 0.49, 0.4286, 595, 3, 2, 0, 0, 100, 10, 1], "semantic": {"name": "fld_ptr", "arg_names": [], "import_names": [], "rhs_call_name": "get_feat_field_defn", "annotation": ""}, "snippet": " fld_ptr = capi.get_feat_field_defn(feat, index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:If_L26_C8", "label": "if", "type": "if", "loc": [26, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L15_C4", "vector": [4, 2, 0.1489, 0.0112, 2, 0.49, 0.5714, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not fld_ptr:\n raise OGRException('Cannot create OGR Field, invalid pointer given.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Assign_L28_C8", "label": "self.ptr =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L15_C4", "vector": [14, 2, 0.1573, 0.0056, 2, 0.49, 0.7143, 386, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.ptr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ptr = fld_ptr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Assign_L31_C8", "label": "self.__class__ =", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L15_C4", "vector": [14, 2, 0.1742, 0.0056, 2, 0.49, 0.8571, 366, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.__class__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__class__ = OGRFieldTypes[self.type]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:If_L34_C8", "label": "if", "type": "if", "loc": [34, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L15_C4", "vector": [4, 2, 0.1938, 0.0112, 2, 0.49, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(self, OFTReal) and self.precision == 0:\n self.__class__ = OFTInteger"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Assign_L35_C12", "label": "self.__class__ =", "type": "assigned_variable", "loc": [35, 35], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:If_L34_C8", "vector": [14, 3, 0.1966, 0.0056, 3, 0.83, 0.0, 366, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.__class__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__class__ = OFTInteger"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L37_C4", "label": "__str__", "type": "function", "loc": [37, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "vector": [2, 1, 0.2135, 0.0169, 1, 0.1, 0.1667, 527, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n \"Returns the string representation of the Field.\"\n return str(self.value).strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L38_C8", "label": "expression", "type": "expression", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L37_C4", "vector": [8, 2, 0.2135, 0.0056, 2, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the string representation of the Field.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L39_C8", "label": "return", "type": "return", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L37_C4", "vector": [13, 2, 0.2191, 0.0056, 2, 0.85, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str(self.value).strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L42_C4", "label": "as_double", "type": "function", "loc": [42, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "vector": [2, 1, 0.2416, 0.0169, 1, 0.1, 0.25, 182, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "as_double", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def as_double(self):\n \"Retrieves the Field's value as a double (float).\"\n return capi.get_field_as_double(self._feat, self._index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L43_C8", "label": "expression", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L42_C4", "vector": [8, 2, 0.2416, 0.0056, 2, 0.19, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Retrieves the Field's value as a double (float).\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L44_C8", "label": "return", "type": "return", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L42_C4", "vector": [13, 2, 0.2472, 0.0056, 2, 0.19, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_field_as_double(self._feat, self._index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L46_C4", "label": "as_int", "type": "function", "loc": [46, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "vector": [2, 1, 0.264, 0.0169, 1, 0.1, 0.3333, 93, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "as_int", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def as_int(self):\n \"Retrieves the Field's value as an integer.\"\n return capi.get_field_as_integer(self._feat, self._index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L47_C8", "label": "expression", "type": "expression", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L46_C4", "vector": [8, 2, 0.264, 0.0056, 2, 0.01, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Retrieves the Field's value as an integer.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L48_C8", "label": "return", "type": "return", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L46_C4", "vector": [13, 2, 0.2697, 0.0056, 2, 0.01, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_field_as_integer(self._feat, self._index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L50_C4", "label": "as_string", "type": "function", "loc": [50, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "vector": [2, 1, 0.2865, 0.0169, 1, 0.1, 0.4167, 220, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "as_string", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def as_string(self):\n \"Retrieves the Field's value as a string.\"\n return capi.get_field_as_string(self._feat, self._index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L51_C8", "label": "expression", "type": "expression", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L50_C4", "vector": [8, 2, 0.2865, 0.0056, 2, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Retrieves the Field's value as a string.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L52_C8", "label": "return", "type": "return", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L50_C4", "vector": [13, 2, 0.2921, 0.0056, 2, 0.07, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_field_as_string(self._feat, self._index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L54_C4", "label": "as_datetime", "type": "function", "loc": [54, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "vector": [2, 1, 0.3258, 0.0506, 1, 0.1, 0.5, 791, 0, 1, 1, 0, 0, 0, 11], "semantic": {"name": "as_datetime", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def as_datetime(self):\n \"Retrieves the Field's value as a tuple of date & time components.\"\n yy, mm, dd, hh, mn, ss, tz = [c_int() for i in range(7)]\n status = capi.get_field_as_datetime(self._feat, self._index, byref(yy), byref(mm), byref(dd),\n byref(hh), byref(mn), byref(ss), byref(tz))\n if status:\n return (yy, mm, dd, hh, mn, ss, tz)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L55_C8", "label": "expression", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L54_C4", "vector": [8, 2, 0.309, 0.0056, 2, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Retrieves the Field's value as a tuple of date & time components.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Assign_L56_C8", "label": "yy, mm, dd, hh, mn, ss, tz =", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L54_C4", "vector": [14, 2, 0.3146, 0.0056, 2, 0.07, 0.3333, 331, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "yy, mm, dd, hh, mn, ss, tz", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yy, mm, dd, hh, mn, ss, tz = [c_int() for i in range(7)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Assign_L57_C8", "label": "status = get_field_as_datetime()", "type": "assigned_variable", "loc": [57, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L54_C4", "vector": [14, 2, 0.323, 0.0112, 2, 0.07, 0.6667, 699, 3, 9, 0, 0, 722, 10, 8], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "get_field_as_datetime", "annotation": ""}, "snippet": " status = capi.get_field_as_datetime(self._feat, self._index, byref(yy), byref(mm), byref(dd),\n byref(hh), byref(mn), byref(ss), byref(tz))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:If_L59_C8", "label": "if", "type": "if", "loc": [59, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L54_C4", "vector": [4, 2, 0.3399, 0.0225, 2, 0.07, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if status:\n return (yy, mm, dd, hh, mn, ss, tz)\n else:\n raise OGRException('Unable to retrieve date & time information from the field.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L60_C12", "label": "return", "type": "return", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:If_L59_C8", "vector": [13, 3, 0.3371, 0.0056, 3, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (yy, mm, dd, hh, mn, ss, tz)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L66_C4", "label": "name", "type": "function", "loc": [66, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "vector": [2, 1, 0.3764, 0.0169, 1, 0.1, 0.5833, 57, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def name(self):\n \"Returns the name of this Field.\"\n return capi.get_field_name(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L67_C8", "label": "expression", "type": "expression", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L66_C4", "vector": [8, 2, 0.3764, 0.0056, 2, 0.14, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the name of this Field.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L68_C8", "label": "return", "type": "return", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L66_C4", "vector": [13, 2, 0.382, 0.0056, 2, 0.14, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_field_name(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L71_C4", "label": "precision", "type": "function", "loc": [71, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "vector": [2, 1, 0.4045, 0.0169, 1, 0.1, 0.6667, 850, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "precision", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def precision(self):\n \"Returns the precision of this Field.\"\n return capi.get_field_precision(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L72_C8", "label": "expression", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L71_C4", "vector": [8, 2, 0.4045, 0.0056, 2, 0.3, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the precision of this Field.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L73_C8", "label": "return", "type": "return", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L71_C4", "vector": [13, 2, 0.4101, 0.0056, 2, 0.3, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_field_precision(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L76_C4", "label": "type", "type": "function", "loc": [76, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "vector": [2, 1, 0.4326, 0.0169, 1, 0.1, 0.75, 801, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "type", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def type(self):\n \"Returns the OGR type of this Field.\"\n return capi.get_field_type(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L77_C8", "label": "expression", "type": "expression", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L76_C4", "vector": [8, 2, 0.4326, 0.0056, 2, 0.09, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the OGR type of this Field.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L78_C8", "label": "return", "type": "return", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L76_C4", "vector": [13, 2, 0.4382, 0.0056, 2, 0.09, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_field_type(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L81_C4", "label": "type_name", "type": "function", "loc": [81, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "vector": [2, 1, 0.4607, 0.0169, 1, 0.1, 0.8333, 81, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "type_name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def type_name(self):\n \"Return the OGR field type name for this Field.\"\n return capi.get_field_type_name(self.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L82_C8", "label": "expression", "type": "expression", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L81_C4", "vector": [8, 2, 0.4607, 0.0056, 2, 0.0, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Return the OGR field type name for this Field.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L83_C8", "label": "return", "type": "return", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L81_C4", "vector": [13, 2, 0.4663, 0.0056, 2, 0.0, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_field_type_name(self.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L86_C4", "label": "value", "type": "function", "loc": [86, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "vector": [2, 1, 0.4916, 0.0225, 1, 0.1, 0.9167, 441, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "value", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def value(self):\n \"Returns the value of this Field.\"\n # Default is to get the field as a string.\n return self.as_string()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L87_C8", "label": "expression", "type": "expression", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L86_C4", "vector": [8, 2, 0.4888, 0.0056, 2, 0.36, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the value of this Field.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L89_C8", "label": "return", "type": "return", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L86_C4", "vector": [13, 2, 0.5, 0.0056, 2, 0.36, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.as_string()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L92_C4", "label": "width", "type": "function", "loc": [92, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "vector": [2, 1, 0.5225, 0.0169, 1, 0.1, 1.0, 989, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "width", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def width(self):\n \"Returns the width of this Field.\"\n return capi.get_field_width(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L93_C8", "label": "expression", "type": "expression", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L92_C4", "vector": [8, 2, 0.5225, 0.0056, 2, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the width of this Field.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L94_C8", "label": "return", "type": "return", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L92_C4", "vector": [13, 2, 0.5281, 0.0056, 2, 0.57, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_field_width(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L97_C0", "label": "OFTInteger", "type": "class", "loc": [97, 110], "level": 0, "parent": null, "vector": [3, 0, 0.5815, 0.0787, 0, 0.66, 0.3158, 870, 0, 2, 0, 0, 949, 0, 1], "semantic": {"name": "OFTInteger", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OFTInteger(Field):\n @property\n def value(self):\n \"Returns an integer contained in this field.\"\n return self.as_int()\n\n @property\n def type(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L99_C4", "label": "value", "type": "function", "loc": [99, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L97_C0", "vector": [2, 1, 0.5618, 0.0169, 1, 0.3, 0.0, 441, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "value", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def value(self):\n \"Returns an integer contained in this field.\"\n return self.as_int()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L100_C8", "label": "expression", "type": "expression", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L99_C4", "vector": [8, 2, 0.5618, 0.0056, 2, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns an integer contained in this field.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L101_C8", "label": "return", "type": "return", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L99_C4", "vector": [13, 2, 0.5674, 0.0056, 2, 0.05, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.as_int()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L104_C4", "label": "type", "type": "function", "loc": [104, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L97_C0", "vector": [2, 1, 0.6011, 0.0393, 1, 0.3, 1.0, 801, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "type", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def type(self):\n \"\"\"\n GDAL uses OFTReals to represent OFTIntegers in created\n shapefiles -- forcing the type here since the underlying field\n type may actually be OFTReal.\n \"\"\"\n return 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L105_C8", "label": "expression", "type": "expression", "loc": [105, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L104_C4", "vector": [8, 2, 0.6011, 0.0281, 2, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n GDAL uses OFTReals to represent OFTIntegers in created\n shapefiles -- forcing the type here since the underlying field\n type may actually be OFTReal.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L110_C8", "label": "return", "type": "return", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L104_C4", "vector": [13, 2, 0.618, 0.0056, 2, 0.57, 1.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L112_C0", "label": "OFTReal", "type": "class", "loc": [112, 116], "level": 0, "parent": null, "vector": [3, 0, 0.6404, 0.0281, 0, 0.66, 0.3684, 344, 0, 1, 0, 0, 949, 0, 1], "semantic": {"name": "OFTReal", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OFTReal(Field):\n @property\n def value(self):\n \"Returns a float contained in this field.\"\n return self.as_double()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L114_C4", "label": "value", "type": "function", "loc": [114, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L112_C0", "vector": [2, 1, 0.6461, 0.0169, 1, 0.24, 0.0, 441, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "value", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def value(self):\n \"Returns a float contained in this field.\"\n return self.as_double()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L115_C8", "label": "expression", "type": "expression", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L114_C4", "vector": [8, 2, 0.6461, 0.0056, 2, 0.71, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a float contained in this field.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L116_C8", "label": "return", "type": "return", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L114_C4", "vector": [13, 2, 0.6517, 0.0056, 2, 0.71, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.as_double()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L119_C0", "label": "OFTString", "type": "class", "loc": [119, 119], "level": 0, "parent": null, "vector": [3, 0, 0.6685, 0.0056, 0, 0.66, 0.4211, 434, 0, 0, 0, 0, 949, 0, 0], "semantic": {"name": "OFTString", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OFTString(Field): pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L120_C0", "label": "OFTWideString", "type": "class", "loc": [120, 120], "level": 0, "parent": null, "vector": [3, 0, 0.6742, 0.0056, 0, 0.66, 0.4737, 840, 0, 0, 0, 0, 949, 0, 0], "semantic": {"name": "OFTWideString", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OFTWideString(Field): pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L121_C0", "label": "OFTBinary", "type": "class", "loc": [121, 121], "level": 0, "parent": null, "vector": [3, 0, 0.6798, 0.0056, 0, 0.66, 0.5263, 791, 0, 0, 0, 0, 949, 0, 0], "semantic": {"name": "OFTBinary", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OFTBinary(Field): pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L124_C0", "label": "OFTDate", "type": "class", "loc": [124, 132], "level": 0, "parent": null, "vector": [3, 0, 0.7191, 0.0506, 0, 0.66, 0.5789, 375, 0, 1, 0, 0, 949, 0, 2], "semantic": {"name": "OFTDate", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OFTDate(Field):\n @property\n def value(self):\n \"Returns a Python `date` object for the OFTDate field.\"\n try:\n yy, mm, dd, hh, mn, ss, tz = self.as_datetime()\n return date(yy.value, mm.value, dd.value)\n except (ValueError, OGRException):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L126_C4", "label": "value", "type": "function", "loc": [126, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L124_C0", "vector": [2, 1, 0.7247, 0.0393, 1, 0.51, 0.0, 441, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "value", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def value(self):\n \"Returns a Python `date` object for the OFTDate field.\"\n try:\n yy, mm, dd, hh, mn, ss, tz = self.as_datetime()\n return date(yy.value, mm.value, dd.value)\n except (ValueError, OGRException):\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L127_C8", "label": "expression", "type": "expression", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L126_C4", "vector": [8, 2, 0.7135, 0.0056, 2, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a Python `date` object for the OFTDate field.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Try_L128_C8", "label": "try", "type": "try", "loc": [128, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L126_C4", "vector": [7, 2, 0.7303, 0.0281, 2, 0.25, 1.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n yy, mm, dd, hh, mn, ss, tz = self.as_datetime()\n return date(yy.value, mm.value, dd.value)\n except (ValueError, OGRException):\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Assign_L129_C12", "label": "yy, mm, dd, hh, mn, ss, tz = as_datetime()", "type": "assigned_variable", "loc": [129, 129], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:Try_L128_C8", "vector": [14, 3, 0.7247, 0.0056, 3, 0.55, 0.0, 331, 3, 0, 0, 0, 791, 10, 1], "semantic": {"name": "yy, mm, dd, hh, mn, ss, tz", "arg_names": [], "import_names": [], "rhs_call_name": "as_datetime", "annotation": ""}, "snippet": " yy, mm, dd, hh, mn, ss, tz = self.as_datetime()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L130_C12", "label": "return", "type": "return", "loc": [130, 130], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:Try_L128_C8", "vector": [13, 3, 0.7303, 0.0056, 3, 0.55, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return date(yy.value, mm.value, dd.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L132_C12", "label": "return", "type": "return", "loc": [132, 132], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:Try_L128_C8", "vector": [13, 3, 0.7416, 0.0056, 3, 0.55, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L134_C0", "label": "OFTDateTime", "type": "class", "loc": [134, 146], "level": 0, "parent": null, "vector": [3, 0, 0.7865, 0.073, 0, 0.66, 0.6316, 237, 0, 1, 0, 0, 949, 0, 2], "semantic": {"name": "OFTDateTime", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OFTDateTime(Field):\n @property\n def value(self):\n \"Returns a Python `datetime` object for this OFTDateTime field.\"\n # TODO: Adapt timezone information.\n # See http://lists.maptools.org/pipermail/gdal-dev/2006-February/007990.html\n # The `tz` variable has values of: 0=unknown, 1=localtime (ambiguous), \n # 100=GMT, 104=GMT+1, 80=GMT-5, etc."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L136_C4", "label": "value", "type": "function", "loc": [136, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L134_C0", "vector": [2, 1, 0.7921, 0.0618, 1, 0.83, 0.0, 441, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "value", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def value(self):\n \"Returns a Python `datetime` object for this OFTDateTime field.\"\n # TODO: Adapt timezone information.\n # See http://lists.maptools.org/pipermail/gdal-dev/2006-February/007990.html\n # The `tz` variable has values of: 0=unknown, 1=localtime (ambiguous), \n # 100=GMT, 104=GMT+1, 80=GMT-5, etc.\n try:\n yy, mm, dd, hh, mn, ss, tz = self.as_datetime()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L137_C8", "label": "expression", "type": "expression", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L136_C4", "vector": [8, 2, 0.7697, 0.0056, 2, 0.29, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a Python `datetime` object for this OFTDateTime field.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Try_L142_C8", "label": "try", "type": "try", "loc": [142, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L136_C4", "vector": [7, 2, 0.809, 0.0281, 2, 0.29, 1.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n yy, mm, dd, hh, mn, ss, tz = self.as_datetime()\n return datetime(yy.value, mm.value, dd.value, hh.value, mn.value, ss.value)\n except (ValueError, OGRException):\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Assign_L143_C12", "label": "yy, mm, dd, hh, mn, ss, tz = as_datetime()", "type": "assigned_variable", "loc": [143, 143], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:Try_L142_C8", "vector": [14, 3, 0.8034, 0.0056, 3, 0.06, 0.0, 331, 3, 0, 0, 0, 791, 10, 1], "semantic": {"name": "yy, mm, dd, hh, mn, ss, tz", "arg_names": [], "import_names": [], "rhs_call_name": "as_datetime", "annotation": ""}, "snippet": " yy, mm, dd, hh, mn, ss, tz = self.as_datetime()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L144_C12", "label": "return", "type": "return", "loc": [144, 144], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:Try_L142_C8", "vector": [13, 3, 0.809, 0.0056, 3, 0.06, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return datetime(yy.value, mm.value, dd.value, hh.value, mn.value, ss.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L146_C12", "label": "return", "type": "return", "loc": [146, 146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:Try_L142_C8", "vector": [13, 3, 0.8202, 0.0056, 3, 0.06, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L148_C0", "label": "OFTTime", "type": "class", "loc": [148, 156], "level": 0, "parent": null, "vector": [3, 0, 0.8539, 0.0506, 0, 0.66, 0.6842, 665, 0, 1, 0, 0, 949, 0, 2], "semantic": {"name": "OFTTime", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OFTTime(Field):\n @property\n def value(self):\n \"Returns a Python `time` object for this OFTTime field.\"\n try:\n yy, mm, dd, hh, mn, ss, tz = self.as_datetime()\n return time(hh.value, mn.value, ss.value)\n except (ValueError, OGRException):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L150_C4", "label": "value", "type": "function", "loc": [150, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L148_C0", "vector": [2, 1, 0.8596, 0.0393, 1, 0.9, 0.0, 441, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "value", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def value(self):\n \"Returns a Python `time` object for this OFTTime field.\"\n try:\n yy, mm, dd, hh, mn, ss, tz = self.as_datetime()\n return time(hh.value, mn.value, ss.value)\n except (ValueError, OGRException):\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L151_C8", "label": "expression", "type": "expression", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L150_C4", "vector": [8, 2, 0.8483, 0.0056, 2, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a Python `time` object for this OFTTime field.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Try_L152_C8", "label": "try", "type": "try", "loc": [152, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L150_C4", "vector": [7, 2, 0.8652, 0.0281, 2, 0.74, 1.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n yy, mm, dd, hh, mn, ss, tz = self.as_datetime()\n return time(hh.value, mn.value, ss.value)\n except (ValueError, OGRException):\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Assign_L153_C12", "label": "yy, mm, dd, hh, mn, ss, tz = as_datetime()", "type": "assigned_variable", "loc": [153, 153], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:Try_L152_C8", "vector": [14, 3, 0.8596, 0.0056, 3, 0.26, 0.0, 331, 3, 0, 0, 0, 791, 10, 1], "semantic": {"name": "yy, mm, dd, hh, mn, ss, tz", "arg_names": [], "import_names": [], "rhs_call_name": "as_datetime", "annotation": ""}, "snippet": " yy, mm, dd, hh, mn, ss, tz = self.as_datetime()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L154_C12", "label": "return", "type": "return", "loc": [154, 154], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:Try_L152_C8", "vector": [13, 3, 0.8652, 0.0056, 3, 0.26, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return time(hh.value, mn.value, ss.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L156_C12", "label": "return", "type": "return", "loc": [156, 156], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98699:Try_L152_C8", "vector": [13, 3, 0.8764, 0.0056, 3, 0.26, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L159_C0", "label": "OFTIntegerList", "type": "class", "loc": [159, 159], "level": 0, "parent": null, "vector": [3, 0, 0.8933, 0.0056, 0, 0.66, 0.7368, 335, 0, 0, 0, 0, 949, 0, 0], "semantic": {"name": "OFTIntegerList", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OFTIntegerList(Field): pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L160_C0", "label": "OFTRealList", "type": "class", "loc": [160, 160], "level": 0, "parent": null, "vector": [3, 0, 0.8989, 0.0056, 0, 0.66, 0.7895, 982, 0, 0, 0, 0, 949, 0, 0], "semantic": {"name": "OFTRealList", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OFTRealList(Field): pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L161_C0", "label": "OFTStringList", "type": "class", "loc": [161, 161], "level": 0, "parent": null, "vector": [3, 0, 0.9045, 0.0056, 0, 0.66, 0.8421, 122, 0, 0, 0, 0, 949, 0, 0], "semantic": {"name": "OFTStringList", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OFTStringList(Field): pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L162_C0", "label": "OFTWideStringList", "type": "class", "loc": [162, 162], "level": 0, "parent": null, "vector": [3, 0, 0.9101, 0.0056, 0, 0.66, 0.8947, 336, 0, 0, 0, 0, 949, 0, 0], "semantic": {"name": "OFTWideStringList", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OFTWideStringList(Field): pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Assign_L165_C0", "label": "OGRFieldTypes =", "type": "assigned_variable", "loc": [165, 177], "level": 0, "parent": null, "vector": [14, 0, 0.9607, 0.073, 0, 0.66, 0.9474, 218, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "OGRFieldTypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "OGRFieldTypes = { 0 : OFTInteger,\n 1 : OFTIntegerList,\n 2 : OFTReal,\n 3 : OFTRealList,\n 4 : OFTString,\n 5 : OFTStringList,\n 6 : OFTWideString,\n 7 : OFTWideStringList,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98699:Assign_L178_C0", "label": "ROGRFieldTypes = dict()", "type": "assigned_variable", "loc": [178, 178], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.0056, 0, 0.66, 1.0, 544, 3, 1, 0, 0, 827, 10, 2], "semantic": {"name": "ROGRFieldTypes", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": "ROGRFieldTypes = dict([(cls, num) for num, cls in OGRFieldTypes.items()])"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Assign_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:If_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:If_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:If_L34_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Assign_L35_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:If_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:If_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L60_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L76_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L76_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L97_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L97_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L112_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Try_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:Try_L128_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Assign_L129_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:Try_L128_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L130_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:Try_L128_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L132_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L134_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Try_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:Try_L142_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Assign_L143_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:Try_L142_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L144_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:Try_L142_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L146_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L148_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L150_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:FunctionDef_L150_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Try_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:Try_L152_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Assign_L153_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:Try_L152_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L154_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:Try_L152_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Return_L156_C12"}] |
# Needed ctypes routines
from ctypes import c_double, byref
# Other GDAL imports.
from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.envelope import Envelope, OGREnvelope
from django.contrib.gis.gdal.error import OGRException, OGRIndexError, SRSException
from django.contrib.gis.gdal.feature import Feature
from django.contrib.gis.gdal.field import OGRFieldTypes
from django.contrib.gis.gdal.geomtype import OGRGeomType
from django.contrib.gis.gdal.geometries import OGRGeometry
from django.contrib.gis.gdal.srs import SpatialReference
# GDAL ctypes function prototypes.
from django.contrib.gis.gdal.prototypes import ds as capi, geom as geom_api, srs as srs_api
# For more information, see the OGR C API source code:
# http://www.gdal.org/ogr/ogr__api_8h.html
#
# The OGR_L_* routines are relevant here.
class Layer(GDALBase):
"A class that wraps an OGR Layer, needs to be instantiated from a DataSource object."
#### Python 'magic' routines ####
def __init__(self, layer_ptr, ds):
"""
Initializes on an OGR C pointer to the Layer and the `DataSource` object
that owns this layer. The `DataSource` object is required so that a
reference to it is kept with this Layer. This prevents garbage
collection of the `DataSource` while this Layer is still active.
"""
if not layer_ptr:
raise OGRException('Cannot create Layer, invalid pointer given')
self.ptr = layer_ptr
self._ds = ds
self._ldefn = capi.get_layer_defn(self._ptr)
# Does the Layer support random reading?
self._random_read = self.test_capability('RandomRead')
def __getitem__(self, index):
"Gets the Feature at the specified index."
if isinstance(index, (int, long)):
# An integer index was given -- we cannot do a check based on the
# number of features because the beginning and ending feature IDs
# are not guaranteed to be 0 and len(layer)-1, respectively.
if index < 0: raise OGRIndexError('Negative indices are not allowed on OGR Layers.')
return self._make_feature(index)
elif isinstance(index, slice):
# A slice was given
start, stop, stride = index.indices(self.num_feat)
return [self._make_feature(fid) for fid in xrange(start, stop, stride)]
else:
raise TypeError('Integers and slices may only be used when indexing OGR Layers.')
def __iter__(self):
"Iterates over each Feature in the Layer."
# ResetReading() must be called before iteration is to begin.
capi.reset_reading(self._ptr)
for i in xrange(self.num_feat):
yield Feature(capi.get_next_feature(self._ptr), self._ldefn)
def __len__(self):
"The length is the number of features."
return self.num_feat
def __str__(self):
"The string name of the layer."
return self.name
def _make_feature(self, feat_id):
"""
Helper routine for __getitem__ that constructs a Feature from the given
Feature ID. If the OGR Layer does not support random-access reading,
then each feature of the layer will be incremented through until the
a Feature is found matching the given feature ID.
"""
if self._random_read:
# If the Layer supports random reading, return.
try:
return Feature(capi.get_feature(self.ptr, feat_id), self._ldefn)
except OGRException:
pass
else:
# Random access isn't supported, have to increment through
# each feature until the given feature ID is encountered.
for feat in self:
if feat.fid == feat_id: return feat
# Should have returned a Feature, raise an OGRIndexError.
raise OGRIndexError('Invalid feature id: %s.' % feat_id)
#### Layer properties ####
@property
def extent(self):
"Returns the extent (an Envelope) of this layer."
env = OGREnvelope()
capi.get_extent(self.ptr, byref(env), 1)
return Envelope(env)
@property
def name(self):
"Returns the name of this layer in the Data Source."
return capi.get_fd_name(self._ldefn)
@property
def num_feat(self, force=1):
"Returns the number of features in the Layer."
return capi.get_feature_count(self.ptr, force)
@property
def num_fields(self):
"Returns the number of fields in the Layer."
return capi.get_field_count(self._ldefn)
@property
def geom_type(self):
"Returns the geometry type (OGRGeomType) of the Layer."
return OGRGeomType(capi.get_fd_geom_type(self._ldefn))
@property
def srs(self):
"Returns the Spatial Reference used in this Layer."
try:
ptr = capi.get_layer_srs(self.ptr)
return SpatialReference(srs_api.clone_srs(ptr))
except SRSException:
return None
@property
def fields(self):
"""
Returns a list of string names corresponding to each of the Fields
available in this Layer.
"""
return [capi.get_field_name(capi.get_field_defn(self._ldefn, i))
for i in xrange(self.num_fields) ]
@property
def field_types(self):
"""
Returns a list of the types of fields in this Layer. For example,
the list [OFTInteger, OFTReal, OFTString] would be returned for
an OGR layer that had an integer, a floating-point, and string
fields.
"""
return [OGRFieldTypes[capi.get_field_type(capi.get_field_defn(self._ldefn, i))]
for i in xrange(self.num_fields)]
@property
def field_widths(self):
"Returns a list of the maximum field widths for the features."
return [capi.get_field_width(capi.get_field_defn(self._ldefn, i))
for i in xrange(self.num_fields)]
@property
def field_precisions(self):
"Returns the field precisions for the features."
return [capi.get_field_precision(capi.get_field_defn(self._ldefn, i))
for i in xrange(self.num_fields)]
def _get_spatial_filter(self):
try:
return OGRGeometry(geom_api.clone_geom(capi.get_spatial_filter(self.ptr)))
except OGRException:
return None
def _set_spatial_filter(self, filter):
if isinstance(filter, OGRGeometry):
capi.set_spatial_filter(self.ptr, filter.ptr)
elif isinstance(filter, (tuple, list)):
if not len(filter) == 4:
raise ValueError('Spatial filter list/tuple must have 4 elements.')
# Map c_double onto params -- if a bad type is passed in it
# will be caught here.
xmin, ymin, xmax, ymax = map(c_double, filter)
capi.set_spatial_filter_rect(self.ptr, xmin, ymin, xmax, ymax)
elif filter is None:
capi.set_spatial_filter(self.ptr, None)
else:
raise TypeError('Spatial filter must be either an OGRGeometry instance, a 4-tuple, or None.')
spatial_filter = property(_get_spatial_filter, _set_spatial_filter)
#### Layer Methods ####
def get_fields(self, field_name):
"""
Returns a list containing the given field name for every Feature
in the Layer.
"""
if not field_name in self.fields:
raise OGRException('invalid field name: %s' % field_name)
return [feat.get(field_name) for feat in self]
def get_geoms(self, geos=False):
"""
Returns a list containing the OGRGeometry for every Feature in
the Layer.
"""
if geos:
from django.contrib.gis.geos import GEOSGeometry
return [GEOSGeometry(feat.geom.wkb) for feat in self]
else:
return [feat.geom for feat in self]
def test_capability(self, capability):
"""
Returns a bool indicating whether the this Layer supports the given
capability (a string). Valid capability strings include:
'RandomRead', 'SequentialWrite', 'RandomWrite', 'FastSpatialFilter',
'FastFeatureCount', 'FastGetExtent', 'CreateField', 'Transactions',
'DeleteFeature', and 'FastSetNextByIndex'.
"""
return bool(capi.test_capability(self.ptr, capability))
| ajibawa-2023/Python-Code-Large/train/row_98700 | 108 | 212 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98700:ImportFrom_L2_C0", "label": "from ctypes import c_double, byref", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0094, 0.0047, 0, 0.66, 0.0, 182, 0, 2, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_double", "byref"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import c_double, byref"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:ImportFrom_L5_C0", "label": "from django.contrib.gis.gdal.base import GDALBase", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0236, 0.0047, 0, 0.66, 0.1, 771, 0, 1, 0, 0, 771, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.base", "arg_names": [], "import_names": ["GDALBase"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.base import GDALBase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:ImportFrom_L6_C0", "label": "from django.contrib.gis.gdal.envelope import Envelope, OGREnvelope", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0283, 0.0047, 0, 0.66, 0.2, 796, 0, 2, 0, 0, 796, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.envelope", "arg_names": [], "import_names": ["Envelope", "OGREnvelope"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.envelope import Envelope, OGREnvelope"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:ImportFrom_L7_C0", "label": "from django.contrib.gis.gdal.error import OGRException, OGRIndexError, SRSException", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.033, 0.0047, 0, 0.66, 0.3, 76, 0, 3, 0, 0, 76, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.error", "arg_names": [], "import_names": ["OGRException", "OGRIndexError", "SRSException"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.error import OGRException, OGRIndexError, SRSException"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:ImportFrom_L8_C0", "label": "from django.contrib.gis.gdal.feature import Feature", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0377, 0.0047, 0, 0.66, 0.4, 145, 0, 1, 0, 0, 145, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.feature", "arg_names": [], "import_names": ["Feature"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.feature import Feature"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:ImportFrom_L9_C0", "label": "from django.contrib.gis.gdal.field import OGRFieldTypes", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0425, 0.0047, 0, 0.66, 0.5, 367, 0, 1, 0, 0, 367, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.field", "arg_names": [], "import_names": ["OGRFieldTypes"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.field import OGRFieldTypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:ImportFrom_L10_C0", "label": "from django.contrib.gis.gdal.geomtype import OGRGeomType", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0472, 0.0047, 0, 0.66, 0.6, 621, 0, 1, 0, 0, 621, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.geomtype", "arg_names": [], "import_names": ["OGRGeomType"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.geomtype import OGRGeomType"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:ImportFrom_L11_C0", "label": "from django.contrib.gis.gdal.geometries import OGRGeometry", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0519, 0.0047, 0, 0.66, 0.7, 671, 0, 1, 0, 0, 671, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.geometries", "arg_names": [], "import_names": ["OGRGeometry"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.geometries import OGRGeometry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:ImportFrom_L12_C0", "label": "from django.contrib.gis.gdal.srs import SpatialReference", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0566, 0.0047, 0, 0.66, 0.8, 912, 0, 1, 0, 0, 912, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.srs", "arg_names": [], "import_names": ["SpatialReference"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.srs import SpatialReference"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:ImportFrom_L15_C0", "label": "from django.contrib.gis.gdal.prototypes import capi, geom_api, srs_api", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0708, 0.0047, 0, 0.66, 0.9, 730, 0, 3, 0, 0, 730, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.prototypes", "arg_names": [], "import_names": ["capi", "geom_api", "srs_api"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.prototypes import ds as capi, geom as geom_api, srs as srs_api"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "label": "Layer", "type": "class", "loc": [21, 212], "level": 0, "parent": null, "vector": [3, 0, 0.5495, 0.9057, 0, 0.66, 1.0, 159, 0, 21, 0, 0, 436, 0, 60], "semantic": {"name": "Layer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Layer(GDALBase):\n \"A class that wraps an OGR Layer, needs to be instantiated from a DataSource object.\"\n\n #### Python 'magic' routines ####\n def __init__(self, layer_ptr, ds):\n \"\"\"\n Initializes on an OGR C pointer to the Layer and the `DataSource` object\n that owns this layer. The `DataSource` object is required so that a "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L22_C4", "label": "expression", "type": "expression", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "vector": [8, 1, 0.1038, 0.0047, 1, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"A class that wraps an OGR Layer, needs to be instantiated from a DataSource object.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L25_C4", "label": "__init__", "type": "function", "loc": [25, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "vector": [2, 1, 0.1486, 0.066, 1, 0.37, 0.0455, 555, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "layer_ptr", "ds"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, layer_ptr, ds):\n \"\"\"\n Initializes on an OGR C pointer to the Layer and the `DataSource` object\n that owns this layer. The `DataSource` object is required so that a \n reference to it is kept with this Layer. This prevents garbage \n collection of the `DataSource` while this Layer is still active.\n \"\"\"\n if not layer_ptr:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L26_C8", "label": "expression", "type": "expression", "loc": [26, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L25_C4", "vector": [8, 2, 0.1344, 0.0283, 2, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Initializes on an OGR C pointer to the Layer and the `DataSource` object\n that owns this layer. The `DataSource` object is required so that a \n reference to it is kept with this Layer. This prevents garbage \n collection of the `DataSource` while this Layer is still active.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L32_C8", "label": "if", "type": "if", "loc": [32, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L25_C4", "vector": [4, 2, 0.1533, 0.0094, 2, 0.28, 0.2, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not layer_ptr:\n raise OGRException('Cannot create Layer, invalid pointer given')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Assign_L34_C8", "label": "self.ptr =", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L25_C4", "vector": [14, 2, 0.1604, 0.0047, 2, 0.28, 0.4, 386, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.ptr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ptr = layer_ptr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Assign_L35_C8", "label": "self._ds =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L25_C4", "vector": [14, 2, 0.1651, 0.0047, 2, 0.28, 0.6, 947, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._ds", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._ds = ds"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Assign_L36_C8", "label": "self._ldefn = get_layer_defn()", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L25_C4", "vector": [14, 2, 0.1698, 0.0047, 2, 0.28, 0.8, 126, 3, 1, 0, 0, 233, 10, 1], "semantic": {"name": "self._ldefn", "arg_names": [], "import_names": [], "rhs_call_name": "get_layer_defn", "annotation": ""}, "snippet": " self._ldefn = capi.get_layer_defn(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Assign_L38_C8", "label": "self._random_read = test_capability()", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L25_C4", "vector": [14, 2, 0.1792, 0.0047, 2, 0.28, 1.0, 198, 3, 1, 0, 0, 931, 10, 1], "semantic": {"name": "self._random_read", "arg_names": [], "import_names": [], "rhs_call_name": "test_capability", "annotation": ""}, "snippet": " self._random_read = self.test_capability('RandomRead')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L40_C4", "label": "__getitem__", "type": "function", "loc": [40, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "vector": [2, 1, 0.2193, 0.066, 1, 0.37, 0.0909, 698, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "__getitem__", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getitem__(self, index):\n \"Gets the Feature at the specified index.\"\n if isinstance(index, (int, long)):\n # An integer index was given -- we cannot do a check based on the\n # number of features because the beginning and ending feature IDs\n # are not guaranteed to be 0 and len(layer)-1, respectively.\n if index < 0: raise OGRIndexError('Negative indices are not allowed on OGR Layers.')\n return self._make_feature(index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L41_C8", "label": "expression", "type": "expression", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L40_C4", "vector": [8, 2, 0.1934, 0.0047, 2, 0.12, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Gets the Feature at the specified index.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L42_C8", "label": "if", "type": "if", "loc": [42, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L40_C4", "vector": [4, 2, 0.2241, 0.0566, 2, 0.12, 1.0, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(index, (int, long)):\n # An integer index was given -- we cannot do a check based on the\n # number of features because the beginning and ending feature IDs\n # are not guaranteed to be 0 and len(layer)-1, respectively.\n if index < 0: raise OGRIndexError('Negative indices are not allowed on OGR Layers.')\n return self._make_feature(index)\n elif isinstance(index, slice):\n # A slice was given"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L46_C12", "label": "if", "type": "if", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L42_C8", "vector": [4, 3, 0.217, 0.0047, 3, 0.12, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if index < 0: raise OGRIndexError('Negative indices are not allowed on OGR Layers.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L47_C12", "label": "return", "type": "return", "loc": [47, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L42_C8", "vector": [13, 3, 0.2217, 0.0047, 3, 0.12, 0.5, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._make_feature(index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L48_C8", "label": "if", "type": "if", "loc": [48, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L42_C8", "vector": [4, 3, 0.2382, 0.0283, 3, 0.12, 1.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(index, slice):\n # A slice was given\n start, stop, stride = index.indices(self.num_feat)\n return [self._make_feature(fid) for fid in xrange(start, stop, stride)]\n else:\n raise TypeError('Integers and slices may only be used when indexing OGR Layers.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Assign_L50_C12", "label": "start, stop, stride = indices()", "type": "assigned_variable", "loc": [50, 50], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L48_C8", "vector": [14, 4, 0.2358, 0.0047, 4, 0.84, 0.0, 592, 3, 1, 0, 0, 478, 10, 1], "semantic": {"name": "start, stop, stride", "arg_names": [], "import_names": [], "rhs_call_name": "indices", "annotation": ""}, "snippet": " start, stop, stride = index.indices(self.num_feat)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L51_C12", "label": "return", "type": "return", "loc": [51, 51], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L48_C8", "vector": [13, 4, 0.2406, 0.0047, 4, 0.84, 1.0, 0, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [self._make_feature(fid) for fid in xrange(start, stop, stride)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L55_C4", "label": "__iter__", "type": "function", "loc": [55, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "vector": [2, 1, 0.2712, 0.0283, 1, 0.37, 0.1364, 891, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n \"Iterates over each Feature in the Layer.\"\n # ResetReading() must be called before iteration is to begin.\n capi.reset_reading(self._ptr)\n for i in xrange(self.num_feat):\n yield Feature(capi.get_next_feature(self._ptr), self._ldefn)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L56_C8", "label": "expression", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L55_C4", "vector": [8, 2, 0.2642, 0.0047, 2, 0.22, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Iterates over each Feature in the Layer.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L58_C8", "label": "reset_reading()", "type": "expression", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L55_C4", "vector": [8, 2, 0.2736, 0.0047, 2, 0.22, 0.5, 485, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "reset_reading", "arg_names": [], "import_names": [], "rhs_call_name": "reset_reading", "annotation": ""}, "snippet": " capi.reset_reading(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:For_L59_C8", "label": "for i", "type": "for", "loc": [59, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L55_C4", "vector": [6, 2, 0.2807, 0.0094, 2, 0.22, 1.0, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange(self.num_feat):\n yield Feature(capi.get_next_feature(self._ptr), self._ldefn)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L60_C12", "label": "expression", "type": "expression", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:For_L59_C8", "vector": [8, 3, 0.283, 0.0047, 3, 0.86, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield Feature(capi.get_next_feature(self._ptr), self._ldefn)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L62_C4", "label": "__len__", "type": "function", "loc": [62, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "vector": [2, 1, 0.2972, 0.0142, 1, 0.37, 0.1818, 76, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__len__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __len__(self):\n \"The length is the number of features.\"\n return self.num_feat"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L63_C8", "label": "expression", "type": "expression", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L62_C4", "vector": [8, 2, 0.2972, 0.0047, 2, 0.53, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"The length is the number of features.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L64_C8", "label": "return", "type": "return", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L62_C4", "vector": [13, 2, 0.3019, 0.0047, 2, 0.53, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.num_feat"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L66_C4", "label": "__str__", "type": "function", "loc": [66, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "vector": [2, 1, 0.316, 0.0142, 1, 0.37, 0.2273, 527, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n \"The string name of the layer.\"\n return self.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L67_C8", "label": "expression", "type": "expression", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L66_C4", "vector": [8, 2, 0.316, 0.0047, 2, 0.5, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"The string name of the layer.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L68_C8", "label": "return", "type": "return", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L66_C4", "vector": [13, 2, 0.3208, 0.0047, 2, 0.5, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L70_C4", "label": "_make_feature", "type": "function", "loc": [70, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "vector": [2, 1, 0.375, 0.0943, 1, 0.37, 0.2727, 361, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "_make_feature", "arg_names": ["self", "feat_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _make_feature(self, feat_id):\n \"\"\"\n Helper routine for __getitem__ that constructs a Feature from the given\n Feature ID. If the OGR Layer does not support random-access reading,\n then each feature of the layer will be incremented through until the\n a Feature is found matching the given feature ID.\n \"\"\"\n if self._random_read:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L71_C8", "label": "expression", "type": "expression", "loc": [71, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L70_C4", "vector": [8, 2, 0.3467, 0.0283, 2, 0.34, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Helper routine for __getitem__ that constructs a Feature from the given\n Feature ID. If the OGR Layer does not support random-access reading,\n then each feature of the layer will be incremented through until the\n a Feature is found matching the given feature ID.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L77_C8", "label": "if", "type": "if", "loc": [77, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L70_C4", "vector": [4, 2, 0.3868, 0.0519, 2, 0.34, 1.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._random_read:\n # If the Layer supports random reading, return.\n try:\n return Feature(capi.get_feature(self.ptr, feat_id), self._ldefn)\n except OGRException:\n pass\n else:\n # Random access isn't supported, have to increment through"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Try_L79_C12", "label": "try", "type": "try", "loc": [79, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L77_C8", "vector": [7, 3, 0.3797, 0.0189, 3, 0.26, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return Feature(capi.get_feature(self.ptr, feat_id), self._ldefn)\n except OGRException:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L80_C16", "label": "return", "type": "return", "loc": [80, 80], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:Try_L79_C12", "vector": [13, 4, 0.3774, 0.0047, 4, 0.45, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Feature(capi.get_feature(self.ptr, feat_id), self._ldefn)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:For_L86_C12", "label": "for feat", "type": "for", "loc": [86, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L77_C8", "vector": [6, 3, 0.408, 0.0094, 3, 0.26, 1.0, 243, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "feat", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for feat in self:\n if feat.fid == feat_id: return feat"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L87_C16", "label": "if", "type": "if", "loc": [87, 87], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:For_L86_C12", "vector": [4, 4, 0.4104, 0.0047, 4, 0.01, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if feat.fid == feat_id: return feat"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L87_C40", "label": "return", "type": "return", "loc": [87, 87], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L87_C16", "vector": [13, 5, 0.4104, 0.0047, 5, 0.44, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if feat.fid == feat_id: return feat"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L93_C4", "label": "extent", "type": "function", "loc": [93, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "vector": [2, 1, 0.4481, 0.0236, 1, 0.37, 0.3182, 962, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "extent", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def extent(self):\n \"Returns the extent (an Envelope) of this layer.\"\n env = OGREnvelope()\n capi.get_extent(self.ptr, byref(env), 1)\n return Envelope(env)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L94_C8", "label": "expression", "type": "expression", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L93_C4", "vector": [8, 2, 0.4434, 0.0047, 2, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the extent (an Envelope) of this layer.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Assign_L95_C8", "label": "env = OGREnvelope()", "type": "assigned_variable", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L93_C4", "vector": [14, 2, 0.4481, 0.0047, 2, 0.07, 0.3333, 803, 3, 0, 0, 0, 171, 10, 1], "semantic": {"name": "env", "arg_names": [], "import_names": [], "rhs_call_name": "OGREnvelope", "annotation": ""}, "snippet": " env = OGREnvelope()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L96_C8", "label": "get_extent()", "type": "expression", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L93_C4", "vector": [8, 2, 0.4528, 0.0047, 2, 0.07, 0.6667, 884, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "get_extent", "arg_names": [], "import_names": [], "rhs_call_name": "get_extent", "annotation": ""}, "snippet": " capi.get_extent(self.ptr, byref(env), 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L97_C8", "label": "return", "type": "return", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L93_C4", "vector": [13, 2, 0.4575, 0.0047, 2, 0.07, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Envelope(env)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L100_C4", "label": "name", "type": "function", "loc": [100, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "vector": [2, 1, 0.4764, 0.0142, 1, 0.37, 0.3636, 57, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def name(self):\n \"Returns the name of this layer in the Data Source.\"\n return capi.get_fd_name(self._ldefn)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L101_C8", "label": "expression", "type": "expression", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L100_C4", "vector": [8, 2, 0.4764, 0.0047, 2, 0.89, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the name of this layer in the Data Source.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L102_C8", "label": "return", "type": "return", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L100_C4", "vector": [13, 2, 0.4811, 0.0047, 2, 0.89, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_fd_name(self._ldefn)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L105_C4", "label": "num_feat", "type": "function", "loc": [105, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "vector": [2, 1, 0.5, 0.0142, 1, 0.37, 0.4091, 347, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "num_feat", "arg_names": ["self", "force"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def num_feat(self, force=1):\n \"Returns the number of features in the Layer.\"\n return capi.get_feature_count(self.ptr, force)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L106_C8", "label": "expression", "type": "expression", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L105_C4", "vector": [8, 2, 0.5, 0.0047, 2, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the number of features in the Layer.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L107_C8", "label": "return", "type": "return", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L105_C4", "vector": [13, 2, 0.5047, 0.0047, 2, 0.46, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_feature_count(self.ptr, force)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L110_C4", "label": "num_fields", "type": "function", "loc": [110, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "vector": [2, 1, 0.5236, 0.0142, 1, 0.37, 0.4545, 589, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "num_fields", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def num_fields(self):\n \"Returns the number of fields in the Layer.\"\n return capi.get_field_count(self._ldefn)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L111_C8", "label": "expression", "type": "expression", "loc": [111, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L110_C4", "vector": [8, 2, 0.5236, 0.0047, 2, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the number of fields in the Layer.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L112_C8", "label": "return", "type": "return", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L110_C4", "vector": [13, 2, 0.5283, 0.0047, 2, 0.37, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_field_count(self._ldefn)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L115_C4", "label": "geom_type", "type": "function", "loc": [115, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "vector": [2, 1, 0.5472, 0.0142, 1, 0.37, 0.5, 770, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "geom_type", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geom_type(self):\n \"Returns the geometry type (OGRGeomType) of the Layer.\"\n return OGRGeomType(capi.get_fd_geom_type(self._ldefn))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L116_C8", "label": "expression", "type": "expression", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L115_C4", "vector": [8, 2, 0.5472, 0.0047, 2, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the geometry type (OGRGeomType) of the Layer.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L117_C8", "label": "return", "type": "return", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L115_C4", "vector": [13, 2, 0.5519, 0.0047, 2, 0.88, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return OGRGeomType(capi.get_fd_geom_type(self._ldefn))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L120_C4", "label": "srs", "type": "function", "loc": [120, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "vector": [2, 1, 0.5802, 0.033, 1, 0.37, 0.5455, 95, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "srs", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def srs(self):\n \"Returns the Spatial Reference used in this Layer.\"\n try:\n ptr = capi.get_layer_srs(self.ptr)\n return SpatialReference(srs_api.clone_srs(ptr))\n except SRSException:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L121_C8", "label": "expression", "type": "expression", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L120_C4", "vector": [8, 2, 0.5708, 0.0047, 2, 0.33, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the Spatial Reference used in this Layer.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Try_L122_C8", "label": "try", "type": "try", "loc": [122, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L120_C4", "vector": [7, 2, 0.5849, 0.0236, 2, 0.33, 1.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n ptr = capi.get_layer_srs(self.ptr)\n return SpatialReference(srs_api.clone_srs(ptr))\n except SRSException:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Assign_L123_C12", "label": "ptr = get_layer_srs()", "type": "assigned_variable", "loc": [123, 123], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:Try_L122_C8", "vector": [14, 3, 0.5802, 0.0047, 3, 0.17, 0.0, 676, 3, 1, 0, 0, 921, 10, 1], "semantic": {"name": "ptr", "arg_names": [], "import_names": [], "rhs_call_name": "get_layer_srs", "annotation": ""}, "snippet": " ptr = capi.get_layer_srs(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L124_C12", "label": "return", "type": "return", "loc": [124, 124], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:Try_L122_C8", "vector": [13, 3, 0.5849, 0.0047, 3, 0.17, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return SpatialReference(srs_api.clone_srs(ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L126_C12", "label": "return", "type": "return", "loc": [126, 126], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:Try_L122_C8", "vector": [13, 3, 0.5943, 0.0047, 3, 0.17, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L129_C4", "label": "fields", "type": "function", "loc": [129, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "vector": [2, 1, 0.6226, 0.033, 1, 0.37, 0.5909, 358, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "fields", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fields(self):\n \"\"\"\n Returns a list of string names corresponding to each of the Fields\n available in this Layer.\n \"\"\"\n return [capi.get_field_name(capi.get_field_defn(self._ldefn, i)) \n for i in xrange(self.num_fields) ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L130_C8", "label": "expression", "type": "expression", "loc": [130, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L129_C4", "vector": [8, 2, 0.6203, 0.0189, 2, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a list of string names corresponding to each of the Fields\n available in this Layer.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L134_C8", "label": "return", "type": "return", "loc": [134, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L129_C4", "vector": [13, 2, 0.6344, 0.0094, 2, 0.15, 1.0, 0, 5, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [capi.get_field_name(capi.get_field_defn(self._ldefn, i)) \n for i in xrange(self.num_fields) ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L138_C4", "label": "field_types", "type": "function", "loc": [138, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "vector": [2, 1, 0.6698, 0.0425, 1, 0.37, 0.6364, 700, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "field_types", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def field_types(self):\n \"\"\"\n Returns a list of the types of fields in this Layer. For example,\n the list [OFTInteger, OFTReal, OFTString] would be returned for\n an OGR layer that had an integer, a floating-point, and string\n fields.\n \"\"\"\n return [OGRFieldTypes[capi.get_field_type(capi.get_field_defn(self._ldefn, i))]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L139_C8", "label": "expression", "type": "expression", "loc": [139, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L138_C4", "vector": [8, 2, 0.6675, 0.0283, 2, 0.8, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a list of the types of fields in this Layer. For example,\n the list [OFTInteger, OFTReal, OFTString] would be returned for\n an OGR layer that had an integer, a floating-point, and string\n fields.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L145_C8", "label": "return", "type": "return", "loc": [145, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L138_C4", "vector": [13, 2, 0.6863, 0.0094, 2, 0.8, 1.0, 0, 5, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [OGRFieldTypes[capi.get_field_type(capi.get_field_defn(self._ldefn, i))]\n for i in xrange(self.num_fields)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L149_C4", "label": "field_widths", "type": "function", "loc": [149, 152], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "vector": [2, 1, 0.7099, 0.0189, 1, 0.37, 0.6818, 515, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "field_widths", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def field_widths(self):\n \"Returns a list of the maximum field widths for the features.\"\n return [capi.get_field_width(capi.get_field_defn(self._ldefn, i))\n for i in xrange(self.num_fields)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L150_C8", "label": "expression", "type": "expression", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L149_C4", "vector": [8, 2, 0.7075, 0.0047, 2, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a list of the maximum field widths for the features.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L151_C8", "label": "return", "type": "return", "loc": [151, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L149_C4", "vector": [13, 2, 0.7146, 0.0094, 2, 0.44, 1.0, 0, 5, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [capi.get_field_width(capi.get_field_defn(self._ldefn, i))\n for i in xrange(self.num_fields)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L155_C4", "label": "field_precisions", "type": "function", "loc": [155, 158], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "vector": [2, 1, 0.7382, 0.0189, 1, 0.37, 0.7273, 382, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "field_precisions", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def field_precisions(self):\n \"Returns the field precisions for the features.\"\n return [capi.get_field_precision(capi.get_field_defn(self._ldefn, i))\n for i in xrange(self.num_fields)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L156_C8", "label": "expression", "type": "expression", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L155_C4", "vector": [8, 2, 0.7358, 0.0047, 2, 0.53, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the field precisions for the features.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L157_C8", "label": "return", "type": "return", "loc": [157, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L155_C4", "vector": [13, 2, 0.7429, 0.0094, 2, 0.53, 1.0, 0, 5, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [capi.get_field_precision(capi.get_field_defn(self._ldefn, i))\n for i in xrange(self.num_fields)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L160_C4", "label": "_get_spatial_filter", "type": "function", "loc": [160, 164], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "vector": [2, 1, 0.7642, 0.0236, 1, 0.37, 0.7727, 494, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "_get_spatial_filter", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_spatial_filter(self):\n try:\n return OGRGeometry(geom_api.clone_geom(capi.get_spatial_filter(self.ptr)))\n except OGRException:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Try_L161_C8", "label": "try", "type": "try", "loc": [161, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L160_C4", "vector": [7, 2, 0.7665, 0.0189, 2, 0.42, 0.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return OGRGeometry(geom_api.clone_geom(capi.get_spatial_filter(self.ptr)))\n except OGRException:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L162_C12", "label": "return", "type": "return", "loc": [162, 162], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:Try_L161_C8", "vector": [13, 3, 0.7642, 0.0047, 3, 0.35, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return OGRGeometry(geom_api.clone_geom(capi.get_spatial_filter(self.ptr)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L164_C12", "label": "return", "type": "return", "loc": [164, 164], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:Try_L161_C8", "vector": [13, 3, 0.7736, 0.0047, 3, 0.35, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L166_C4", "label": "_set_spatial_filter", "type": "function", "loc": [166, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "vector": [2, 1, 0.8137, 0.066, 1, 0.37, 0.8182, 940, 0, 2, 0, 0, 0, 0, 9], "semantic": {"name": "_set_spatial_filter", "arg_names": ["self", "filter"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_spatial_filter(self, filter):\n if isinstance(filter, OGRGeometry):\n capi.set_spatial_filter(self.ptr, filter.ptr)\n elif isinstance(filter, (tuple, list)):\n if not len(filter) == 4:\n raise ValueError('Spatial filter list/tuple must have 4 elements.')\n # Map c_double onto params -- if a bad type is passed in it\n # will be caught here."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L167_C8", "label": "if", "type": "if", "loc": [167, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L166_C4", "vector": [4, 2, 0.816, 0.0613, 2, 0.28, 0.0, 0, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(filter, OGRGeometry):\n capi.set_spatial_filter(self.ptr, filter.ptr)\n elif isinstance(filter, (tuple, list)):\n if not len(filter) == 4:\n raise ValueError('Spatial filter list/tuple must have 4 elements.')\n # Map c_double onto params -- if a bad type is passed in it\n # will be caught here.\n xmin, ymin, xmax, ymax = map(c_double, filter)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L168_C12", "label": "set_spatial_filter()", "type": "expression", "loc": [168, 168], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L167_C8", "vector": [8, 3, 0.7925, 0.0047, 3, 0.91, 0.0, 422, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_spatial_filter", "arg_names": [], "import_names": [], "rhs_call_name": "set_spatial_filter", "annotation": ""}, "snippet": " capi.set_spatial_filter(self.ptr, filter.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L169_C8", "label": "if", "type": "if", "loc": [169, 179], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L167_C8", "vector": [4, 3, 0.8208, 0.0519, 3, 0.91, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(filter, (tuple, list)):\n if not len(filter) == 4:\n raise ValueError('Spatial filter list/tuple must have 4 elements.')\n # Map c_double onto params -- if a bad type is passed in it\n # will be caught here.\n xmin, ymin, xmax, ymax = map(c_double, filter)\n capi.set_spatial_filter_rect(self.ptr, xmin, ymin, xmax, ymax)\n elif filter is None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L170_C12", "label": "if", "type": "if", "loc": [170, 171], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L169_C8", "vector": [4, 4, 0.8042, 0.0094, 4, 0.98, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not len(filter) == 4:\n raise ValueError('Spatial filter list/tuple must have 4 elements.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Assign_L174_C12", "label": "xmin, ymin, xmax, ymax = map()", "type": "assigned_variable", "loc": [174, 174], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L169_C8", "vector": [14, 4, 0.8208, 0.0047, 4, 0.98, 0.3333, 34, 3, 2, 0, 0, 53, 10, 1], "semantic": {"name": "xmin, ymin, xmax, ymax", "arg_names": [], "import_names": [], "rhs_call_name": "map", "annotation": ""}, "snippet": " xmin, ymin, xmax, ymax = map(c_double, filter)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L175_C12", "label": "set_spatial_filter_rect()", "type": "expression", "loc": [175, 175], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L169_C8", "vector": [8, 4, 0.8255, 0.0047, 4, 0.98, 0.6667, 264, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "set_spatial_filter_rect", "arg_names": [], "import_names": [], "rhs_call_name": "set_spatial_filter_rect", "annotation": ""}, "snippet": " capi.set_spatial_filter_rect(self.ptr, xmin, ymin, xmax, ymax)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L176_C8", "label": "if", "type": "if", "loc": [176, 179], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L169_C8", "vector": [4, 4, 0.8373, 0.0189, 4, 0.98, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif filter is None:\n capi.set_spatial_filter(self.ptr, None)\n else:\n raise TypeError('Spatial filter must be either an OGRGeometry instance, a 4-tuple, or None.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L177_C12", "label": "set_spatial_filter()", "type": "expression", "loc": [177, 177], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L176_C8", "vector": [8, 5, 0.8349, 0.0047, 5, 0.34, 0.0, 422, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_spatial_filter", "arg_names": [], "import_names": [], "rhs_call_name": "set_spatial_filter", "annotation": ""}, "snippet": " capi.set_spatial_filter(self.ptr, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Assign_L181_C4", "label": "spatial_filter = property()", "type": "assigned_variable", "loc": [181, 181], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "vector": [14, 1, 0.8538, 0.0047, 1, 0.37, 0.8636, 157, 3, 2, 0, 0, 244, 10, 1], "semantic": {"name": "spatial_filter", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " spatial_filter = property(_get_spatial_filter, _set_spatial_filter)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L184_C4", "label": "get_fields", "type": "function", "loc": [184, 191], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "vector": [2, 1, 0.8844, 0.0377, 1, 0.37, 0.9091, 7, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "get_fields", "arg_names": ["self", "field_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_fields(self, field_name):\n \"\"\"\n Returns a list containing the given field name for every Feature\n in the Layer.\n \"\"\"\n if not field_name in self.fields:\n raise OGRException('invalid field name: %s' % field_name)\n return [feat.get(field_name) for feat in self]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L185_C8", "label": "expression", "type": "expression", "loc": [185, 188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L184_C4", "vector": [8, 2, 0.8797, 0.0189, 2, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a list containing the given field name for every Feature\n in the Layer.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L189_C8", "label": "if", "type": "if", "loc": [189, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L184_C4", "vector": [4, 2, 0.8939, 0.0094, 2, 0.45, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not field_name in self.fields:\n raise OGRException('invalid field name: %s' % field_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L191_C8", "label": "return", "type": "return", "loc": [191, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L184_C4", "vector": [13, 2, 0.9009, 0.0047, 2, 0.45, 1.0, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [feat.get(field_name) for feat in self]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L193_C4", "label": "get_geoms", "type": "function", "loc": [193, 202], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "vector": [2, 1, 0.9316, 0.0472, 1, 0.37, 0.9545, 48, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "get_geoms", "arg_names": ["self", "geos"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_geoms(self, geos=False):\n \"\"\"\n Returns a list containing the OGRGeometry for every Feature in\n the Layer.\n \"\"\"\n if geos:\n from django.contrib.gis.geos import GEOSGeometry\n return [GEOSGeometry(feat.geom.wkb) for feat in self]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L194_C8", "label": "expression", "type": "expression", "loc": [194, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L193_C4", "vector": [8, 2, 0.9222, 0.0189, 2, 0.24, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a list containing the OGRGeometry for every Feature in\n the Layer.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L198_C8", "label": "if", "type": "if", "loc": [198, 202], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L193_C4", "vector": [4, 2, 0.9434, 0.0236, 2, 0.24, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if geos:\n from django.contrib.gis.geos import GEOSGeometry\n return [GEOSGeometry(feat.geom.wkb) for feat in self]\n else:\n return [feat.geom for feat in self]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:ImportFrom_L199_C12", "label": "from django.contrib.gis.geos import GEOSGeometry", "type": "import", "loc": [199, 199], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L198_C8", "vector": [1, 3, 0.9387, 0.0047, 3, 0.85, 0.0, 886, 0, 1, 0, 0, 886, 0, 0], "semantic": {"name": "django.contrib.gis.geos", "arg_names": [], "import_names": ["GEOSGeometry"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.geos import GEOSGeometry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L200_C12", "label": "return", "type": "return", "loc": [200, 200], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L198_C8", "vector": [13, 3, 0.9434, 0.0047, 3, 0.85, 0.5, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [GEOSGeometry(feat.geom.wkb) for feat in self]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L202_C12", "label": "return", "type": "return", "loc": [202, 202], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L198_C8", "vector": [13, 3, 0.9528, 0.0047, 3, 0.85, 1.0, 0, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [feat.geom for feat in self]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L204_C4", "label": "test_capability", "type": "function", "loc": [204, 212], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "vector": [2, 1, 0.9811, 0.0425, 1, 0.37, 1.0, 931, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "test_capability", "arg_names": ["self", "capability"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_capability(self, capability):\n \"\"\"\n Returns a bool indicating whether the this Layer supports the given\n capability (a string). Valid capability strings include:\n 'RandomRead', 'SequentialWrite', 'RandomWrite', 'FastSpatialFilter',\n 'FastFeatureCount', 'FastGetExtent', 'CreateField', 'Transactions',\n 'DeleteFeature', and 'FastSetNextByIndex'.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L205_C8", "label": "expression", "type": "expression", "loc": [205, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L204_C4", "vector": [8, 2, 0.9811, 0.033, 2, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a bool indicating whether the this Layer supports the given\n capability (a string). Valid capability strings include:\n 'RandomRead', 'SequentialWrite', 'RandomWrite', 'FastSpatialFilter',\n 'FastFeatureCount', 'FastGetExtent', 'CreateField', 'Transactions',\n 'DeleteFeature', and 'FastSetNextByIndex'.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L212_C8", "label": "return", "type": "return", "loc": [212, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L204_C4", "vector": [13, 2, 1.0, 0.0047, 2, 0.72, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bool(capi.test_capability(self.ptr, capability))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Assign_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L48_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Assign_L50_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L48_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:For_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:For_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L60_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Try_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:Try_L79_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L80_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:For_L86_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:For_L86_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L87_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L87_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L87_C40"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Assign_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L110_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L110_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L120_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L120_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Try_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Assign_L123_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L124_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L126_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L138_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L155_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L155_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L155_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Try_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:Try_L161_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L162_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:Try_L161_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L164_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L166_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L167_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L168_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L167_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L170_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Assign_L174_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L175_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L176_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L177_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Assign_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L185_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L191_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L193_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L193_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L194_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L193_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:ImportFrom_L199_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L200_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L202_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L204_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L204_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L205_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:FunctionDef_L204_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Return_L212_C8"}] |
import re
from datetime import date
from ctypes import c_char, c_char_p, c_double, c_int, c_ubyte, c_void_p, POINTER
from django.contrib.gis.gdal.envelope import OGREnvelope
from django.contrib.gis.gdal.libgdal import lgdal, GEOJSON
from django.contrib.gis.gdal.prototypes.errcheck import check_bool, check_envelope
from django.contrib.gis.gdal.prototypes.generation import \
const_string_output, double_output, geom_output, int_output, \
srs_output, string_output, void_output
### Generation routines specific to this module ###
def env_func(f, argtypes):
"For getting OGREnvelopes."
f.argtypes = argtypes
f.restype = None
f.errcheck = check_envelope
return f
def pnt_func(f):
"For accessing point information."
return double_output(f, [c_void_p, c_int])
def topology_func(f):
f.argtypes = [c_void_p, c_void_p]
f.restype = c_int
f.errchck = check_bool
return f
### OGR_G ctypes function prototypes ###
# GeoJSON routines, if supported.
if GEOJSON:
from_json = geom_output(lgdal.OGR_G_CreateGeometryFromJson, [c_char_p])
to_json = string_output(lgdal.OGR_G_ExportToJson, [c_void_p], str_result=True)
to_kml = string_output(lgdal.OGR_G_ExportToKML, [c_void_p, c_char_p], str_result=True)
else:
from_json = False
to_json = False
to_kml = False
# GetX, GetY, GetZ all return doubles.
getx = pnt_func(lgdal.OGR_G_GetX)
gety = pnt_func(lgdal.OGR_G_GetY)
getz = pnt_func(lgdal.OGR_G_GetZ)
# Geometry creation routines.
from_wkb = geom_output(lgdal.OGR_G_CreateFromWkb, [c_char_p, c_void_p, POINTER(c_void_p), c_int], offset=-2)
from_wkt = geom_output(lgdal.OGR_G_CreateFromWkt, [POINTER(c_char_p), c_void_p, POINTER(c_void_p)], offset=-1)
create_geom = geom_output(lgdal.OGR_G_CreateGeometry, [c_int])
clone_geom = geom_output(lgdal.OGR_G_Clone, [c_void_p])
get_geom_ref = geom_output(lgdal.OGR_G_GetGeometryRef, [c_void_p, c_int])
get_boundary = geom_output(lgdal.OGR_G_GetBoundary, [c_void_p])
geom_convex_hull = geom_output(lgdal.OGR_G_ConvexHull, [c_void_p])
geom_diff = geom_output(lgdal.OGR_G_Difference, [c_void_p, c_void_p])
geom_intersection = geom_output(lgdal.OGR_G_Intersection, [c_void_p, c_void_p])
geom_sym_diff = geom_output(lgdal.OGR_G_SymmetricDifference, [c_void_p, c_void_p])
geom_union = geom_output(lgdal.OGR_G_Union, [c_void_p, c_void_p])
# Geometry modification routines.
add_geom = void_output(lgdal.OGR_G_AddGeometry, [c_void_p, c_void_p])
import_wkt = void_output(lgdal.OGR_G_ImportFromWkt, [c_void_p, POINTER(c_char_p)])
# Destroys a geometry
destroy_geom = void_output(lgdal.OGR_G_DestroyGeometry, [c_void_p], errcheck=False)
# Geometry export routines.
to_wkb = void_output(lgdal.OGR_G_ExportToWkb, None, errcheck=True) # special handling for WKB.
to_wkt = string_output(lgdal.OGR_G_ExportToWkt, [c_void_p, POINTER(c_char_p)])
to_gml = string_output(lgdal.OGR_G_ExportToGML, [c_void_p], str_result=True)
get_wkbsize = int_output(lgdal.OGR_G_WkbSize, [c_void_p])
# Geometry spatial-reference related routines.
assign_srs = void_output(lgdal.OGR_G_AssignSpatialReference, [c_void_p, c_void_p], errcheck=False)
get_geom_srs = srs_output(lgdal.OGR_G_GetSpatialReference, [c_void_p])
# Geometry properties
get_area = double_output(lgdal.OGR_G_GetArea, [c_void_p])
get_centroid = void_output(lgdal.OGR_G_Centroid, [c_void_p, c_void_p])
get_dims = int_output(lgdal.OGR_G_GetDimension, [c_void_p])
get_coord_dim = int_output(lgdal.OGR_G_GetCoordinateDimension, [c_void_p])
set_coord_dim = void_output(lgdal.OGR_G_SetCoordinateDimension, [c_void_p, c_int], errcheck=False)
get_geom_count = int_output(lgdal.OGR_G_GetGeometryCount, [c_void_p])
get_geom_name = const_string_output(lgdal.OGR_G_GetGeometryName, [c_void_p])
get_geom_type = int_output(lgdal.OGR_G_GetGeometryType, [c_void_p])
get_point_count = int_output(lgdal.OGR_G_GetPointCount, [c_void_p])
get_point = void_output(lgdal.OGR_G_GetPoint, [c_void_p, c_int, POINTER(c_double), POINTER(c_double), POINTER(c_double)], errcheck=False)
geom_close_rings = void_output(lgdal.OGR_G_CloseRings, [c_void_p], errcheck=False)
# Topology routines.
ogr_contains = topology_func(lgdal.OGR_G_Contains)
ogr_crosses = topology_func(lgdal.OGR_G_Crosses)
ogr_disjoint = topology_func(lgdal.OGR_G_Disjoint)
ogr_equals = topology_func(lgdal.OGR_G_Equals)
ogr_intersects = topology_func(lgdal.OGR_G_Intersects)
ogr_overlaps = topology_func(lgdal.OGR_G_Overlaps)
ogr_touches = topology_func(lgdal.OGR_G_Touches)
ogr_within = topology_func(lgdal.OGR_G_Within)
# Transformation routines.
geom_transform = void_output(lgdal.OGR_G_Transform, [c_void_p, c_void_p])
geom_transform_to = void_output(lgdal.OGR_G_TransformTo, [c_void_p, c_void_p])
# For retrieving the envelope of the geometry.
get_envelope = env_func(lgdal.OGR_G_GetEnvelope, [c_void_p, POINTER(OGREnvelope)])
| ajibawa-2023/Python-Code-Large/train/row_98701 | 73 | 106 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0094, 0.0094, 0, 0.66, 0.0, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:ImportFrom_L2_C0", "label": "from datetime import date", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0189, 0.0094, 0, 0.66, 0.0182, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["date"], "rhs_call_name": "", "annotation": ""}, "snippet": "from datetime import date"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:ImportFrom_L3_C0", "label": "from ctypes import c_char, c_char_p, c_double\u2026", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0283, 0.0094, 0, 0.66, 0.0364, 182, 0, 7, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_char", "c_char_p", "c_double", "c_int", "c_ubyte", "c_void_p", "POINTER"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import c_char, c_char_p, c_double, c_int, c_ubyte, c_void_p, POINTER"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:ImportFrom_L4_C0", "label": "from django.contrib.gis.gdal.envelope import OGREnvelope", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0377, 0.0094, 0, 0.66, 0.0545, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.envelope", "arg_names": [], "import_names": ["OGREnvelope"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.envelope import OGREnvelope"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:ImportFrom_L5_C0", "label": "from django.contrib.gis.gdal.libgdal import lgdal, GEOJSON", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0472, 0.0094, 0, 0.66, 0.0727, 460, 0, 2, 0, 0, 460, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.libgdal", "arg_names": [], "import_names": ["lgdal", "GEOJSON"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.libgdal import lgdal, GEOJSON"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:ImportFrom_L6_C0", "label": "from django.contrib.gis.gdal.prototypes.errcheck import check_bool, check_envelope", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0566, 0.0094, 0, 0.66, 0.0909, 661, 0, 2, 0, 0, 661, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.prototypes.errcheck", "arg_names": [], "import_names": ["check_bool", "check_envelope"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.prototypes.errcheck import check_bool, check_envelope"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:ImportFrom_L7_C0", "label": "from django.contrib.gis.gdal.prototypes.generation import const_string_output, double_output, geom_output\u2026", "type": "import", "loc": [7, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0755, 0.0283, 0, 0.66, 0.1091, 737, 0, 7, 0, 0, 737, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.prototypes.generation", "arg_names": [], "import_names": ["const_string_output", "double_output", "geom_output", "int_output", "srs_output", "string_output", "void_output"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.prototypes.generation import \\\n const_string_output, double_output, geom_output, int_output, \\\n srs_output, string_output, void_output"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L12_C0", "label": "env_func", "type": "function", "loc": [12, 17], "level": 0, "parent": null, "vector": [2, 0, 0.1368, 0.0566, 0, 0.66, 0.1273, 648, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "env_func", "arg_names": ["f", "argtypes"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def env_func(f, argtypes):\n \"For getting OGREnvelopes.\"\n f.argtypes = argtypes\n f.restype = None\n f.errcheck = check_envelope\n return f"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Expr_L13_C4", "label": "expression", "type": "expression", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L12_C0", "vector": [8, 1, 0.1226, 0.0094, 1, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"For getting OGREnvelopes.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L14_C4", "label": "f.argtypes =", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L12_C0", "vector": [14, 1, 0.1321, 0.0094, 1, 0.41, 0.25, 544, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "f.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " f.argtypes = argtypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L15_C4", "label": "f.restype =", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L12_C0", "vector": [14, 1, 0.1415, 0.0094, 1, 0.41, 0.5, 762, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "f.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " f.restype = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L16_C4", "label": "f.errcheck =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L12_C0", "vector": [14, 1, 0.1509, 0.0094, 1, 0.41, 0.75, 535, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "f.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " f.errcheck = check_envelope"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Return_L17_C4", "label": "return", "type": "return", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L12_C0", "vector": [13, 1, 0.1604, 0.0094, 1, 0.41, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return f"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L19_C0", "label": "pnt_func", "type": "function", "loc": [19, 21], "level": 0, "parent": null, "vector": [2, 0, 0.1887, 0.0283, 0, 0.66, 0.1455, 398, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "pnt_func", "arg_names": ["f"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def pnt_func(f):\n \"For accessing point information.\"\n return double_output(f, [c_void_p, c_int])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Expr_L20_C4", "label": "expression", "type": "expression", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L19_C0", "vector": [8, 1, 0.1887, 0.0094, 1, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"For accessing point information.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Return_L21_C4", "label": "return", "type": "return", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L19_C0", "vector": [13, 1, 0.1981, 0.0094, 1, 0.88, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return double_output(f, [c_void_p, c_int])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L23_C0", "label": "topology_func", "type": "function", "loc": [23, 27], "level": 0, "parent": null, "vector": [2, 0, 0.2358, 0.0472, 0, 0.66, 0.1636, 336, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "topology_func", "arg_names": ["f"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def topology_func(f):\n f.argtypes = [c_void_p, c_void_p]\n f.restype = c_int\n f.errchck = check_bool\n return f"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L24_C4", "label": "f.argtypes =", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L23_C0", "vector": [14, 1, 0.2264, 0.0094, 1, 0.69, 0.0, 544, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "f.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " f.argtypes = [c_void_p, c_void_p]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L25_C4", "label": "f.restype =", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L23_C0", "vector": [14, 1, 0.2358, 0.0094, 1, 0.69, 0.3333, 762, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "f.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " f.restype = c_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L26_C4", "label": "f.errchck =", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L23_C0", "vector": [14, 1, 0.2453, 0.0094, 1, 0.69, 0.6667, 416, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "f.errchck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " f.errchck = check_bool"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Return_L27_C4", "label": "return", "type": "return", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L23_C0", "vector": [13, 1, 0.2547, 0.0094, 1, 0.69, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return f"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:If_L32_C0", "label": "if", "type": "if", "loc": [32, 39], "level": 0, "parent": null, "vector": [4, 0, 0.3349, 0.0755, 0, 0.66, 0.1818, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if GEOJSON:\n from_json = geom_output(lgdal.OGR_G_CreateGeometryFromJson, [c_char_p])\n to_json = string_output(lgdal.OGR_G_ExportToJson, [c_void_p], str_result=True)\n to_kml = string_output(lgdal.OGR_G_ExportToKML, [c_void_p, c_char_p], str_result=True) \nelse:\n from_json = False\n to_json = False\n to_kml = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L33_C4", "label": "from_json = geom_output()", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98701:If_L32_C0", "vector": [14, 1, 0.3113, 0.0094, 1, 0.9, 0.0, 975, 3, 2, 0, 0, 16, 10, 1], "semantic": {"name": "from_json", "arg_names": [], "import_names": [], "rhs_call_name": "geom_output", "annotation": ""}, "snippet": " from_json = geom_output(lgdal.OGR_G_CreateGeometryFromJson, [c_char_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L34_C4", "label": "to_json = string_output()", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98701:If_L32_C0", "vector": [14, 1, 0.3208, 0.0094, 1, 0.9, 0.2, 287, 3, 3, 0, 0, 345, 10, 1], "semantic": {"name": "to_json", "arg_names": [], "import_names": [], "rhs_call_name": "string_output", "annotation": ""}, "snippet": " to_json = string_output(lgdal.OGR_G_ExportToJson, [c_void_p], str_result=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L35_C4", "label": "to_kml = string_output()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98701:If_L32_C0", "vector": [14, 1, 0.3302, 0.0094, 1, 0.9, 0.4, 516, 3, 3, 0, 0, 345, 10, 1], "semantic": {"name": "to_kml", "arg_names": [], "import_names": [], "rhs_call_name": "string_output", "annotation": ""}, "snippet": " to_kml = string_output(lgdal.OGR_G_ExportToKML, [c_void_p, c_char_p], str_result=True) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L37_C4", "label": "from_json =", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98701:If_L32_C0", "vector": [14, 1, 0.3491, 0.0094, 1, 0.9, 0.6, 975, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "from_json", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " from_json = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L38_C4", "label": "to_json =", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98701:If_L32_C0", "vector": [14, 1, 0.3585, 0.0094, 1, 0.9, 0.8, 287, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "to_json", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " to_json = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L39_C4", "label": "to_kml =", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98701:If_L32_C0", "vector": [14, 1, 0.3679, 0.0094, 1, 0.9, 1.0, 516, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "to_kml", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " to_kml = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L42_C0", "label": "getx = pnt_func()", "type": "assigned_variable", "loc": [42, 42], "level": 0, "parent": null, "vector": [14, 0, 0.3962, 0.0094, 0, 0.66, 0.2, 40, 3, 1, 0, 0, 398, 10, 1], "semantic": {"name": "getx", "arg_names": [], "import_names": [], "rhs_call_name": "pnt_func", "annotation": ""}, "snippet": "getx = pnt_func(lgdal.OGR_G_GetX)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L43_C0", "label": "gety = pnt_func()", "type": "assigned_variable", "loc": [43, 43], "level": 0, "parent": null, "vector": [14, 0, 0.4057, 0.0094, 0, 0.66, 0.2182, 193, 3, 1, 0, 0, 398, 10, 1], "semantic": {"name": "gety", "arg_names": [], "import_names": [], "rhs_call_name": "pnt_func", "annotation": ""}, "snippet": "gety = pnt_func(lgdal.OGR_G_GetY)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L44_C0", "label": "getz = pnt_func()", "type": "assigned_variable", "loc": [44, 44], "level": 0, "parent": null, "vector": [14, 0, 0.4151, 0.0094, 0, 0.66, 0.2364, 102, 3, 1, 0, 0, 398, 10, 1], "semantic": {"name": "getz", "arg_names": [], "import_names": [], "rhs_call_name": "pnt_func", "annotation": ""}, "snippet": "getz = pnt_func(lgdal.OGR_G_GetZ)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L47_C0", "label": "from_wkb = geom_output()", "type": "assigned_variable", "loc": [47, 47], "level": 0, "parent": null, "vector": [14, 0, 0.4434, 0.0094, 0, 0.66, 0.2545, 581, 3, 3, 0, 0, 16, 10, 2], "semantic": {"name": "from_wkb", "arg_names": [], "import_names": [], "rhs_call_name": "geom_output", "annotation": ""}, "snippet": "from_wkb = geom_output(lgdal.OGR_G_CreateFromWkb, [c_char_p, c_void_p, POINTER(c_void_p), c_int], offset=-2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L48_C0", "label": "from_wkt = geom_output()", "type": "assigned_variable", "loc": [48, 48], "level": 0, "parent": null, "vector": [14, 0, 0.4528, 0.0094, 0, 0.66, 0.2727, 252, 3, 3, 0, 0, 16, 10, 3], "semantic": {"name": "from_wkt", "arg_names": [], "import_names": [], "rhs_call_name": "geom_output", "annotation": ""}, "snippet": "from_wkt = geom_output(lgdal.OGR_G_CreateFromWkt, [POINTER(c_char_p), c_void_p, POINTER(c_void_p)], offset=-1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L49_C0", "label": "create_geom = geom_output()", "type": "assigned_variable", "loc": [49, 49], "level": 0, "parent": null, "vector": [14, 0, 0.4623, 0.0094, 0, 0.66, 0.2909, 725, 3, 2, 0, 0, 16, 10, 1], "semantic": {"name": "create_geom", "arg_names": [], "import_names": [], "rhs_call_name": "geom_output", "annotation": ""}, "snippet": "create_geom = geom_output(lgdal.OGR_G_CreateGeometry, [c_int])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L50_C0", "label": "clone_geom = geom_output()", "type": "assigned_variable", "loc": [50, 50], "level": 0, "parent": null, "vector": [14, 0, 0.4717, 0.0094, 0, 0.66, 0.3091, 38, 3, 2, 0, 0, 16, 10, 1], "semantic": {"name": "clone_geom", "arg_names": [], "import_names": [], "rhs_call_name": "geom_output", "annotation": ""}, "snippet": "clone_geom = geom_output(lgdal.OGR_G_Clone, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L51_C0", "label": "get_geom_ref = geom_output()", "type": "assigned_variable", "loc": [51, 51], "level": 0, "parent": null, "vector": [14, 0, 0.4811, 0.0094, 0, 0.66, 0.3273, 339, 3, 2, 0, 0, 16, 10, 1], "semantic": {"name": "get_geom_ref", "arg_names": [], "import_names": [], "rhs_call_name": "geom_output", "annotation": ""}, "snippet": "get_geom_ref = geom_output(lgdal.OGR_G_GetGeometryRef, [c_void_p, c_int])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L52_C0", "label": "get_boundary = geom_output()", "type": "assigned_variable", "loc": [52, 52], "level": 0, "parent": null, "vector": [14, 0, 0.4906, 0.0094, 0, 0.66, 0.3455, 571, 3, 2, 0, 0, 16, 10, 1], "semantic": {"name": "get_boundary", "arg_names": [], "import_names": [], "rhs_call_name": "geom_output", "annotation": ""}, "snippet": "get_boundary = geom_output(lgdal.OGR_G_GetBoundary, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L53_C0", "label": "geom_convex_hull = geom_output()", "type": "assigned_variable", "loc": [53, 53], "level": 0, "parent": null, "vector": [14, 0, 0.5, 0.0094, 0, 0.66, 0.3636, 687, 3, 2, 0, 0, 16, 10, 1], "semantic": {"name": "geom_convex_hull", "arg_names": [], "import_names": [], "rhs_call_name": "geom_output", "annotation": ""}, "snippet": "geom_convex_hull = geom_output(lgdal.OGR_G_ConvexHull, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L54_C0", "label": "geom_diff = geom_output()", "type": "assigned_variable", "loc": [54, 54], "level": 0, "parent": null, "vector": [14, 0, 0.5094, 0.0094, 0, 0.66, 0.3818, 277, 3, 2, 0, 0, 16, 10, 1], "semantic": {"name": "geom_diff", "arg_names": [], "import_names": [], "rhs_call_name": "geom_output", "annotation": ""}, "snippet": "geom_diff = geom_output(lgdal.OGR_G_Difference, [c_void_p, c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L55_C0", "label": "geom_intersection = geom_output()", "type": "assigned_variable", "loc": [55, 55], "level": 0, "parent": null, "vector": [14, 0, 0.5189, 0.0094, 0, 0.66, 0.4, 524, 3, 2, 0, 0, 16, 10, 1], "semantic": {"name": "geom_intersection", "arg_names": [], "import_names": [], "rhs_call_name": "geom_output", "annotation": ""}, "snippet": "geom_intersection = geom_output(lgdal.OGR_G_Intersection, [c_void_p, c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L56_C0", "label": "geom_sym_diff = geom_output()", "type": "assigned_variable", "loc": [56, 56], "level": 0, "parent": null, "vector": [14, 0, 0.5283, 0.0094, 0, 0.66, 0.4182, 600, 3, 2, 0, 0, 16, 10, 1], "semantic": {"name": "geom_sym_diff", "arg_names": [], "import_names": [], "rhs_call_name": "geom_output", "annotation": ""}, "snippet": "geom_sym_diff = geom_output(lgdal.OGR_G_SymmetricDifference, [c_void_p, c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L57_C0", "label": "geom_union = geom_output()", "type": "assigned_variable", "loc": [57, 57], "level": 0, "parent": null, "vector": [14, 0, 0.5377, 0.0094, 0, 0.66, 0.4364, 978, 3, 2, 0, 0, 16, 10, 1], "semantic": {"name": "geom_union", "arg_names": [], "import_names": [], "rhs_call_name": "geom_output", "annotation": ""}, "snippet": "geom_union = geom_output(lgdal.OGR_G_Union, [c_void_p, c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L60_C0", "label": "add_geom = void_output()", "type": "assigned_variable", "loc": [60, 60], "level": 0, "parent": null, "vector": [14, 0, 0.566, 0.0094, 0, 0.66, 0.4545, 959, 3, 2, 0, 0, 301, 10, 1], "semantic": {"name": "add_geom", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "add_geom = void_output(lgdal.OGR_G_AddGeometry, [c_void_p, c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L61_C0", "label": "import_wkt = void_output()", "type": "assigned_variable", "loc": [61, 61], "level": 0, "parent": null, "vector": [14, 0, 0.5755, 0.0094, 0, 0.66, 0.4727, 796, 3, 2, 0, 0, 301, 10, 2], "semantic": {"name": "import_wkt", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "import_wkt = void_output(lgdal.OGR_G_ImportFromWkt, [c_void_p, POINTER(c_char_p)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L64_C0", "label": "destroy_geom = void_output()", "type": "assigned_variable", "loc": [64, 64], "level": 0, "parent": null, "vector": [14, 0, 0.6038, 0.0094, 0, 0.66, 0.4909, 266, 3, 3, 0, 0, 301, 10, 1], "semantic": {"name": "destroy_geom", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "destroy_geom = void_output(lgdal.OGR_G_DestroyGeometry, [c_void_p], errcheck=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L67_C0", "label": "to_wkb = void_output()", "type": "assigned_variable", "loc": [67, 67], "level": 0, "parent": null, "vector": [14, 0, 0.6321, 0.0094, 0, 0.66, 0.5091, 265, 3, 3, 0, 0, 301, 10, 1], "semantic": {"name": "to_wkb", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "to_wkb = void_output(lgdal.OGR_G_ExportToWkb, None, errcheck=True) # special handling for WKB."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L68_C0", "label": "to_wkt = string_output()", "type": "assigned_variable", "loc": [68, 68], "level": 0, "parent": null, "vector": [14, 0, 0.6415, 0.0094, 0, 0.66, 0.5273, 255, 3, 2, 0, 0, 345, 10, 2], "semantic": {"name": "to_wkt", "arg_names": [], "import_names": [], "rhs_call_name": "string_output", "annotation": ""}, "snippet": "to_wkt = string_output(lgdal.OGR_G_ExportToWkt, [c_void_p, POINTER(c_char_p)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L69_C0", "label": "to_gml = string_output()", "type": "assigned_variable", "loc": [69, 69], "level": 0, "parent": null, "vector": [14, 0, 0.6509, 0.0094, 0, 0.66, 0.5455, 781, 3, 3, 0, 0, 345, 10, 1], "semantic": {"name": "to_gml", "arg_names": [], "import_names": [], "rhs_call_name": "string_output", "annotation": ""}, "snippet": "to_gml = string_output(lgdal.OGR_G_ExportToGML, [c_void_p], str_result=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L70_C0", "label": "get_wkbsize = int_output()", "type": "assigned_variable", "loc": [70, 70], "level": 0, "parent": null, "vector": [14, 0, 0.6604, 0.0094, 0, 0.66, 0.5636, 975, 3, 2, 0, 0, 974, 10, 1], "semantic": {"name": "get_wkbsize", "arg_names": [], "import_names": [], "rhs_call_name": "int_output", "annotation": ""}, "snippet": "get_wkbsize = int_output(lgdal.OGR_G_WkbSize, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L73_C0", "label": "assign_srs = void_output()", "type": "assigned_variable", "loc": [73, 73], "level": 0, "parent": null, "vector": [14, 0, 0.6887, 0.0094, 0, 0.66, 0.5818, 984, 3, 3, 0, 0, 301, 10, 1], "semantic": {"name": "assign_srs", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "assign_srs = void_output(lgdal.OGR_G_AssignSpatialReference, [c_void_p, c_void_p], errcheck=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L74_C0", "label": "get_geom_srs = srs_output()", "type": "assigned_variable", "loc": [74, 74], "level": 0, "parent": null, "vector": [14, 0, 0.6981, 0.0094, 0, 0.66, 0.6, 75, 3, 2, 0, 0, 98, 10, 1], "semantic": {"name": "get_geom_srs", "arg_names": [], "import_names": [], "rhs_call_name": "srs_output", "annotation": ""}, "snippet": "get_geom_srs = srs_output(lgdal.OGR_G_GetSpatialReference, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L77_C0", "label": "get_area = double_output()", "type": "assigned_variable", "loc": [77, 77], "level": 0, "parent": null, "vector": [14, 0, 0.7264, 0.0094, 0, 0.66, 0.6182, 910, 3, 2, 0, 0, 485, 10, 1], "semantic": {"name": "get_area", "arg_names": [], "import_names": [], "rhs_call_name": "double_output", "annotation": ""}, "snippet": "get_area = double_output(lgdal.OGR_G_GetArea, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L78_C0", "label": "get_centroid = void_output()", "type": "assigned_variable", "loc": [78, 78], "level": 0, "parent": null, "vector": [14, 0, 0.7358, 0.0094, 0, 0.66, 0.6364, 212, 3, 2, 0, 0, 301, 10, 1], "semantic": {"name": "get_centroid", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "get_centroid = void_output(lgdal.OGR_G_Centroid, [c_void_p, c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L79_C0", "label": "get_dims = int_output()", "type": "assigned_variable", "loc": [79, 79], "level": 0, "parent": null, "vector": [14, 0, 0.7453, 0.0094, 0, 0.66, 0.6545, 558, 3, 2, 0, 0, 974, 10, 1], "semantic": {"name": "get_dims", "arg_names": [], "import_names": [], "rhs_call_name": "int_output", "annotation": ""}, "snippet": "get_dims = int_output(lgdal.OGR_G_GetDimension, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L80_C0", "label": "get_coord_dim = int_output()", "type": "assigned_variable", "loc": [80, 80], "level": 0, "parent": null, "vector": [14, 0, 0.7547, 0.0094, 0, 0.66, 0.6727, 299, 3, 2, 0, 0, 974, 10, 1], "semantic": {"name": "get_coord_dim", "arg_names": [], "import_names": [], "rhs_call_name": "int_output", "annotation": ""}, "snippet": "get_coord_dim = int_output(lgdal.OGR_G_GetCoordinateDimension, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L81_C0", "label": "set_coord_dim = void_output()", "type": "assigned_variable", "loc": [81, 81], "level": 0, "parent": null, "vector": [14, 0, 0.7642, 0.0094, 0, 0.66, 0.6909, 687, 3, 3, 0, 0, 301, 10, 1], "semantic": {"name": "set_coord_dim", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "set_coord_dim = void_output(lgdal.OGR_G_SetCoordinateDimension, [c_void_p, c_int], errcheck=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L83_C0", "label": "get_geom_count = int_output()", "type": "assigned_variable", "loc": [83, 83], "level": 0, "parent": null, "vector": [14, 0, 0.783, 0.0094, 0, 0.66, 0.7091, 678, 3, 2, 0, 0, 974, 10, 1], "semantic": {"name": "get_geom_count", "arg_names": [], "import_names": [], "rhs_call_name": "int_output", "annotation": ""}, "snippet": "get_geom_count = int_output(lgdal.OGR_G_GetGeometryCount, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L84_C0", "label": "get_geom_name = const_string_output()", "type": "assigned_variable", "loc": [84, 84], "level": 0, "parent": null, "vector": [14, 0, 0.7925, 0.0094, 0, 0.66, 0.7273, 563, 3, 2, 0, 0, 611, 10, 1], "semantic": {"name": "get_geom_name", "arg_names": [], "import_names": [], "rhs_call_name": "const_string_output", "annotation": ""}, "snippet": "get_geom_name = const_string_output(lgdal.OGR_G_GetGeometryName, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L85_C0", "label": "get_geom_type = int_output()", "type": "assigned_variable", "loc": [85, 85], "level": 0, "parent": null, "vector": [14, 0, 0.8019, 0.0094, 0, 0.66, 0.7455, 796, 3, 2, 0, 0, 974, 10, 1], "semantic": {"name": "get_geom_type", "arg_names": [], "import_names": [], "rhs_call_name": "int_output", "annotation": ""}, "snippet": "get_geom_type = int_output(lgdal.OGR_G_GetGeometryType, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L86_C0", "label": "get_point_count = int_output()", "type": "assigned_variable", "loc": [86, 86], "level": 0, "parent": null, "vector": [14, 0, 0.8113, 0.0094, 0, 0.66, 0.7636, 125, 3, 2, 0, 0, 974, 10, 1], "semantic": {"name": "get_point_count", "arg_names": [], "import_names": [], "rhs_call_name": "int_output", "annotation": ""}, "snippet": "get_point_count = int_output(lgdal.OGR_G_GetPointCount, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L87_C0", "label": "get_point = void_output()", "type": "assigned_variable", "loc": [87, 87], "level": 0, "parent": null, "vector": [14, 0, 0.8208, 0.0094, 0, 0.66, 0.7818, 346, 3, 3, 0, 0, 301, 10, 4], "semantic": {"name": "get_point", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "get_point = void_output(lgdal.OGR_G_GetPoint, [c_void_p, c_int, POINTER(c_double), POINTER(c_double), POINTER(c_double)], errcheck=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L88_C0", "label": "geom_close_rings = void_output()", "type": "assigned_variable", "loc": [88, 88], "level": 0, "parent": null, "vector": [14, 0, 0.8302, 0.0094, 0, 0.66, 0.8, 949, 3, 3, 0, 0, 301, 10, 1], "semantic": {"name": "geom_close_rings", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "geom_close_rings = void_output(lgdal.OGR_G_CloseRings, [c_void_p], errcheck=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L91_C0", "label": "ogr_contains = topology_func()", "type": "assigned_variable", "loc": [91, 91], "level": 0, "parent": null, "vector": [14, 0, 0.8585, 0.0094, 0, 0.66, 0.8182, 980, 3, 1, 0, 0, 336, 10, 1], "semantic": {"name": "ogr_contains", "arg_names": [], "import_names": [], "rhs_call_name": "topology_func", "annotation": ""}, "snippet": "ogr_contains = topology_func(lgdal.OGR_G_Contains)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L92_C0", "label": "ogr_crosses = topology_func()", "type": "assigned_variable", "loc": [92, 92], "level": 0, "parent": null, "vector": [14, 0, 0.8679, 0.0094, 0, 0.66, 0.8364, 542, 3, 1, 0, 0, 336, 10, 1], "semantic": {"name": "ogr_crosses", "arg_names": [], "import_names": [], "rhs_call_name": "topology_func", "annotation": ""}, "snippet": "ogr_crosses = topology_func(lgdal.OGR_G_Crosses)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L93_C0", "label": "ogr_disjoint = topology_func()", "type": "assigned_variable", "loc": [93, 93], "level": 0, "parent": null, "vector": [14, 0, 0.8774, 0.0094, 0, 0.66, 0.8545, 702, 3, 1, 0, 0, 336, 10, 1], "semantic": {"name": "ogr_disjoint", "arg_names": [], "import_names": [], "rhs_call_name": "topology_func", "annotation": ""}, "snippet": "ogr_disjoint = topology_func(lgdal.OGR_G_Disjoint)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L94_C0", "label": "ogr_equals = topology_func()", "type": "assigned_variable", "loc": [94, 94], "level": 0, "parent": null, "vector": [14, 0, 0.8868, 0.0094, 0, 0.66, 0.8727, 416, 3, 1, 0, 0, 336, 10, 1], "semantic": {"name": "ogr_equals", "arg_names": [], "import_names": [], "rhs_call_name": "topology_func", "annotation": ""}, "snippet": "ogr_equals = topology_func(lgdal.OGR_G_Equals)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L95_C0", "label": "ogr_intersects = topology_func()", "type": "assigned_variable", "loc": [95, 95], "level": 0, "parent": null, "vector": [14, 0, 0.8962, 0.0094, 0, 0.66, 0.8909, 748, 3, 1, 0, 0, 336, 10, 1], "semantic": {"name": "ogr_intersects", "arg_names": [], "import_names": [], "rhs_call_name": "topology_func", "annotation": ""}, "snippet": "ogr_intersects = topology_func(lgdal.OGR_G_Intersects)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L96_C0", "label": "ogr_overlaps = topology_func()", "type": "assigned_variable", "loc": [96, 96], "level": 0, "parent": null, "vector": [14, 0, 0.9057, 0.0094, 0, 0.66, 0.9091, 212, 3, 1, 0, 0, 336, 10, 1], "semantic": {"name": "ogr_overlaps", "arg_names": [], "import_names": [], "rhs_call_name": "topology_func", "annotation": ""}, "snippet": "ogr_overlaps = topology_func(lgdal.OGR_G_Overlaps)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L97_C0", "label": "ogr_touches = topology_func()", "type": "assigned_variable", "loc": [97, 97], "level": 0, "parent": null, "vector": [14, 0, 0.9151, 0.0094, 0, 0.66, 0.9273, 285, 3, 1, 0, 0, 336, 10, 1], "semantic": {"name": "ogr_touches", "arg_names": [], "import_names": [], "rhs_call_name": "topology_func", "annotation": ""}, "snippet": "ogr_touches = topology_func(lgdal.OGR_G_Touches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L98_C0", "label": "ogr_within = topology_func()", "type": "assigned_variable", "loc": [98, 98], "level": 0, "parent": null, "vector": [14, 0, 0.9245, 0.0094, 0, 0.66, 0.9455, 204, 3, 1, 0, 0, 336, 10, 1], "semantic": {"name": "ogr_within", "arg_names": [], "import_names": [], "rhs_call_name": "topology_func", "annotation": ""}, "snippet": "ogr_within = topology_func(lgdal.OGR_G_Within)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L101_C0", "label": "geom_transform = void_output()", "type": "assigned_variable", "loc": [101, 101], "level": 0, "parent": null, "vector": [14, 0, 0.9528, 0.0094, 0, 0.66, 0.9636, 340, 3, 2, 0, 0, 301, 10, 1], "semantic": {"name": "geom_transform", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "geom_transform = void_output(lgdal.OGR_G_Transform, [c_void_p, c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L102_C0", "label": "geom_transform_to = void_output()", "type": "assigned_variable", "loc": [102, 102], "level": 0, "parent": null, "vector": [14, 0, 0.9623, 0.0094, 0, 0.66, 0.9818, 274, 3, 2, 0, 0, 301, 10, 1], "semantic": {"name": "geom_transform_to", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "geom_transform_to = void_output(lgdal.OGR_G_TransformTo, [c_void_p, c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L105_C0", "label": "get_envelope = env_func()", "type": "assigned_variable", "loc": [105, 105], "level": 0, "parent": null, "vector": [14, 0, 0.9906, 0.0094, 0, 0.66, 1.0, 311, 3, 2, 0, 0, 648, 10, 2], "semantic": {"name": "get_envelope", "arg_names": [], "import_names": [], "rhs_call_name": "env_func", "annotation": ""}, "snippet": "get_envelope = env_func(lgdal.OGR_G_GetEnvelope, [c_void_p, POINTER(OGREnvelope)])"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98701:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98701:Return_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98701:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98701:Return_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98701:Return_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98701:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98701:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98701:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98701:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98701:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98701:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98701:Assign_L39_C4"}] |
"""
This module houses the error-checking routines used by the GDAL
ctypes prototypes.
"""
from ctypes import c_void_p, string_at
from django.contrib.gis.gdal.error import check_err, OGRException, SRSException
from django.contrib.gis.gdal.libgdal import lgdal
# Helper routines for retrieving pointers and/or values from
# arguments passed in by reference.
def arg_byref(args, offset=-1):
"Returns the pointer argument's by-refernece value."
return args[offset]._obj.value
def ptr_byref(args, offset=-1):
"Returns the pointer argument passed in by-reference."
return args[offset]._obj
def check_bool(result, func, cargs):
"Returns the boolean evaluation of the value."
if bool(result): return True
else: return False
### String checking Routines ###
def check_const_string(result, func, cargs, offset=None):
"""
Similar functionality to `check_string`, but does not free the pointer.
"""
if offset:
check_err(result)
ptr = ptr_byref(cargs, offset)
return ptr.value
else:
return result
def check_string(result, func, cargs, offset=-1, str_result=False):
"""
Checks the string output returned from the given function, and frees
the string pointer allocated by OGR. The `str_result` keyword
may be used when the result is the string pointer, otherwise
the OGR error code is assumed. The `offset` keyword may be used
to extract the string pointer passed in by-reference at the given
slice offset in the function arguments.
"""
if str_result:
# For routines that return a string.
ptr = result
if not ptr: s = None
else: s = string_at(result)
else:
# Error-code return specified.
check_err(result)
ptr = ptr_byref(cargs, offset)
# Getting the string value
s = ptr.value
# Correctly freeing the allocated memory beind GDAL pointer
# w/the VSIFree routine.
if ptr: lgdal.VSIFree(ptr)
return s
### DataSource, Layer error-checking ###
### Envelope checking ###
def check_envelope(result, func, cargs, offset=-1):
"Checks a function that returns an OGR Envelope by reference."
env = ptr_byref(cargs, offset)
return env
### Geometry error-checking routines ###
def check_geom(result, func, cargs):
"Checks a function that returns a geometry."
# OGR_G_Clone may return an integer, even though the
# restype is set to c_void_p
if isinstance(result, (int, long)):
result = c_void_p(result)
if not result:
raise OGRException('Invalid geometry pointer returned from "%s".' % func.__name__)
return result
def check_geom_offset(result, func, cargs, offset=-1):
"Chcks the geometry at the given offset in the C parameter list."
check_err(result)
geom = ptr_byref(cargs, offset=offset)
return check_geom(geom, func, cargs)
### Spatial Reference error-checking routines ###
def check_srs(result, func, cargs):
if isinstance(result, (int, long)):
result = c_void_p(result)
if not result:
raise SRSException('Invalid spatial reference pointer returned from "%s".' % func.__name__)
return result
### Other error-checking routines ###
def check_arg_errcode(result, func, cargs):
"""
The error code is returned in the last argument, by reference.
Check its value with `check_err` before returning the result.
"""
check_err(arg_byref(cargs))
return result
def check_errcode(result, func, cargs):
"""
Check the error code returned (c_int).
"""
check_err(result)
return
def check_pointer(result, func, cargs):
"Makes sure the result pointer is valid."
if isinstance(result, (int, long)):
result = c_void_p(result)
if bool(result):
return result
else:
raise OGRException('Invalid pointer returned from "%s"' % func.__name__)
def check_str_arg(result, func, cargs):
"""
This is for the OSRGet[Angular|Linear]Units functions, which
require that the returned string pointer not be freed. This
returns both the double and tring values.
"""
dbl = result
ptr = cargs[-1]._obj
return dbl, ptr.value
| ajibawa-2023/Python-Code-Large/train/row_98702 | 74 | 127 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0197, 0.0315, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n This module houses the error-checking routines used by the GDAL\n ctypes prototypes.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:ImportFrom_L5_C0", "label": "from ctypes import c_void_p, string_at", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0394, 0.0079, 0, 0.66, 0.0625, 182, 0, 2, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_void_p", "string_at"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import c_void_p, string_at"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:ImportFrom_L6_C0", "label": "from django.contrib.gis.gdal.error import check_err, OGRException, SRSException", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0472, 0.0079, 0, 0.66, 0.125, 76, 0, 3, 0, 0, 76, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.error", "arg_names": [], "import_names": ["check_err", "OGRException", "SRSException"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.error import check_err, OGRException, SRSException"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:ImportFrom_L7_C0", "label": "from django.contrib.gis.gdal.libgdal import lgdal", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0551, 0.0079, 0, 0.66, 0.1875, 460, 0, 1, 0, 0, 460, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.libgdal", "arg_names": [], "import_names": ["lgdal"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.libgdal import lgdal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L11_C0", "label": "arg_byref", "type": "function", "loc": [11, 13], "level": 0, "parent": null, "vector": [2, 0, 0.0945, 0.0236, 0, 0.66, 0.25, 211, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "arg_byref", "arg_names": ["args", "offset"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def arg_byref(args, offset=-1):\n \"Returns the pointer argument's by-refernece value.\"\n return args[offset]._obj.value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L12_C4", "label": "expression", "type": "expression", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L11_C0", "vector": [8, 1, 0.0945, 0.0079, 1, 0.24, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the pointer argument's by-refernece value.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L13_C4", "label": "return", "type": "return", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L11_C0", "vector": [13, 1, 0.1024, 0.0079, 1, 0.24, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return args[offset]._obj.value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L15_C0", "label": "ptr_byref", "type": "function", "loc": [15, 17], "level": 0, "parent": null, "vector": [2, 0, 0.126, 0.0236, 0, 0.66, 0.3125, 951, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "ptr_byref", "arg_names": ["args", "offset"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def ptr_byref(args, offset=-1):\n \"Returns the pointer argument passed in by-reference.\"\n return args[offset]._obj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L16_C4", "label": "expression", "type": "expression", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L15_C0", "vector": [8, 1, 0.126, 0.0079, 1, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the pointer argument passed in by-reference.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L17_C4", "label": "return", "type": "return", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L15_C0", "vector": [13, 1, 0.1339, 0.0079, 1, 0.84, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return args[offset]._obj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L19_C0", "label": "check_bool", "type": "function", "loc": [19, 22], "level": 0, "parent": null, "vector": [2, 0, 0.1614, 0.0315, 0, 0.66, 0.375, 606, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "check_bool", "arg_names": ["result", "func", "cargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_bool(result, func, cargs):\n \"Returns the boolean evaluation of the value.\"\n if bool(result): return True\n else: return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L20_C4", "label": "expression", "type": "expression", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L19_C0", "vector": [8, 1, 0.1575, 0.0079, 1, 0.06, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the boolean evaluation of the value.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L21_C4", "label": "if", "type": "if", "loc": [21, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L19_C0", "vector": [4, 1, 0.1693, 0.0157, 1, 0.06, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if bool(result): return True\n else: return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L21_C21", "label": "return", "type": "return", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L21_C4", "vector": [13, 2, 0.1654, 0.0079, 2, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if bool(result): return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L22_C10", "label": "return", "type": "return", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L21_C4", "vector": [13, 2, 0.1732, 0.0079, 2, 0.54, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " else: return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L25_C0", "label": "check_const_string", "type": "function", "loc": [25, 34], "level": 0, "parent": null, "vector": [2, 0, 0.2323, 0.0787, 0, 0.66, 0.4375, 99, 0, 4, 1, 0, 0, 0, 2], "semantic": {"name": "check_const_string", "arg_names": ["result", "func", "cargs", "offset"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_const_string(result, func, cargs, offset=None):\n \"\"\"\n Similar functionality to `check_string`, but does not free the pointer.\n \"\"\"\n if offset:\n check_err(result)\n ptr = ptr_byref(cargs, offset)\n return ptr.value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L26_C4", "label": "expression", "type": "expression", "loc": [26, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L25_C0", "vector": [8, 1, 0.2126, 0.0236, 1, 0.36, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Similar functionality to `check_string`, but does not free the pointer.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L29_C4", "label": "if", "type": "if", "loc": [29, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L25_C0", "vector": [4, 1, 0.248, 0.0472, 1, 0.36, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if offset:\n check_err(result)\n ptr = ptr_byref(cargs, offset)\n return ptr.value\n else:\n return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L30_C8", "label": "check_err()", "type": "expression", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L29_C4", "vector": [8, 2, 0.2362, 0.0079, 2, 0.46, 0.0, 825, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "check_err", "arg_names": [], "import_names": [], "rhs_call_name": "check_err", "annotation": ""}, "snippet": " check_err(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L31_C8", "label": "ptr = ptr_byref()", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L29_C4", "vector": [14, 2, 0.2441, 0.0079, 2, 0.46, 0.3333, 676, 3, 2, 0, 0, 951, 10, 1], "semantic": {"name": "ptr", "arg_names": [], "import_names": [], "rhs_call_name": "ptr_byref", "annotation": ""}, "snippet": " ptr = ptr_byref(cargs, offset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L32_C8", "label": "return", "type": "return", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L29_C4", "vector": [13, 2, 0.252, 0.0079, 2, 0.46, 0.6667, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ptr.value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L34_C8", "label": "return", "type": "return", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L29_C4", "vector": [13, 2, 0.2677, 0.0079, 2, 0.46, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L36_C0", "label": "check_string", "type": "function", "loc": [36, 59], "level": 0, "parent": null, "vector": [2, 0, 0.374, 0.189, 0, 0.66, 0.5, 148, 0, 5, 1, 0, 0, 0, 4], "semantic": {"name": "check_string", "arg_names": ["result", "func", "cargs", "offset", "str_result"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_string(result, func, cargs, offset=-1, str_result=False):\n \"\"\"\n Checks the string output returned from the given function, and frees\n the string pointer allocated by OGR. The `str_result` keyword\n may be used when the result is the string pointer, otherwise\n the OGR error code is assumed. The `offset` keyword may be used\n to extract the string pointer passed in by-reference at the given\n slice offset in the function arguments."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L37_C4", "label": "expression", "type": "expression", "loc": [37, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L36_C0", "vector": [8, 1, 0.3189, 0.063, 1, 0.77, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Checks the string output returned from the given function, and frees\n the string pointer allocated by OGR. The `str_result` keyword\n may be used when the result is the string pointer, otherwise\n the OGR error code is assumed. The `offset` keyword may be used\n to extract the string pointer passed in by-reference at the given\n slice offset in the function arguments.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L45_C4", "label": "if", "type": "if", "loc": [45, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L36_C0", "vector": [4, 1, 0.3937, 0.0866, 1, 0.77, 0.3333, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if str_result:\n # For routines that return a string.\n ptr = result\n if not ptr: s = None\n else: s = string_at(result)\n else:\n # Error-code return specified.\n check_err(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L47_C8", "label": "ptr =", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L45_C4", "vector": [14, 2, 0.3701, 0.0079, 2, 0.66, 0.0, 676, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ptr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ptr = result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L48_C8", "label": "if", "type": "if", "loc": [48, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L45_C4", "vector": [4, 2, 0.3819, 0.0157, 2, 0.66, 0.25, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not ptr: s = None\n else: s = string_at(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L48_C20", "label": "s =", "type": "assigned_variable", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L48_C8", "vector": [14, 3, 0.378, 0.0079, 3, 0.43, 0.0, 553, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not ptr: s = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L49_C14", "label": "s = string_at()", "type": "assigned_variable", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L48_C8", "vector": [14, 3, 0.3858, 0.0079, 3, 0.43, 1.0, 553, 3, 1, 0, 0, 714, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "string_at", "annotation": ""}, "snippet": " else: s = string_at(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L52_C8", "label": "check_err()", "type": "expression", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L45_C4", "vector": [8, 2, 0.4094, 0.0079, 2, 0.66, 0.5, 825, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "check_err", "arg_names": [], "import_names": [], "rhs_call_name": "check_err", "annotation": ""}, "snippet": " check_err(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L53_C8", "label": "ptr = ptr_byref()", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L45_C4", "vector": [14, 2, 0.4173, 0.0079, 2, 0.66, 0.75, 676, 3, 2, 0, 0, 951, 10, 1], "semantic": {"name": "ptr", "arg_names": [], "import_names": [], "rhs_call_name": "ptr_byref", "annotation": ""}, "snippet": " ptr = ptr_byref(cargs, offset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L55_C8", "label": "s =", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L45_C4", "vector": [14, 2, 0.4331, 0.0079, 2, 0.66, 1.0, 553, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = ptr.value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L58_C4", "label": "if", "type": "if", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L36_C0", "vector": [4, 1, 0.4567, 0.0079, 1, 0.77, 0.6667, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ptr: lgdal.VSIFree(ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L58_C12", "label": "VSIFree()", "type": "expression", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L58_C4", "vector": [8, 2, 0.4567, 0.0079, 2, 0.46, 0.0, 745, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "VSIFree", "arg_names": [], "import_names": [], "rhs_call_name": "VSIFree", "annotation": ""}, "snippet": " if ptr: lgdal.VSIFree(ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L59_C4", "label": "return", "type": "return", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L36_C0", "vector": [13, 1, 0.4646, 0.0079, 1, 0.77, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return s"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L64_C0", "label": "check_envelope", "type": "function", "loc": [64, 67], "level": 0, "parent": null, "vector": [2, 0, 0.5157, 0.0315, 0, 0.66, 0.5625, 730, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "check_envelope", "arg_names": ["result", "func", "cargs", "offset"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_envelope(result, func, cargs, offset=-1):\n \"Checks a function that returns an OGR Envelope by reference.\"\n env = ptr_byref(cargs, offset)\n return env"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L65_C4", "label": "expression", "type": "expression", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L64_C0", "vector": [8, 1, 0.5118, 0.0079, 1, 0.86, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Checks a function that returns an OGR Envelope by reference.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L66_C4", "label": "env = ptr_byref()", "type": "assigned_variable", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L64_C0", "vector": [14, 1, 0.5197, 0.0079, 1, 0.86, 0.5, 803, 3, 2, 0, 0, 951, 10, 1], "semantic": {"name": "env", "arg_names": [], "import_names": [], "rhs_call_name": "ptr_byref", "annotation": ""}, "snippet": " env = ptr_byref(cargs, offset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L67_C4", "label": "return", "type": "return", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L64_C0", "vector": [13, 1, 0.5276, 0.0079, 1, 0.86, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return env"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L70_C0", "label": "check_geom", "type": "function", "loc": [70, 78], "level": 0, "parent": null, "vector": [2, 0, 0.5827, 0.0709, 0, 0.66, 0.625, 261, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "check_geom", "arg_names": ["result", "func", "cargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_geom(result, func, cargs):\n \"Checks a function that returns a geometry.\"\n # OGR_G_Clone may return an integer, even though the\n # restype is set to c_void_p\n if isinstance(result, (int, long)):\n result = c_void_p(result)\n if not result: \n raise OGRException('Invalid geometry pointer returned from \"%s\".' % func.__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L71_C4", "label": "expression", "type": "expression", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L70_C0", "vector": [8, 1, 0.5591, 0.0079, 1, 0.42, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Checks a function that returns a geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L74_C4", "label": "if", "type": "if", "loc": [74, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L70_C0", "vector": [4, 1, 0.5866, 0.0157, 1, 0.42, 0.3333, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(result, (int, long)):\n result = c_void_p(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L75_C8", "label": "result = c_void_p()", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L74_C4", "vector": [14, 2, 0.5906, 0.0079, 2, 0.61, 0.0, 51, 3, 1, 0, 0, 463, 10, 1], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "c_void_p", "annotation": ""}, "snippet": " result = c_void_p(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L76_C4", "label": "if", "type": "if", "loc": [76, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L70_C0", "vector": [4, 1, 0.6024, 0.0157, 1, 0.42, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not result: \n raise OGRException('Invalid geometry pointer returned from \"%s\".' % func.__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L78_C4", "label": "return", "type": "return", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L70_C0", "vector": [13, 1, 0.6142, 0.0079, 1, 0.42, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L80_C0", "label": "check_geom_offset", "type": "function", "loc": [80, 84], "level": 0, "parent": null, "vector": [2, 0, 0.6457, 0.0394, 0, 0.66, 0.6875, 831, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "check_geom_offset", "arg_names": ["result", "func", "cargs", "offset"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_geom_offset(result, func, cargs, offset=-1):\n \"Chcks the geometry at the given offset in the C parameter list.\"\n check_err(result)\n geom = ptr_byref(cargs, offset=offset)\n return check_geom(geom, func, cargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L81_C4", "label": "expression", "type": "expression", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L80_C0", "vector": [8, 1, 0.6378, 0.0079, 1, 0.03, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Chcks the geometry at the given offset in the C parameter list.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L82_C4", "label": "check_err()", "type": "expression", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L80_C0", "vector": [8, 1, 0.6457, 0.0079, 1, 0.03, 0.3333, 825, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "check_err", "arg_names": [], "import_names": [], "rhs_call_name": "check_err", "annotation": ""}, "snippet": " check_err(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L83_C4", "label": "geom = ptr_byref()", "type": "assigned_variable", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L80_C0", "vector": [14, 1, 0.6535, 0.0079, 1, 0.03, 0.6667, 5, 3, 2, 0, 0, 951, 10, 1], "semantic": {"name": "geom", "arg_names": [], "import_names": [], "rhs_call_name": "ptr_byref", "annotation": ""}, "snippet": " geom = ptr_byref(cargs, offset=offset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L84_C4", "label": "return", "type": "return", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L80_C0", "vector": [13, 1, 0.6614, 0.0079, 1, 0.03, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return check_geom(geom, func, cargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L87_C0", "label": "check_srs", "type": "function", "loc": [87, 92], "level": 0, "parent": null, "vector": [2, 0, 0.7047, 0.0472, 0, 0.66, 0.75, 628, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "check_srs", "arg_names": ["result", "func", "cargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_srs(result, func, cargs):\n if isinstance(result, (int, long)):\n result = c_void_p(result)\n if not result:\n raise SRSException('Invalid spatial reference pointer returned from \"%s\".' % func.__name__)\n return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L88_C4", "label": "if", "type": "if", "loc": [88, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L87_C0", "vector": [4, 1, 0.6969, 0.0157, 1, 0.53, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(result, (int, long)):\n result = c_void_p(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L89_C8", "label": "result = c_void_p()", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L88_C4", "vector": [14, 2, 0.7008, 0.0079, 2, 0.53, 0.0, 51, 3, 1, 0, 0, 463, 10, 1], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "c_void_p", "annotation": ""}, "snippet": " result = c_void_p(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L90_C4", "label": "if", "type": "if", "loc": [90, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L87_C0", "vector": [4, 1, 0.7126, 0.0157, 1, 0.53, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not result:\n raise SRSException('Invalid spatial reference pointer returned from \"%s\".' % func.__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L92_C4", "label": "return", "type": "return", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L87_C0", "vector": [13, 1, 0.7244, 0.0079, 1, 0.53, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L95_C0", "label": "check_arg_errcode", "type": "function", "loc": [95, 101], "level": 0, "parent": null, "vector": [2, 0, 0.7717, 0.0551, 0, 0.66, 0.8125, 975, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "check_arg_errcode", "arg_names": ["result", "func", "cargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_arg_errcode(result, func, cargs):\n \"\"\"\n The error code is returned in the last argument, by reference.\n Check its value with `check_err` before returning the result.\n \"\"\"\n check_err(arg_byref(cargs))\n return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L96_C4", "label": "expression", "type": "expression", "loc": [96, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L95_C0", "vector": [8, 1, 0.7677, 0.0315, 1, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n The error code is returned in the last argument, by reference.\n Check its value with `check_err` before returning the result.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L100_C4", "label": "check_err()", "type": "expression", "loc": [100, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L95_C0", "vector": [8, 1, 0.7874, 0.0079, 1, 0.54, 0.5, 825, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "check_err", "arg_names": [], "import_names": [], "rhs_call_name": "check_err", "annotation": ""}, "snippet": " check_err(arg_byref(cargs))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L101_C4", "label": "return", "type": "return", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L95_C0", "vector": [13, 1, 0.7953, 0.0079, 1, 0.54, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L103_C0", "label": "check_errcode", "type": "function", "loc": [103, 108], "level": 0, "parent": null, "vector": [2, 0, 0.8307, 0.0472, 0, 0.66, 0.875, 562, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "check_errcode", "arg_names": ["result", "func", "cargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_errcode(result, func, cargs):\n \"\"\"\n Check the error code returned (c_int).\n \"\"\"\n check_err(result)\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L104_C4", "label": "expression", "type": "expression", "loc": [104, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L103_C0", "vector": [8, 1, 0.8268, 0.0236, 1, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Check the error code returned (c_int).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L107_C4", "label": "check_err()", "type": "expression", "loc": [107, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L103_C0", "vector": [8, 1, 0.8425, 0.0079, 1, 0.15, 0.5, 825, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "check_err", "arg_names": [], "import_names": [], "rhs_call_name": "check_err", "annotation": ""}, "snippet": " check_err(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L108_C4", "label": "return", "type": "return", "loc": [108, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L103_C0", "vector": [13, 1, 0.8504, 0.0079, 1, 0.15, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L110_C0", "label": "check_pointer", "type": "function", "loc": [110, 117], "level": 0, "parent": null, "vector": [2, 0, 0.8937, 0.063, 0, 0.66, 0.9375, 965, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "check_pointer", "arg_names": ["result", "func", "cargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_pointer(result, func, cargs):\n \"Makes sure the result pointer is valid.\"\n if isinstance(result, (int, long)):\n result = c_void_p(result)\n if bool(result): \n return result\n else: \n raise OGRException('Invalid pointer returned from \"%s\"' % func.__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L111_C4", "label": "expression", "type": "expression", "loc": [111, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L110_C0", "vector": [8, 1, 0.874, 0.0079, 1, 0.1, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Makes sure the result pointer is valid.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L112_C4", "label": "if", "type": "if", "loc": [112, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L110_C0", "vector": [4, 1, 0.8858, 0.0157, 1, 0.1, 0.5, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(result, (int, long)):\n result = c_void_p(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L113_C8", "label": "result = c_void_p()", "type": "assigned_variable", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L112_C4", "vector": [14, 2, 0.8898, 0.0079, 2, 0.32, 0.0, 51, 3, 1, 0, 0, 463, 10, 1], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "c_void_p", "annotation": ""}, "snippet": " result = c_void_p(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L114_C4", "label": "if", "type": "if", "loc": [114, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L110_C0", "vector": [4, 1, 0.9094, 0.0315, 1, 0.1, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if bool(result): \n return result\n else: \n raise OGRException('Invalid pointer returned from \"%s\"' % func.__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L115_C8", "label": "return", "type": "return", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L114_C4", "vector": [13, 2, 0.9055, 0.0079, 2, 0.82, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L119_C0", "label": "check_str_arg", "type": "function", "loc": [119, 127], "level": 0, "parent": null, "vector": [2, 0, 0.9685, 0.0709, 0, 0.66, 1.0, 862, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "check_str_arg", "arg_names": ["result", "func", "cargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_str_arg(result, func, cargs):\n \"\"\"\n This is for the OSRGet[Angular|Linear]Units functions, which\n require that the returned string pointer not be freed. This\n returns both the double and tring values.\n \"\"\"\n dbl = result\n ptr = cargs[-1]._obj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L120_C4", "label": "expression", "type": "expression", "loc": [120, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L119_C0", "vector": [8, 1, 0.9606, 0.0394, 1, 0.87, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n This is for the OSRGet[Angular|Linear]Units functions, which\n require that the returned string pointer not be freed. This\n returns both the double and tring values.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L125_C4", "label": "dbl =", "type": "assigned_variable", "loc": [125, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L119_C0", "vector": [14, 1, 0.9843, 0.0079, 1, 0.87, 0.3333, 850, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dbl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dbl = result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L126_C4", "label": "ptr =", "type": "assigned_variable", "loc": [126, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L119_C0", "vector": [14, 1, 0.9921, 0.0079, 1, 0.87, 0.6667, 676, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ptr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ptr = cargs[-1]._obj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L127_C4", "label": "return", "type": "return", "loc": [127, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L119_C0", "vector": [13, 1, 1.0, 0.0079, 1, 0.87, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dbl, ptr.value"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L21_C21"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L22_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L48_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L48_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L48_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L49_C14"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L58_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L103_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L103_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L103_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:If_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Assign_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Return_L127_C4"}] |
"""
This module houses the ctypes function prototypes for OGR DataSource
related data structures. OGR_Dr_*, OGR_DS_*, OGR_L_*, OGR_F_*,
OGR_Fld_* routines are relevant here.
"""
from ctypes import c_char_p, c_double, c_int, c_long, c_void_p, POINTER
from django.contrib.gis.gdal.envelope import OGREnvelope
from django.contrib.gis.gdal.libgdal import lgdal
from django.contrib.gis.gdal.prototypes.generation import \
const_string_output, double_output, geom_output, int_output, \
srs_output, void_output, voidptr_output
c_int_p = POINTER(c_int) # shortcut type
### Driver Routines ###
register_all = void_output(lgdal.OGRRegisterAll, [], errcheck=False)
cleanup_all = void_output(lgdal.OGRCleanupAll, [], errcheck=False)
get_driver = voidptr_output(lgdal.OGRGetDriver, [c_int])
get_driver_by_name = voidptr_output(lgdal.OGRGetDriverByName, [c_char_p])
get_driver_count = int_output(lgdal.OGRGetDriverCount, [])
get_driver_name = const_string_output(lgdal.OGR_Dr_GetName, [c_void_p])
### DataSource ###
open_ds = voidptr_output(lgdal.OGROpen, [c_char_p, c_int, POINTER(c_void_p)])
destroy_ds = void_output(lgdal.OGR_DS_Destroy, [c_void_p], errcheck=False)
release_ds = void_output(lgdal.OGRReleaseDataSource, [c_void_p])
get_ds_name = const_string_output(lgdal.OGR_DS_GetName, [c_void_p])
get_layer = voidptr_output(lgdal.OGR_DS_GetLayer, [c_void_p, c_int])
get_layer_by_name = voidptr_output(lgdal.OGR_DS_GetLayerByName, [c_void_p, c_char_p])
get_layer_count = int_output(lgdal.OGR_DS_GetLayerCount, [c_void_p])
### Layer Routines ###
get_extent = void_output(lgdal.OGR_L_GetExtent, [c_void_p, POINTER(OGREnvelope), c_int])
get_feature = voidptr_output(lgdal.OGR_L_GetFeature, [c_void_p, c_long])
get_feature_count = int_output(lgdal.OGR_L_GetFeatureCount, [c_void_p, c_int])
get_layer_defn = voidptr_output(lgdal.OGR_L_GetLayerDefn, [c_void_p])
get_layer_srs = srs_output(lgdal.OGR_L_GetSpatialRef, [c_void_p])
get_next_feature = voidptr_output(lgdal.OGR_L_GetNextFeature, [c_void_p])
reset_reading = void_output(lgdal.OGR_L_ResetReading, [c_void_p], errcheck=False)
test_capability = int_output(lgdal.OGR_L_TestCapability, [c_void_p, c_char_p])
get_spatial_filter = geom_output(lgdal.OGR_L_GetSpatialFilter, [c_void_p])
set_spatial_filter = void_output(lgdal.OGR_L_SetSpatialFilter, [c_void_p, c_void_p], errcheck=False)
set_spatial_filter_rect = void_output(lgdal.OGR_L_SetSpatialFilterRect, [c_void_p, c_double, c_double, c_double, c_double], errcheck=False)
### Feature Definition Routines ###
get_fd_geom_type = int_output(lgdal.OGR_FD_GetGeomType, [c_void_p])
get_fd_name = const_string_output(lgdal.OGR_FD_GetName, [c_void_p])
get_feat_name = const_string_output(lgdal.OGR_FD_GetName, [c_void_p])
get_field_count = int_output(lgdal.OGR_FD_GetFieldCount, [c_void_p])
get_field_defn = voidptr_output(lgdal.OGR_FD_GetFieldDefn, [c_void_p, c_int])
### Feature Routines ###
clone_feature = voidptr_output(lgdal.OGR_F_Clone, [c_void_p])
destroy_feature = void_output(lgdal.OGR_F_Destroy, [c_void_p], errcheck=False)
feature_equal = int_output(lgdal.OGR_F_Equal, [c_void_p, c_void_p])
get_feat_geom_ref = geom_output(lgdal.OGR_F_GetGeometryRef, [c_void_p])
get_feat_field_count = int_output(lgdal.OGR_F_GetFieldCount, [c_void_p])
get_feat_field_defn = voidptr_output(lgdal.OGR_F_GetFieldDefnRef, [c_void_p, c_int])
get_fid = int_output(lgdal.OGR_F_GetFID, [c_void_p])
get_field_as_datetime = int_output(lgdal.OGR_F_GetFieldAsDateTime, [c_void_p, c_int, c_int_p, c_int_p, c_int_p, c_int_p, c_int_p, c_int_p])
get_field_as_double = double_output(lgdal.OGR_F_GetFieldAsDouble, [c_void_p, c_int])
get_field_as_integer = int_output(lgdal.OGR_F_GetFieldAsInteger, [c_void_p, c_int])
get_field_as_string = const_string_output(lgdal.OGR_F_GetFieldAsString, [c_void_p, c_int])
get_field_index = int_output(lgdal.OGR_F_GetFieldIndex, [c_void_p, c_char_p])
### Field Routines ###
get_field_name = const_string_output(lgdal.OGR_Fld_GetNameRef, [c_void_p])
get_field_precision = int_output(lgdal.OGR_Fld_GetPrecision, [c_void_p])
get_field_type = int_output(lgdal.OGR_Fld_GetType, [c_void_p])
get_field_type_name = const_string_output(lgdal.OGR_GetFieldTypeName, [c_int])
get_field_width = int_output(lgdal.OGR_Fld_GetWidth, [c_void_p])
| ajibawa-2023/Python-Code-Large/train/row_98703 | 52 | 71 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0423, 0.0704, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n This module houses the ctypes function prototypes for OGR DataSource\n related data structures. OGR_Dr_*, OGR_DS_*, OGR_L_*, OGR_F_*, \n OGR_Fld_* routines are relevant here.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:ImportFrom_L6_C0", "label": "from ctypes import c_char_p, c_double, c_int\u2026", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0845, 0.0141, 0, 0.66, 0.0196, 182, 0, 6, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_char_p", "c_double", "c_int", "c_long", "c_void_p", "POINTER"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import c_char_p, c_double, c_int, c_long, c_void_p, POINTER"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:ImportFrom_L7_C0", "label": "from django.contrib.gis.gdal.envelope import OGREnvelope", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0986, 0.0141, 0, 0.66, 0.0392, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.envelope", "arg_names": [], "import_names": ["OGREnvelope"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.envelope import OGREnvelope"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:ImportFrom_L8_C0", "label": "from django.contrib.gis.gdal.libgdal import lgdal", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.1127, 0.0141, 0, 0.66, 0.0588, 460, 0, 1, 0, 0, 460, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.libgdal", "arg_names": [], "import_names": ["lgdal"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.libgdal import lgdal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:ImportFrom_L9_C0", "label": "from django.contrib.gis.gdal.prototypes.generation import const_string_output, double_output, geom_output\u2026", "type": "import", "loc": [9, 11], "level": 0, "parent": null, "vector": [1, 0, 0.1408, 0.0423, 0, 0.66, 0.0784, 737, 0, 7, 0, 0, 737, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.prototypes.generation", "arg_names": [], "import_names": ["const_string_output", "double_output", "geom_output", "int_output", "srs_output", "void_output", "voidptr_output"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.prototypes.generation import \\\n const_string_output, double_output, geom_output, int_output, \\\n srs_output, void_output, voidptr_output"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L13_C0", "label": "c_int_p = POINTER()", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.1831, 0.0141, 0, 0.66, 0.098, 100, 3, 1, 0, 0, 785, 10, 1], "semantic": {"name": "c_int_p", "arg_names": [], "import_names": [], "rhs_call_name": "POINTER", "annotation": ""}, "snippet": "c_int_p = POINTER(c_int) # shortcut type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L16_C0", "label": "register_all = void_output()", "type": "assigned_variable", "loc": [16, 16], "level": 0, "parent": null, "vector": [14, 0, 0.2254, 0.0141, 0, 0.66, 0.1176, 55, 3, 3, 0, 0, 301, 10, 1], "semantic": {"name": "register_all", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "register_all = void_output(lgdal.OGRRegisterAll, [], errcheck=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L17_C0", "label": "cleanup_all = void_output()", "type": "assigned_variable", "loc": [17, 17], "level": 0, "parent": null, "vector": [14, 0, 0.2394, 0.0141, 0, 0.66, 0.1373, 826, 3, 3, 0, 0, 301, 10, 1], "semantic": {"name": "cleanup_all", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "cleanup_all = void_output(lgdal.OGRCleanupAll, [], errcheck=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L18_C0", "label": "get_driver = voidptr_output()", "type": "assigned_variable", "loc": [18, 18], "level": 0, "parent": null, "vector": [14, 0, 0.2535, 0.0141, 0, 0.66, 0.1569, 958, 3, 2, 0, 0, 593, 10, 1], "semantic": {"name": "get_driver", "arg_names": [], "import_names": [], "rhs_call_name": "voidptr_output", "annotation": ""}, "snippet": "get_driver = voidptr_output(lgdal.OGRGetDriver, [c_int])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L19_C0", "label": "get_driver_by_name = voidptr_output()", "type": "assigned_variable", "loc": [19, 19], "level": 0, "parent": null, "vector": [14, 0, 0.2676, 0.0141, 0, 0.66, 0.1765, 280, 3, 2, 0, 0, 593, 10, 1], "semantic": {"name": "get_driver_by_name", "arg_names": [], "import_names": [], "rhs_call_name": "voidptr_output", "annotation": ""}, "snippet": "get_driver_by_name = voidptr_output(lgdal.OGRGetDriverByName, [c_char_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L20_C0", "label": "get_driver_count = int_output()", "type": "assigned_variable", "loc": [20, 20], "level": 0, "parent": null, "vector": [14, 0, 0.2817, 0.0141, 0, 0.66, 0.1961, 58, 3, 2, 0, 0, 974, 10, 1], "semantic": {"name": "get_driver_count", "arg_names": [], "import_names": [], "rhs_call_name": "int_output", "annotation": ""}, "snippet": "get_driver_count = int_output(lgdal.OGRGetDriverCount, [])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L21_C0", "label": "get_driver_name = const_string_output()", "type": "assigned_variable", "loc": [21, 21], "level": 0, "parent": null, "vector": [14, 0, 0.2958, 0.0141, 0, 0.66, 0.2157, 801, 3, 2, 0, 0, 611, 10, 1], "semantic": {"name": "get_driver_name", "arg_names": [], "import_names": [], "rhs_call_name": "const_string_output", "annotation": ""}, "snippet": "get_driver_name = const_string_output(lgdal.OGR_Dr_GetName, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L24_C0", "label": "open_ds = voidptr_output()", "type": "assigned_variable", "loc": [24, 24], "level": 0, "parent": null, "vector": [14, 0, 0.338, 0.0141, 0, 0.66, 0.2353, 359, 3, 2, 0, 0, 593, 10, 2], "semantic": {"name": "open_ds", "arg_names": [], "import_names": [], "rhs_call_name": "voidptr_output", "annotation": ""}, "snippet": "open_ds = voidptr_output(lgdal.OGROpen, [c_char_p, c_int, POINTER(c_void_p)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L25_C0", "label": "destroy_ds = void_output()", "type": "assigned_variable", "loc": [25, 25], "level": 0, "parent": null, "vector": [14, 0, 0.3521, 0.0141, 0, 0.66, 0.2549, 709, 3, 3, 0, 0, 301, 10, 1], "semantic": {"name": "destroy_ds", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "destroy_ds = void_output(lgdal.OGR_DS_Destroy, [c_void_p], errcheck=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L26_C0", "label": "release_ds = void_output()", "type": "assigned_variable", "loc": [26, 26], "level": 0, "parent": null, "vector": [14, 0, 0.3662, 0.0141, 0, 0.66, 0.2745, 551, 3, 2, 0, 0, 301, 10, 1], "semantic": {"name": "release_ds", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "release_ds = void_output(lgdal.OGRReleaseDataSource, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L27_C0", "label": "get_ds_name = const_string_output()", "type": "assigned_variable", "loc": [27, 27], "level": 0, "parent": null, "vector": [14, 0, 0.3803, 0.0141, 0, 0.66, 0.2941, 109, 3, 2, 0, 0, 611, 10, 1], "semantic": {"name": "get_ds_name", "arg_names": [], "import_names": [], "rhs_call_name": "const_string_output", "annotation": ""}, "snippet": "get_ds_name = const_string_output(lgdal.OGR_DS_GetName, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L28_C0", "label": "get_layer = voidptr_output()", "type": "assigned_variable", "loc": [28, 28], "level": 0, "parent": null, "vector": [14, 0, 0.3944, 0.0141, 0, 0.66, 0.3137, 369, 3, 2, 0, 0, 593, 10, 1], "semantic": {"name": "get_layer", "arg_names": [], "import_names": [], "rhs_call_name": "voidptr_output", "annotation": ""}, "snippet": "get_layer = voidptr_output(lgdal.OGR_DS_GetLayer, [c_void_p, c_int])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L29_C0", "label": "get_layer_by_name = voidptr_output()", "type": "assigned_variable", "loc": [29, 29], "level": 0, "parent": null, "vector": [14, 0, 0.4085, 0.0141, 0, 0.66, 0.3333, 153, 3, 2, 0, 0, 593, 10, 1], "semantic": {"name": "get_layer_by_name", "arg_names": [], "import_names": [], "rhs_call_name": "voidptr_output", "annotation": ""}, "snippet": "get_layer_by_name = voidptr_output(lgdal.OGR_DS_GetLayerByName, [c_void_p, c_char_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L30_C0", "label": "get_layer_count = int_output()", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.4225, 0.0141, 0, 0.66, 0.3529, 600, 3, 2, 0, 0, 974, 10, 1], "semantic": {"name": "get_layer_count", "arg_names": [], "import_names": [], "rhs_call_name": "int_output", "annotation": ""}, "snippet": "get_layer_count = int_output(lgdal.OGR_DS_GetLayerCount, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L33_C0", "label": "get_extent = void_output()", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 0.4648, 0.0141, 0, 0.66, 0.3725, 884, 3, 2, 0, 0, 301, 10, 2], "semantic": {"name": "get_extent", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "get_extent = void_output(lgdal.OGR_L_GetExtent, [c_void_p, POINTER(OGREnvelope), c_int])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L34_C0", "label": "get_feature = voidptr_output()", "type": "assigned_variable", "loc": [34, 34], "level": 0, "parent": null, "vector": [14, 0, 0.4789, 0.0141, 0, 0.66, 0.3922, 134, 3, 2, 0, 0, 593, 10, 1], "semantic": {"name": "get_feature", "arg_names": [], "import_names": [], "rhs_call_name": "voidptr_output", "annotation": ""}, "snippet": "get_feature = voidptr_output(lgdal.OGR_L_GetFeature, [c_void_p, c_long])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L35_C0", "label": "get_feature_count = int_output()", "type": "assigned_variable", "loc": [35, 35], "level": 0, "parent": null, "vector": [14, 0, 0.493, 0.0141, 0, 0.66, 0.4118, 591, 3, 2, 0, 0, 974, 10, 1], "semantic": {"name": "get_feature_count", "arg_names": [], "import_names": [], "rhs_call_name": "int_output", "annotation": ""}, "snippet": "get_feature_count = int_output(lgdal.OGR_L_GetFeatureCount, [c_void_p, c_int])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L36_C0", "label": "get_layer_defn = voidptr_output()", "type": "assigned_variable", "loc": [36, 36], "level": 0, "parent": null, "vector": [14, 0, 0.507, 0.0141, 0, 0.66, 0.4314, 233, 3, 2, 0, 0, 593, 10, 1], "semantic": {"name": "get_layer_defn", "arg_names": [], "import_names": [], "rhs_call_name": "voidptr_output", "annotation": ""}, "snippet": "get_layer_defn = voidptr_output(lgdal.OGR_L_GetLayerDefn, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L37_C0", "label": "get_layer_srs = srs_output()", "type": "assigned_variable", "loc": [37, 37], "level": 0, "parent": null, "vector": [14, 0, 0.5211, 0.0141, 0, 0.66, 0.451, 921, 3, 2, 0, 0, 98, 10, 1], "semantic": {"name": "get_layer_srs", "arg_names": [], "import_names": [], "rhs_call_name": "srs_output", "annotation": ""}, "snippet": "get_layer_srs = srs_output(lgdal.OGR_L_GetSpatialRef, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L38_C0", "label": "get_next_feature = voidptr_output()", "type": "assigned_variable", "loc": [38, 38], "level": 0, "parent": null, "vector": [14, 0, 0.5352, 0.0141, 0, 0.66, 0.4706, 504, 3, 2, 0, 0, 593, 10, 1], "semantic": {"name": "get_next_feature", "arg_names": [], "import_names": [], "rhs_call_name": "voidptr_output", "annotation": ""}, "snippet": "get_next_feature = voidptr_output(lgdal.OGR_L_GetNextFeature, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L39_C0", "label": "reset_reading = void_output()", "type": "assigned_variable", "loc": [39, 39], "level": 0, "parent": null, "vector": [14, 0, 0.5493, 0.0141, 0, 0.66, 0.4902, 485, 3, 3, 0, 0, 301, 10, 1], "semantic": {"name": "reset_reading", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "reset_reading = void_output(lgdal.OGR_L_ResetReading, [c_void_p], errcheck=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L40_C0", "label": "test_capability = int_output()", "type": "assigned_variable", "loc": [40, 40], "level": 0, "parent": null, "vector": [14, 0, 0.5634, 0.0141, 0, 0.66, 0.5098, 931, 3, 2, 0, 0, 974, 10, 1], "semantic": {"name": "test_capability", "arg_names": [], "import_names": [], "rhs_call_name": "int_output", "annotation": ""}, "snippet": "test_capability = int_output(lgdal.OGR_L_TestCapability, [c_void_p, c_char_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L41_C0", "label": "get_spatial_filter = geom_output()", "type": "assigned_variable", "loc": [41, 41], "level": 0, "parent": null, "vector": [14, 0, 0.5775, 0.0141, 0, 0.66, 0.5294, 446, 3, 2, 0, 0, 16, 10, 1], "semantic": {"name": "get_spatial_filter", "arg_names": [], "import_names": [], "rhs_call_name": "geom_output", "annotation": ""}, "snippet": "get_spatial_filter = geom_output(lgdal.OGR_L_GetSpatialFilter, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L42_C0", "label": "set_spatial_filter = void_output()", "type": "assigned_variable", "loc": [42, 42], "level": 0, "parent": null, "vector": [14, 0, 0.5915, 0.0141, 0, 0.66, 0.549, 422, 3, 3, 0, 0, 301, 10, 1], "semantic": {"name": "set_spatial_filter", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "set_spatial_filter = void_output(lgdal.OGR_L_SetSpatialFilter, [c_void_p, c_void_p], errcheck=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L43_C0", "label": "set_spatial_filter_rect = void_output()", "type": "assigned_variable", "loc": [43, 43], "level": 0, "parent": null, "vector": [14, 0, 0.6056, 0.0141, 0, 0.66, 0.5686, 264, 3, 3, 0, 0, 301, 10, 1], "semantic": {"name": "set_spatial_filter_rect", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "set_spatial_filter_rect = void_output(lgdal.OGR_L_SetSpatialFilterRect, [c_void_p, c_double, c_double, c_double, c_double], errcheck=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L46_C0", "label": "get_fd_geom_type = int_output()", "type": "assigned_variable", "loc": [46, 46], "level": 0, "parent": null, "vector": [14, 0, 0.6479, 0.0141, 0, 0.66, 0.5882, 894, 3, 2, 0, 0, 974, 10, 1], "semantic": {"name": "get_fd_geom_type", "arg_names": [], "import_names": [], "rhs_call_name": "int_output", "annotation": ""}, "snippet": "get_fd_geom_type = int_output(lgdal.OGR_FD_GetGeomType, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L47_C0", "label": "get_fd_name = const_string_output()", "type": "assigned_variable", "loc": [47, 47], "level": 0, "parent": null, "vector": [14, 0, 0.662, 0.0141, 0, 0.66, 0.6078, 220, 3, 2, 0, 0, 611, 10, 1], "semantic": {"name": "get_fd_name", "arg_names": [], "import_names": [], "rhs_call_name": "const_string_output", "annotation": ""}, "snippet": "get_fd_name = const_string_output(lgdal.OGR_FD_GetName, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L48_C0", "label": "get_feat_name = const_string_output()", "type": "assigned_variable", "loc": [48, 48], "level": 0, "parent": null, "vector": [14, 0, 0.6761, 0.0141, 0, 0.66, 0.6275, 489, 3, 2, 0, 0, 611, 10, 1], "semantic": {"name": "get_feat_name", "arg_names": [], "import_names": [], "rhs_call_name": "const_string_output", "annotation": ""}, "snippet": "get_feat_name = const_string_output(lgdal.OGR_FD_GetName, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L49_C0", "label": "get_field_count = int_output()", "type": "assigned_variable", "loc": [49, 49], "level": 0, "parent": null, "vector": [14, 0, 0.6901, 0.0141, 0, 0.66, 0.6471, 742, 3, 2, 0, 0, 974, 10, 1], "semantic": {"name": "get_field_count", "arg_names": [], "import_names": [], "rhs_call_name": "int_output", "annotation": ""}, "snippet": "get_field_count = int_output(lgdal.OGR_FD_GetFieldCount, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L50_C0", "label": "get_field_defn = voidptr_output()", "type": "assigned_variable", "loc": [50, 50], "level": 0, "parent": null, "vector": [14, 0, 0.7042, 0.0141, 0, 0.66, 0.6667, 327, 3, 2, 0, 0, 593, 10, 1], "semantic": {"name": "get_field_defn", "arg_names": [], "import_names": [], "rhs_call_name": "voidptr_output", "annotation": ""}, "snippet": "get_field_defn = voidptr_output(lgdal.OGR_FD_GetFieldDefn, [c_void_p, c_int])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L53_C0", "label": "clone_feature = voidptr_output()", "type": "assigned_variable", "loc": [53, 53], "level": 0, "parent": null, "vector": [14, 0, 0.7465, 0.0141, 0, 0.66, 0.6863, 588, 3, 2, 0, 0, 593, 10, 1], "semantic": {"name": "clone_feature", "arg_names": [], "import_names": [], "rhs_call_name": "voidptr_output", "annotation": ""}, "snippet": "clone_feature = voidptr_output(lgdal.OGR_F_Clone, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L54_C0", "label": "destroy_feature = void_output()", "type": "assigned_variable", "loc": [54, 54], "level": 0, "parent": null, "vector": [14, 0, 0.7606, 0.0141, 0, 0.66, 0.7059, 748, 3, 3, 0, 0, 301, 10, 1], "semantic": {"name": "destroy_feature", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "destroy_feature = void_output(lgdal.OGR_F_Destroy, [c_void_p], errcheck=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L55_C0", "label": "feature_equal = int_output()", "type": "assigned_variable", "loc": [55, 55], "level": 0, "parent": null, "vector": [14, 0, 0.7746, 0.0141, 0, 0.66, 0.7255, 214, 3, 2, 0, 0, 974, 10, 1], "semantic": {"name": "feature_equal", "arg_names": [], "import_names": [], "rhs_call_name": "int_output", "annotation": ""}, "snippet": "feature_equal = int_output(lgdal.OGR_F_Equal, [c_void_p, c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L56_C0", "label": "get_feat_geom_ref = geom_output()", "type": "assigned_variable", "loc": [56, 56], "level": 0, "parent": null, "vector": [14, 0, 0.7887, 0.0141, 0, 0.66, 0.7451, 349, 3, 2, 0, 0, 16, 10, 1], "semantic": {"name": "get_feat_geom_ref", "arg_names": [], "import_names": [], "rhs_call_name": "geom_output", "annotation": ""}, "snippet": "get_feat_geom_ref = geom_output(lgdal.OGR_F_GetGeometryRef, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L57_C0", "label": "get_feat_field_count = int_output()", "type": "assigned_variable", "loc": [57, 57], "level": 0, "parent": null, "vector": [14, 0, 0.8028, 0.0141, 0, 0.66, 0.7647, 317, 3, 2, 0, 0, 974, 10, 1], "semantic": {"name": "get_feat_field_count", "arg_names": [], "import_names": [], "rhs_call_name": "int_output", "annotation": ""}, "snippet": "get_feat_field_count = int_output(lgdal.OGR_F_GetFieldCount, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L58_C0", "label": "get_feat_field_defn = voidptr_output()", "type": "assigned_variable", "loc": [58, 58], "level": 0, "parent": null, "vector": [14, 0, 0.8169, 0.0141, 0, 0.66, 0.7843, 100, 3, 2, 0, 0, 593, 10, 1], "semantic": {"name": "get_feat_field_defn", "arg_names": [], "import_names": [], "rhs_call_name": "voidptr_output", "annotation": ""}, "snippet": "get_feat_field_defn = voidptr_output(lgdal.OGR_F_GetFieldDefnRef, [c_void_p, c_int])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L59_C0", "label": "get_fid = int_output()", "type": "assigned_variable", "loc": [59, 59], "level": 0, "parent": null, "vector": [14, 0, 0.831, 0.0141, 0, 0.66, 0.8039, 995, 3, 2, 0, 0, 974, 10, 1], "semantic": {"name": "get_fid", "arg_names": [], "import_names": [], "rhs_call_name": "int_output", "annotation": ""}, "snippet": "get_fid = int_output(lgdal.OGR_F_GetFID, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L60_C0", "label": "get_field_as_datetime = int_output()", "type": "assigned_variable", "loc": [60, 60], "level": 0, "parent": null, "vector": [14, 0, 0.8451, 0.0141, 0, 0.66, 0.8235, 722, 3, 2, 0, 0, 974, 10, 1], "semantic": {"name": "get_field_as_datetime", "arg_names": [], "import_names": [], "rhs_call_name": "int_output", "annotation": ""}, "snippet": "get_field_as_datetime = int_output(lgdal.OGR_F_GetFieldAsDateTime, [c_void_p, c_int, c_int_p, c_int_p, c_int_p, c_int_p, c_int_p, c_int_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L61_C0", "label": "get_field_as_double = double_output()", "type": "assigned_variable", "loc": [61, 61], "level": 0, "parent": null, "vector": [14, 0, 0.8592, 0.0141, 0, 0.66, 0.8431, 253, 3, 2, 0, 0, 485, 10, 1], "semantic": {"name": "get_field_as_double", "arg_names": [], "import_names": [], "rhs_call_name": "double_output", "annotation": ""}, "snippet": "get_field_as_double = double_output(lgdal.OGR_F_GetFieldAsDouble, [c_void_p, c_int])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L62_C0", "label": "get_field_as_integer = int_output()", "type": "assigned_variable", "loc": [62, 62], "level": 0, "parent": null, "vector": [14, 0, 0.8732, 0.0141, 0, 0.66, 0.8627, 450, 3, 2, 0, 0, 974, 10, 1], "semantic": {"name": "get_field_as_integer", "arg_names": [], "import_names": [], "rhs_call_name": "int_output", "annotation": ""}, "snippet": "get_field_as_integer = int_output(lgdal.OGR_F_GetFieldAsInteger, [c_void_p, c_int])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L63_C0", "label": "get_field_as_string = const_string_output()", "type": "assigned_variable", "loc": [63, 63], "level": 0, "parent": null, "vector": [14, 0, 0.8873, 0.0141, 0, 0.66, 0.8824, 894, 3, 2, 0, 0, 611, 10, 1], "semantic": {"name": "get_field_as_string", "arg_names": [], "import_names": [], "rhs_call_name": "const_string_output", "annotation": ""}, "snippet": "get_field_as_string = const_string_output(lgdal.OGR_F_GetFieldAsString, [c_void_p, c_int])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L64_C0", "label": "get_field_index = int_output()", "type": "assigned_variable", "loc": [64, 64], "level": 0, "parent": null, "vector": [14, 0, 0.9014, 0.0141, 0, 0.66, 0.902, 718, 3, 2, 0, 0, 974, 10, 1], "semantic": {"name": "get_field_index", "arg_names": [], "import_names": [], "rhs_call_name": "int_output", "annotation": ""}, "snippet": "get_field_index = int_output(lgdal.OGR_F_GetFieldIndex, [c_void_p, c_char_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L67_C0", "label": "get_field_name = const_string_output()", "type": "assigned_variable", "loc": [67, 67], "level": 0, "parent": null, "vector": [14, 0, 0.9437, 0.0141, 0, 0.66, 0.9216, 522, 3, 2, 0, 0, 611, 10, 1], "semantic": {"name": "get_field_name", "arg_names": [], "import_names": [], "rhs_call_name": "const_string_output", "annotation": ""}, "snippet": "get_field_name = const_string_output(lgdal.OGR_Fld_GetNameRef, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L68_C0", "label": "get_field_precision = int_output()", "type": "assigned_variable", "loc": [68, 68], "level": 0, "parent": null, "vector": [14, 0, 0.9577, 0.0141, 0, 0.66, 0.9412, 509, 3, 2, 0, 0, 974, 10, 1], "semantic": {"name": "get_field_precision", "arg_names": [], "import_names": [], "rhs_call_name": "int_output", "annotation": ""}, "snippet": "get_field_precision = int_output(lgdal.OGR_Fld_GetPrecision, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L69_C0", "label": "get_field_type = int_output()", "type": "assigned_variable", "loc": [69, 69], "level": 0, "parent": null, "vector": [14, 0, 0.9718, 0.0141, 0, 0.66, 0.9608, 691, 3, 2, 0, 0, 974, 10, 1], "semantic": {"name": "get_field_type", "arg_names": [], "import_names": [], "rhs_call_name": "int_output", "annotation": ""}, "snippet": "get_field_type = int_output(lgdal.OGR_Fld_GetType, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L70_C0", "label": "get_field_type_name = const_string_output()", "type": "assigned_variable", "loc": [70, 70], "level": 0, "parent": null, "vector": [14, 0, 0.9859, 0.0141, 0, 0.66, 0.9804, 12, 3, 2, 0, 0, 611, 10, 1], "semantic": {"name": "get_field_type_name", "arg_names": [], "import_names": [], "rhs_call_name": "const_string_output", "annotation": ""}, "snippet": "get_field_type_name = const_string_output(lgdal.OGR_GetFieldTypeName, [c_int])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98703:Assign_L71_C0", "label": "get_field_width = int_output()", "type": "assigned_variable", "loc": [71, 71], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.0141, 0, 0.66, 1.0, 331, 3, 2, 0, 0, 974, 10, 1], "semantic": {"name": "get_field_width", "arg_names": [], "import_names": [], "rhs_call_name": "int_output", "annotation": ""}, "snippet": "get_field_width = int_output(lgdal.OGR_Fld_GetWidth, [c_void_p])"}] | [] |
"""
This module contains functions that generate ctypes prototypes for the
GDAL routines.
"""
from ctypes import c_char_p, c_double, c_int, c_void_p
from django.contrib.gis.gdal.prototypes.errcheck import \
check_arg_errcode, check_errcode, check_geom, check_geom_offset, \
check_pointer, check_srs, check_str_arg, check_string, check_const_string
class gdal_char_p(c_char_p):
pass
def double_output(func, argtypes, errcheck=False, strarg=False):
"Generates a ctypes function that returns a double value."
func.argtypes = argtypes
func.restype = c_double
if errcheck: func.errcheck = check_arg_errcode
if strarg: func.errcheck = check_str_arg
return func
def geom_output(func, argtypes, offset=None):
"""
Generates a function that returns a Geometry either by reference
or directly (if the return_geom keyword is set to True).
"""
# Setting the argument types
func.argtypes = argtypes
if not offset:
# When a geometry pointer is directly returned.
func.restype = c_void_p
func.errcheck = check_geom
else:
# Error code returned, geometry is returned by-reference.
func.restype = c_int
def geomerrcheck(result, func, cargs):
return check_geom_offset(result, func, cargs, offset)
func.errcheck = geomerrcheck
return func
def int_output(func, argtypes):
"Generates a ctypes function that returns an integer value."
func.argtypes = argtypes
func.restype = c_int
return func
def srs_output(func, argtypes):
"""
Generates a ctypes prototype for the given function with
the given C arguments that returns a pointer to an OGR
Spatial Reference System.
"""
func.argtypes = argtypes
func.restype = c_void_p
func.errcheck = check_srs
return func
def const_string_output(func, argtypes, offset=None):
func.argtypes = argtypes
if offset:
func.restype = c_int
else:
func.restype = c_char_p
def _check_const(result, func, cargs):
return check_const_string(result, func, cargs, offset=offset)
func.errcheck = _check_const
return func
def string_output(func, argtypes, offset=-1, str_result=False):
"""
Generates a ctypes prototype for the given function with the
given argument types that returns a string from a GDAL pointer.
The `const` flag indicates whether the allocated pointer should
be freed via the GDAL library routine VSIFree -- but only applies
only when `str_result` is True.
"""
func.argtypes = argtypes
if str_result:
# Use subclass of c_char_p so the error checking routine
# can free the memory at the pointer's address.
func.restype = gdal_char_p
else:
# Error code is returned
func.restype = c_int
# Dynamically defining our error-checking function with the
# given offset.
def _check_str(result, func, cargs):
return check_string(result, func, cargs,
offset=offset, str_result=str_result)
func.errcheck = _check_str
return func
def void_output(func, argtypes, errcheck=True):
"""
For functions that don't only return an error code that needs to
be examined.
"""
if argtypes: func.argtypes = argtypes
if errcheck:
# `errcheck` keyword may be set to False for routines that
# return void, rather than a status code.
func.restype = c_int
func.errcheck = check_errcode
else:
func.restype = None
return func
def voidptr_output(func, argtypes):
"For functions that return c_void_p."
func.argtypes = argtypes
func.restype = c_void_p
func.errcheck = check_pointer
return func
| ajibawa-2023/Python-Code-Large/train/row_98704 | 69 | 119 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.021, 0.0336, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n This module contains functions that generate ctypes prototypes for the\n GDAL routines.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:ImportFrom_L6_C0", "label": "from ctypes import c_char_p, c_double, c_int\u2026", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0504, 0.0084, 0, 0.66, 0.0909, 182, 0, 4, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_char_p", "c_double", "c_int", "c_void_p"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import c_char_p, c_double, c_int, c_void_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:ImportFrom_L7_C0", "label": "from django.contrib.gis.gdal.prototypes.errcheck import check_arg_errcode, check_errcode, check_geom\u2026", "type": "import", "loc": [7, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0672, 0.0252, 0, 0.66, 0.1818, 661, 0, 9, 0, 0, 661, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.prototypes.errcheck", "arg_names": [], "import_names": ["check_arg_errcode", "check_errcode", "check_geom", "check_geom_offset", "check_pointer", "check_srs", "check_str_arg", "check_string", "check_const_string"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.prototypes.errcheck import \\\n check_arg_errcode, check_errcode, check_geom, check_geom_offset, \\\n check_pointer, check_srs, check_str_arg, check_string, check_const_string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:ClassDef_L11_C0", "label": "gdal_char_p", "type": "class", "loc": [11, 12], "level": 0, "parent": null, "vector": [3, 0, 0.0966, 0.0168, 0, 0.66, 0.2727, 56, 0, 0, 0, 0, 288, 0, 0], "semantic": {"name": "gdal_char_p", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class gdal_char_p(c_char_p):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L14_C0", "label": "double_output", "type": "function", "loc": [14, 20], "level": 0, "parent": null, "vector": [2, 0, 0.1429, 0.0588, 0, 0.66, 0.3636, 485, 0, 4, 1, 0, 0, 0, 0], "semantic": {"name": "double_output", "arg_names": ["func", "argtypes", "errcheck", "strarg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def double_output(func, argtypes, errcheck=False, strarg=False):\n \"Generates a ctypes function that returns a double value.\"\n func.argtypes = argtypes\n func.restype = c_double\n if errcheck: func.errcheck = check_arg_errcode\n if strarg: func.errcheck = check_str_arg\n return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Expr_L15_C4", "label": "expression", "type": "expression", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L14_C0", "vector": [8, 1, 0.1261, 0.0084, 1, 0.03, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Generates a ctypes function that returns a double value.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L16_C4", "label": "func.argtypes =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L14_C0", "vector": [14, 1, 0.1345, 0.0084, 1, 0.03, 0.2, 441, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.argtypes = argtypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L17_C4", "label": "func.restype =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L14_C0", "vector": [14, 1, 0.1429, 0.0084, 1, 0.03, 0.4, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = c_double"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L18_C4", "label": "if", "type": "if", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L14_C0", "vector": [4, 1, 0.1513, 0.0084, 1, 0.03, 0.6, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if errcheck: func.errcheck = check_arg_errcode"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L18_C17", "label": "func.errcheck =", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L18_C4", "vector": [14, 2, 0.1513, 0.0084, 2, 0.13, 0.0, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if errcheck: func.errcheck = check_arg_errcode"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L19_C4", "label": "if", "type": "if", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L14_C0", "vector": [4, 1, 0.1597, 0.0084, 1, 0.03, 0.8, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if strarg: func.errcheck = check_str_arg"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L19_C15", "label": "func.errcheck =", "type": "assigned_variable", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L19_C4", "vector": [14, 2, 0.1597, 0.0084, 2, 0.91, 0.0, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if strarg: func.errcheck = check_str_arg"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Return_L20_C4", "label": "return", "type": "return", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L14_C0", "vector": [13, 1, 0.1681, 0.0084, 1, 0.03, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L22_C0", "label": "geom_output", "type": "function", "loc": [22, 41], "level": 0, "parent": null, "vector": [2, 0, 0.2647, 0.1681, 0, 0.66, 0.4545, 16, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "geom_output", "arg_names": ["func", "argtypes", "offset"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def geom_output(func, argtypes, offset=None):\n \"\"\"\n Generates a function that returns a Geometry either by reference\n or directly (if the return_geom keyword is set to True).\n \"\"\"\n # Setting the argument types\n func.argtypes = argtypes\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Expr_L23_C4", "label": "expression", "type": "expression", "loc": [23, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L22_C0", "vector": [8, 1, 0.2059, 0.0336, 1, 0.02, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Generates a function that returns a Geometry either by reference\n or directly (if the return_geom keyword is set to True).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L28_C4", "label": "func.argtypes =", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L22_C0", "vector": [14, 1, 0.2353, 0.0084, 1, 0.02, 0.3333, 441, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.argtypes = argtypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L30_C4", "label": "if", "type": "if", "loc": [30, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L22_C0", "vector": [4, 1, 0.2899, 0.084, 1, 0.02, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not offset:\n # When a geometry pointer is directly returned.\n func.restype = c_void_p\n func.errcheck = check_geom\n else:\n # Error code returned, geometry is returned by-reference.\n func.restype = c_int\n def geomerrcheck(result, func, cargs):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L32_C8", "label": "func.restype =", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L30_C4", "vector": [14, 2, 0.2689, 0.0084, 2, 0.2, 0.0, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = c_void_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L33_C8", "label": "func.errcheck =", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L30_C4", "vector": [14, 2, 0.2773, 0.0084, 2, 0.2, 0.25, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.errcheck = check_geom"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L36_C8", "label": "func.restype =", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L30_C4", "vector": [14, 2, 0.3025, 0.0084, 2, 0.2, 0.5, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = c_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L37_C8", "label": "geomerrcheck", "type": "function", "loc": [37, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L30_C4", "vector": [2, 2, 0.3151, 0.0168, 2, 0.2, 0.75, 745, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "geomerrcheck", "arg_names": ["result", "func", "cargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geomerrcheck(result, func, cargs):\n return check_geom_offset(result, func, cargs, offset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Return_L38_C12", "label": "return", "type": "return", "loc": [38, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L37_C8", "vector": [13, 3, 0.3193, 0.0084, 3, 0.42, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return check_geom_offset(result, func, cargs, offset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L39_C8", "label": "func.errcheck =", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L30_C4", "vector": [14, 2, 0.3277, 0.0084, 2, 0.2, 1.0, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.errcheck = geomerrcheck"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Return_L41_C4", "label": "return", "type": "return", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L22_C0", "vector": [13, 1, 0.3445, 0.0084, 1, 0.02, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L43_C0", "label": "int_output", "type": "function", "loc": [43, 47], "level": 0, "parent": null, "vector": [2, 0, 0.3782, 0.042, 0, 0.66, 0.5455, 974, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "int_output", "arg_names": ["func", "argtypes"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def int_output(func, argtypes):\n \"Generates a ctypes function that returns an integer value.\"\n func.argtypes = argtypes\n func.restype = c_int\n return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Expr_L44_C4", "label": "expression", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L43_C0", "vector": [8, 1, 0.3697, 0.0084, 1, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Generates a ctypes function that returns an integer value.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L45_C4", "label": "func.argtypes =", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L43_C0", "vector": [14, 1, 0.3782, 0.0084, 1, 0.98, 0.3333, 441, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.argtypes = argtypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L46_C4", "label": "func.restype =", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L43_C0", "vector": [14, 1, 0.3866, 0.0084, 1, 0.98, 0.6667, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = c_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Return_L47_C4", "label": "return", "type": "return", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L43_C0", "vector": [13, 1, 0.395, 0.0084, 1, 0.98, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L49_C0", "label": "srs_output", "type": "function", "loc": [49, 58], "level": 0, "parent": null, "vector": [2, 0, 0.4496, 0.084, 0, 0.66, 0.6364, 98, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "srs_output", "arg_names": ["func", "argtypes"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def srs_output(func, argtypes):\n \"\"\"\n Generates a ctypes prototype for the given function with\n the given C arguments that returns a pointer to an OGR\n Spatial Reference System.\n \"\"\"\n func.argtypes = argtypes\n func.restype = c_void_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Expr_L50_C4", "label": "expression", "type": "expression", "loc": [50, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L49_C0", "vector": [8, 1, 0.437, 0.042, 1, 0.08, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Generates a ctypes prototype for the given function with\n the given C arguments that returns a pointer to an OGR\n Spatial Reference System.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L55_C4", "label": "func.argtypes =", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L49_C0", "vector": [14, 1, 0.4622, 0.0084, 1, 0.08, 0.25, 441, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.argtypes = argtypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L56_C4", "label": "func.restype =", "type": "assigned_variable", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L49_C0", "vector": [14, 1, 0.4706, 0.0084, 1, 0.08, 0.5, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = c_void_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L57_C4", "label": "func.errcheck =", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L49_C0", "vector": [14, 1, 0.479, 0.0084, 1, 0.08, 0.75, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.errcheck = check_srs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Return_L58_C4", "label": "return", "type": "return", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L49_C0", "vector": [13, 1, 0.4874, 0.0084, 1, 0.08, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L60_C0", "label": "const_string_output", "type": "function", "loc": [60, 71], "level": 0, "parent": null, "vector": [2, 0, 0.5504, 0.1008, 0, 0.66, 0.7273, 611, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "const_string_output", "arg_names": ["func", "argtypes", "offset"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def const_string_output(func, argtypes, offset=None):\n func.argtypes = argtypes\n if offset:\n func.restype = c_int\n else:\n func.restype = c_char_p\n\n def _check_const(result, func, cargs):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L61_C4", "label": "func.argtypes =", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L60_C0", "vector": [14, 1, 0.5126, 0.0084, 1, 0.52, 0.0, 441, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.argtypes = argtypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L62_C4", "label": "if", "type": "if", "loc": [62, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L60_C0", "vector": [4, 1, 0.5336, 0.0336, 1, 0.52, 0.25, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if offset:\n func.restype = c_int\n else:\n func.restype = c_char_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L63_C8", "label": "func.restype =", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L62_C4", "vector": [14, 2, 0.5294, 0.0084, 2, 0.03, 0.0, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = c_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L65_C8", "label": "func.restype =", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L62_C4", "vector": [14, 2, 0.5462, 0.0084, 2, 0.03, 1.0, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = c_char_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L67_C4", "label": "_check_const", "type": "function", "loc": [67, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L60_C0", "vector": [2, 1, 0.5672, 0.0168, 1, 0.52, 0.5, 645, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "_check_const", "arg_names": ["result", "func", "cargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _check_const(result, func, cargs):\n return check_const_string(result, func, cargs, offset=offset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Return_L68_C8", "label": "return", "type": "return", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L67_C4", "vector": [13, 2, 0.5714, 0.0084, 2, 0.79, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return check_const_string(result, func, cargs, offset=offset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L69_C4", "label": "func.errcheck =", "type": "assigned_variable", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L60_C0", "vector": [14, 1, 0.5798, 0.0084, 1, 0.52, 0.75, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.errcheck = _check_const"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Return_L71_C4", "label": "return", "type": "return", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L60_C0", "vector": [13, 1, 0.5966, 0.0084, 1, 0.52, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L73_C0", "label": "string_output", "type": "function", "loc": [73, 96], "level": 0, "parent": null, "vector": [2, 0, 0.7101, 0.2017, 0, 0.66, 0.8182, 345, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "string_output", "arg_names": ["func", "argtypes", "offset", "str_result"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def string_output(func, argtypes, offset=-1, str_result=False):\n \"\"\"\n Generates a ctypes prototype for the given function with the\n given argument types that returns a string from a GDAL pointer.\n The `const` flag indicates whether the allocated pointer should \n be freed via the GDAL library routine VSIFree -- but only applies\n only when `str_result` is True.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Expr_L74_C4", "label": "expression", "type": "expression", "loc": [74, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L73_C0", "vector": [8, 1, 0.6471, 0.0588, 1, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Generates a ctypes prototype for the given function with the\n given argument types that returns a string from a GDAL pointer.\n The `const` flag indicates whether the allocated pointer should \n be freed via the GDAL library routine VSIFree -- but only applies\n only when `str_result` is True.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L81_C4", "label": "func.argtypes =", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L73_C0", "vector": [14, 1, 0.6807, 0.0084, 1, 0.44, 0.2, 441, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.argtypes = argtypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L82_C4", "label": "if", "type": "if", "loc": [82, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L73_C0", "vector": [4, 1, 0.7143, 0.0588, 1, 0.44, 0.4, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if str_result:\n # Use subclass of c_char_p so the error checking routine\n # can free the memory at the pointer's address.\n func.restype = gdal_char_p\n else:\n # Error code is returned\n func.restype = c_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L85_C8", "label": "func.restype =", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L82_C4", "vector": [14, 2, 0.7143, 0.0084, 2, 0.62, 0.0, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = gdal_char_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L88_C8", "label": "func.restype =", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L82_C4", "vector": [14, 2, 0.7395, 0.0084, 2, 0.62, 1.0, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = c_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L92_C4", "label": "_check_str", "type": "function", "loc": [92, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L73_C0", "vector": [2, 1, 0.7815, 0.0252, 1, 0.44, 0.6, 917, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "_check_str", "arg_names": ["result", "func", "cargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _check_str(result, func, cargs):\n return check_string(result, func, cargs,\n offset=offset, str_result=str_result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Return_L93_C8", "label": "return", "type": "return", "loc": [93, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L92_C4", "vector": [13, 2, 0.7857, 0.0168, 2, 0.69, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return check_string(result, func, cargs,\n offset=offset, str_result=str_result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L95_C4", "label": "func.errcheck =", "type": "assigned_variable", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L73_C0", "vector": [14, 1, 0.7983, 0.0084, 1, 0.44, 0.8, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.errcheck = _check_str"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Return_L96_C4", "label": "return", "type": "return", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L73_C0", "vector": [13, 1, 0.8067, 0.0084, 1, 0.44, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L98_C0", "label": "void_output", "type": "function", "loc": [98, 112], "level": 0, "parent": null, "vector": [2, 0, 0.8824, 0.1261, 0, 0.66, 0.9091, 301, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "void_output", "arg_names": ["func", "argtypes", "errcheck"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def void_output(func, argtypes, errcheck=True):\n \"\"\"\n For functions that don't only return an error code that needs to\n be examined.\n \"\"\"\n if argtypes: func.argtypes = argtypes\n if errcheck:\n # `errcheck` keyword may be set to False for routines that"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Expr_L99_C4", "label": "expression", "type": "expression", "loc": [99, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L98_C0", "vector": [8, 1, 0.8445, 0.0336, 1, 0.69, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n For functions that don't only return an error code that needs to\n be examined.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L103_C4", "label": "if", "type": "if", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L98_C0", "vector": [4, 1, 0.8655, 0.0084, 1, 0.69, 0.3333, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if argtypes: func.argtypes = argtypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L103_C17", "label": "func.argtypes =", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L103_C4", "vector": [14, 2, 0.8655, 0.0084, 2, 0.11, 0.0, 441, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if argtypes: func.argtypes = argtypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L104_C4", "label": "if", "type": "if", "loc": [104, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L98_C0", "vector": [4, 1, 0.8992, 0.0588, 1, 0.69, 0.6667, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if errcheck:\n # `errcheck` keyword may be set to False for routines that\n # return void, rather than a status code.\n func.restype = c_int\n func.errcheck = check_errcode\n else:\n func.restype = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L107_C8", "label": "func.restype =", "type": "assigned_variable", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L104_C4", "vector": [14, 2, 0.8992, 0.0084, 2, 0.82, 0.0, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = c_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L108_C8", "label": "func.errcheck =", "type": "assigned_variable", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L104_C4", "vector": [14, 2, 0.9076, 0.0084, 2, 0.82, 0.5, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.errcheck = check_errcode"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L110_C8", "label": "func.restype =", "type": "assigned_variable", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L104_C4", "vector": [14, 2, 0.9244, 0.0084, 2, 0.82, 1.0, 634, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Return_L112_C4", "label": "return", "type": "return", "loc": [112, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L98_C0", "vector": [13, 1, 0.9412, 0.0084, 1, 0.69, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L114_C0", "label": "voidptr_output", "type": "function", "loc": [114, 119], "level": 0, "parent": null, "vector": [2, 0, 0.979, 0.0504, 0, 0.66, 1.0, 593, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "voidptr_output", "arg_names": ["func", "argtypes"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def voidptr_output(func, argtypes):\n \"For functions that return c_void_p.\"\n func.argtypes = argtypes\n func.restype = c_void_p\n func.errcheck = check_pointer\n return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Expr_L115_C4", "label": "expression", "type": "expression", "loc": [115, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L114_C0", "vector": [8, 1, 0.9664, 0.0084, 1, 0.39, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"For functions that return c_void_p.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L116_C4", "label": "func.argtypes =", "type": "assigned_variable", "loc": [116, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L114_C0", "vector": [14, 1, 0.9748, 0.0084, 1, 0.39, 0.25, 441, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.argtypes = argtypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L117_C4", "label": "func.restype =", "type": "assigned_variable", "loc": [117, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L114_C0", "vector": [14, 1, 0.9832, 0.0084, 1, 0.39, 0.5, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = c_void_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L118_C4", "label": "func.errcheck =", "type": "assigned_variable", "loc": [118, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L114_C0", "vector": [14, 1, 0.9916, 0.0084, 1, 0.39, 0.75, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.errcheck = check_pointer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98704:Return_L119_C4", "label": "return", "type": "return", "loc": [119, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L114_C0", "vector": [13, 1, 1.0, 0.0084, 1, 0.39, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L18_C17"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L19_C15"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Return_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Expr_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Return_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Return_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Return_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Return_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Return_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Return_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Return_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Return_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Expr_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L103_C17"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:If_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Return_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L114_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Expr_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L114_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L114_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L114_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Assign_L118_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L114_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Return_L119_C4"}] |
from ctypes import c_char_p, c_int, c_void_p, POINTER
from django.contrib.gis.gdal.libgdal import lgdal, std_call
from django.contrib.gis.gdal.prototypes.generation import \
const_string_output, double_output, int_output, \
srs_output, string_output, void_output
## Shortcut generation for routines with known parameters.
def srs_double(f):
"""
Creates a function prototype for the OSR routines that take
the OSRSpatialReference object and
"""
return double_output(f, [c_void_p, POINTER(c_int)], errcheck=True)
def units_func(f):
"""
Creates a ctypes function prototype for OSR units functions, e.g.,
OSRGetAngularUnits, OSRGetLinearUnits.
"""
return double_output(f, [c_void_p, POINTER(c_char_p)], strarg=True)
# Creation & destruction.
clone_srs = srs_output(std_call('OSRClone'), [c_void_p])
new_srs = srs_output(std_call('OSRNewSpatialReference'), [c_char_p])
release_srs = void_output(lgdal.OSRRelease, [c_void_p], errcheck=False)
destroy_srs = void_output(std_call('OSRDestroySpatialReference'), [c_void_p], errcheck=False)
srs_validate = void_output(lgdal.OSRValidate, [c_void_p])
# Getting the semi_major, semi_minor, and flattening functions.
semi_major = srs_double(lgdal.OSRGetSemiMajor)
semi_minor = srs_double(lgdal.OSRGetSemiMinor)
invflattening = srs_double(lgdal.OSRGetInvFlattening)
# WKT, PROJ, EPSG, XML importation routines.
from_wkt = void_output(lgdal.OSRImportFromWkt, [c_void_p, POINTER(c_char_p)])
from_proj = void_output(lgdal.OSRImportFromProj4, [c_void_p, c_char_p])
from_epsg = void_output(std_call('OSRImportFromEPSG'), [c_void_p, c_int])
from_xml = void_output(lgdal.OSRImportFromXML, [c_void_p, c_char_p])
from_user_input = void_output(std_call('OSRSetFromUserInput'), [c_void_p, c_char_p])
# Morphing to/from ESRI WKT.
morph_to_esri = void_output(lgdal.OSRMorphToESRI, [c_void_p])
morph_from_esri = void_output(lgdal.OSRMorphFromESRI, [c_void_p])
# Identifying the EPSG
identify_epsg = void_output(lgdal.OSRAutoIdentifyEPSG, [c_void_p])
# Getting the angular_units, linear_units functions
linear_units = units_func(lgdal.OSRGetLinearUnits)
angular_units = units_func(lgdal.OSRGetAngularUnits)
# For exporting to WKT, PROJ.4, "Pretty" WKT, and XML.
to_wkt = string_output(std_call('OSRExportToWkt'), [c_void_p, POINTER(c_char_p)])
to_proj = string_output(std_call('OSRExportToProj4'), [c_void_p, POINTER(c_char_p)])
to_pretty_wkt = string_output(std_call('OSRExportToPrettyWkt'), [c_void_p, POINTER(c_char_p), c_int], offset=-2)
# Memory leak fixed in GDAL 1.5; still exists in 1.4.
to_xml = string_output(lgdal.OSRExportToXML, [c_void_p, POINTER(c_char_p), c_char_p], offset=-2)
# String attribute retrival routines.
get_attr_value = const_string_output(std_call('OSRGetAttrValue'), [c_void_p, c_char_p, c_int])
get_auth_name = const_string_output(lgdal.OSRGetAuthorityName, [c_void_p, c_char_p])
get_auth_code = const_string_output(lgdal.OSRGetAuthorityCode, [c_void_p, c_char_p])
# SRS Properties
isgeographic = int_output(lgdal.OSRIsGeographic, [c_void_p])
islocal = int_output(lgdal.OSRIsLocal, [c_void_p])
isprojected = int_output(lgdal.OSRIsProjected, [c_void_p])
# Coordinate transformation
new_ct= srs_output(std_call('OCTNewCoordinateTransformation'), [c_void_p, c_void_p])
destroy_ct = void_output(std_call('OCTDestroyCoordinateTransformation'), [c_void_p], errcheck=False)
| ajibawa-2023/Python-Code-Large/train/row_98705 | 39 | 72 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98705:ImportFrom_L1_C0", "label": "from ctypes import c_char_p, c_int, c_void_p\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0139, 0.0139, 0, 0.66, 0.0, 182, 0, 4, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_char_p", "c_int", "c_void_p", "POINTER"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import c_char_p, c_int, c_void_p, POINTER"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:ImportFrom_L2_C0", "label": "from django.contrib.gis.gdal.libgdal import lgdal, std_call", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0278, 0.0139, 0, 0.66, 0.0294, 460, 0, 2, 0, 0, 460, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.libgdal", "arg_names": [], "import_names": ["lgdal", "std_call"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.libgdal import lgdal, std_call"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:ImportFrom_L3_C0", "label": "from django.contrib.gis.gdal.prototypes.generation import const_string_output, double_output, int_output\u2026", "type": "import", "loc": [3, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0556, 0.0417, 0, 0.66, 0.0588, 737, 0, 6, 0, 0, 737, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.prototypes.generation", "arg_names": [], "import_names": ["const_string_output", "double_output", "int_output", "srs_output", "string_output", "void_output"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.prototypes.generation import \\\n const_string_output, double_output, int_output, \\\n srs_output, string_output, void_output"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:FunctionDef_L8_C0", "label": "srs_double", "type": "function", "loc": [8, 13], "level": 0, "parent": null, "vector": [2, 0, 0.1458, 0.0833, 0, 0.66, 0.0882, 735, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "srs_double", "arg_names": ["f"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def srs_double(f):\n \"\"\"\n Creates a function prototype for the OSR routines that take\n the OSRSpatialReference object and\n \"\"\"\n return double_output(f, [c_void_p, POINTER(c_int)], errcheck=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Expr_L9_C4", "label": "expression", "type": "expression", "loc": [9, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98705:FunctionDef_L8_C0", "vector": [8, 1, 0.1458, 0.0556, 1, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Creates a function prototype for the OSR routines that take\n the OSRSpatialReference object and\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Return_L13_C4", "label": "return", "type": "return", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98705:FunctionDef_L8_C0", "vector": [13, 1, 0.1806, 0.0139, 1, 0.38, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return double_output(f, [c_void_p, POINTER(c_int)], errcheck=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:FunctionDef_L15_C0", "label": "units_func", "type": "function", "loc": [15, 20], "level": 0, "parent": null, "vector": [2, 0, 0.2431, 0.0833, 0, 0.66, 0.1176, 872, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "units_func", "arg_names": ["f"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def units_func(f):\n \"\"\"\n Creates a ctypes function prototype for OSR units functions, e.g.,\n OSRGetAngularUnits, OSRGetLinearUnits.\n \"\"\"\n return double_output(f, [c_void_p, POINTER(c_char_p)], strarg=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Expr_L16_C4", "label": "expression", "type": "expression", "loc": [16, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98705:FunctionDef_L15_C0", "vector": [8, 1, 0.2431, 0.0556, 1, 0.97, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Creates a ctypes function prototype for OSR units functions, e.g.,\n OSRGetAngularUnits, OSRGetLinearUnits.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Return_L20_C4", "label": "return", "type": "return", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98705:FunctionDef_L15_C0", "vector": [13, 1, 0.2778, 0.0139, 1, 0.97, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return double_output(f, [c_void_p, POINTER(c_char_p)], strarg=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L23_C0", "label": "clone_srs = srs_output()", "type": "assigned_variable", "loc": [23, 23], "level": 0, "parent": null, "vector": [14, 0, 0.3194, 0.0139, 0, 0.66, 0.1471, 740, 3, 2, 0, 0, 98, 10, 2], "semantic": {"name": "clone_srs", "arg_names": [], "import_names": [], "rhs_call_name": "srs_output", "annotation": ""}, "snippet": "clone_srs = srs_output(std_call('OSRClone'), [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L24_C0", "label": "new_srs = srs_output()", "type": "assigned_variable", "loc": [24, 24], "level": 0, "parent": null, "vector": [14, 0, 0.3333, 0.0139, 0, 0.66, 0.1765, 252, 3, 2, 0, 0, 98, 10, 2], "semantic": {"name": "new_srs", "arg_names": [], "import_names": [], "rhs_call_name": "srs_output", "annotation": ""}, "snippet": "new_srs = srs_output(std_call('OSRNewSpatialReference'), [c_char_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L25_C0", "label": "release_srs = void_output()", "type": "assigned_variable", "loc": [25, 25], "level": 0, "parent": null, "vector": [14, 0, 0.3472, 0.0139, 0, 0.66, 0.2059, 538, 3, 3, 0, 0, 301, 10, 1], "semantic": {"name": "release_srs", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "release_srs = void_output(lgdal.OSRRelease, [c_void_p], errcheck=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L26_C0", "label": "destroy_srs = void_output()", "type": "assigned_variable", "loc": [26, 26], "level": 0, "parent": null, "vector": [14, 0, 0.3611, 0.0139, 0, 0.66, 0.2353, 374, 3, 3, 0, 0, 301, 10, 2], "semantic": {"name": "destroy_srs", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "destroy_srs = void_output(std_call('OSRDestroySpatialReference'), [c_void_p], errcheck=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L27_C0", "label": "srs_validate = void_output()", "type": "assigned_variable", "loc": [27, 27], "level": 0, "parent": null, "vector": [14, 0, 0.375, 0.0139, 0, 0.66, 0.2647, 737, 3, 2, 0, 0, 301, 10, 1], "semantic": {"name": "srs_validate", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "srs_validate = void_output(lgdal.OSRValidate, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L30_C0", "label": "semi_major = srs_double()", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.4167, 0.0139, 0, 0.66, 0.2941, 727, 3, 1, 0, 0, 735, 10, 1], "semantic": {"name": "semi_major", "arg_names": [], "import_names": [], "rhs_call_name": "srs_double", "annotation": ""}, "snippet": "semi_major = srs_double(lgdal.OSRGetSemiMajor)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L31_C0", "label": "semi_minor = srs_double()", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.4306, 0.0139, 0, 0.66, 0.3235, 958, 3, 1, 0, 0, 735, 10, 1], "semantic": {"name": "semi_minor", "arg_names": [], "import_names": [], "rhs_call_name": "srs_double", "annotation": ""}, "snippet": "semi_minor = srs_double(lgdal.OSRGetSemiMinor)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L32_C0", "label": "invflattening = srs_double()", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.4444, 0.0139, 0, 0.66, 0.3529, 230, 3, 1, 0, 0, 735, 10, 1], "semantic": {"name": "invflattening", "arg_names": [], "import_names": [], "rhs_call_name": "srs_double", "annotation": ""}, "snippet": "invflattening = srs_double(lgdal.OSRGetInvFlattening)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L35_C0", "label": "from_wkt = void_output()", "type": "assigned_variable", "loc": [35, 35], "level": 0, "parent": null, "vector": [14, 0, 0.4861, 0.0139, 0, 0.66, 0.3824, 252, 3, 2, 0, 0, 301, 10, 2], "semantic": {"name": "from_wkt", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "from_wkt = void_output(lgdal.OSRImportFromWkt, [c_void_p, POINTER(c_char_p)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L36_C0", "label": "from_proj = void_output()", "type": "assigned_variable", "loc": [36, 36], "level": 0, "parent": null, "vector": [14, 0, 0.5, 0.0139, 0, 0.66, 0.4118, 571, 3, 2, 0, 0, 301, 10, 1], "semantic": {"name": "from_proj", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "from_proj = void_output(lgdal.OSRImportFromProj4, [c_void_p, c_char_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L37_C0", "label": "from_epsg = void_output()", "type": "assigned_variable", "loc": [37, 37], "level": 0, "parent": null, "vector": [14, 0, 0.5139, 0.0139, 0, 0.66, 0.4412, 268, 3, 2, 0, 0, 301, 10, 2], "semantic": {"name": "from_epsg", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "from_epsg = void_output(std_call('OSRImportFromEPSG'), [c_void_p, c_int])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L38_C0", "label": "from_xml = void_output()", "type": "assigned_variable", "loc": [38, 38], "level": 0, "parent": null, "vector": [14, 0, 0.5278, 0.0139, 0, 0.66, 0.4706, 125, 3, 2, 0, 0, 301, 10, 1], "semantic": {"name": "from_xml", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "from_xml = void_output(lgdal.OSRImportFromXML, [c_void_p, c_char_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L39_C0", "label": "from_user_input = void_output()", "type": "assigned_variable", "loc": [39, 39], "level": 0, "parent": null, "vector": [14, 0, 0.5417, 0.0139, 0, 0.66, 0.5, 542, 3, 2, 0, 0, 301, 10, 2], "semantic": {"name": "from_user_input", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "from_user_input = void_output(std_call('OSRSetFromUserInput'), [c_void_p, c_char_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L42_C0", "label": "morph_to_esri = void_output()", "type": "assigned_variable", "loc": [42, 42], "level": 0, "parent": null, "vector": [14, 0, 0.5833, 0.0139, 0, 0.66, 0.5294, 629, 3, 2, 0, 0, 301, 10, 1], "semantic": {"name": "morph_to_esri", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "morph_to_esri = void_output(lgdal.OSRMorphToESRI, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L43_C0", "label": "morph_from_esri = void_output()", "type": "assigned_variable", "loc": [43, 43], "level": 0, "parent": null, "vector": [14, 0, 0.5972, 0.0139, 0, 0.66, 0.5588, 391, 3, 2, 0, 0, 301, 10, 1], "semantic": {"name": "morph_from_esri", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "morph_from_esri = void_output(lgdal.OSRMorphFromESRI, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L46_C0", "label": "identify_epsg = void_output()", "type": "assigned_variable", "loc": [46, 46], "level": 0, "parent": null, "vector": [14, 0, 0.6389, 0.0139, 0, 0.66, 0.5882, 475, 3, 2, 0, 0, 301, 10, 1], "semantic": {"name": "identify_epsg", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "identify_epsg = void_output(lgdal.OSRAutoIdentifyEPSG, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L49_C0", "label": "linear_units = units_func()", "type": "assigned_variable", "loc": [49, 49], "level": 0, "parent": null, "vector": [14, 0, 0.6806, 0.0139, 0, 0.66, 0.6176, 200, 3, 1, 0, 0, 872, 10, 1], "semantic": {"name": "linear_units", "arg_names": [], "import_names": [], "rhs_call_name": "units_func", "annotation": ""}, "snippet": "linear_units = units_func(lgdal.OSRGetLinearUnits)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L50_C0", "label": "angular_units = units_func()", "type": "assigned_variable", "loc": [50, 50], "level": 0, "parent": null, "vector": [14, 0, 0.6944, 0.0139, 0, 0.66, 0.6471, 279, 3, 1, 0, 0, 872, 10, 1], "semantic": {"name": "angular_units", "arg_names": [], "import_names": [], "rhs_call_name": "units_func", "annotation": ""}, "snippet": "angular_units = units_func(lgdal.OSRGetAngularUnits)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L53_C0", "label": "to_wkt = string_output()", "type": "assigned_variable", "loc": [53, 53], "level": 0, "parent": null, "vector": [14, 0, 0.7361, 0.0139, 0, 0.66, 0.6765, 255, 3, 2, 0, 0, 345, 10, 3], "semantic": {"name": "to_wkt", "arg_names": [], "import_names": [], "rhs_call_name": "string_output", "annotation": ""}, "snippet": "to_wkt = string_output(std_call('OSRExportToWkt'), [c_void_p, POINTER(c_char_p)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L54_C0", "label": "to_proj = string_output()", "type": "assigned_variable", "loc": [54, 54], "level": 0, "parent": null, "vector": [14, 0, 0.75, 0.0139, 0, 0.66, 0.7059, 961, 3, 2, 0, 0, 345, 10, 3], "semantic": {"name": "to_proj", "arg_names": [], "import_names": [], "rhs_call_name": "string_output", "annotation": ""}, "snippet": "to_proj = string_output(std_call('OSRExportToProj4'), [c_void_p, POINTER(c_char_p)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L55_C0", "label": "to_pretty_wkt = string_output()", "type": "assigned_variable", "loc": [55, 55], "level": 0, "parent": null, "vector": [14, 0, 0.7639, 0.0139, 0, 0.66, 0.7353, 490, 3, 3, 0, 0, 345, 10, 3], "semantic": {"name": "to_pretty_wkt", "arg_names": [], "import_names": [], "rhs_call_name": "string_output", "annotation": ""}, "snippet": "to_pretty_wkt = string_output(std_call('OSRExportToPrettyWkt'), [c_void_p, POINTER(c_char_p), c_int], offset=-2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L58_C0", "label": "to_xml = string_output()", "type": "assigned_variable", "loc": [58, 58], "level": 0, "parent": null, "vector": [14, 0, 0.8056, 0.0139, 0, 0.66, 0.7647, 966, 3, 3, 0, 0, 345, 10, 2], "semantic": {"name": "to_xml", "arg_names": [], "import_names": [], "rhs_call_name": "string_output", "annotation": ""}, "snippet": "to_xml = string_output(lgdal.OSRExportToXML, [c_void_p, POINTER(c_char_p), c_char_p], offset=-2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L61_C0", "label": "get_attr_value = const_string_output()", "type": "assigned_variable", "loc": [61, 61], "level": 0, "parent": null, "vector": [14, 0, 0.8472, 0.0139, 0, 0.66, 0.7941, 944, 3, 2, 0, 0, 611, 10, 2], "semantic": {"name": "get_attr_value", "arg_names": [], "import_names": [], "rhs_call_name": "const_string_output", "annotation": ""}, "snippet": "get_attr_value = const_string_output(std_call('OSRGetAttrValue'), [c_void_p, c_char_p, c_int])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L62_C0", "label": "get_auth_name = const_string_output()", "type": "assigned_variable", "loc": [62, 62], "level": 0, "parent": null, "vector": [14, 0, 0.8611, 0.0139, 0, 0.66, 0.8235, 623, 3, 2, 0, 0, 611, 10, 1], "semantic": {"name": "get_auth_name", "arg_names": [], "import_names": [], "rhs_call_name": "const_string_output", "annotation": ""}, "snippet": "get_auth_name = const_string_output(lgdal.OSRGetAuthorityName, [c_void_p, c_char_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L63_C0", "label": "get_auth_code = const_string_output()", "type": "assigned_variable", "loc": [63, 63], "level": 0, "parent": null, "vector": [14, 0, 0.875, 0.0139, 0, 0.66, 0.8529, 290, 3, 2, 0, 0, 611, 10, 1], "semantic": {"name": "get_auth_code", "arg_names": [], "import_names": [], "rhs_call_name": "const_string_output", "annotation": ""}, "snippet": "get_auth_code = const_string_output(lgdal.OSRGetAuthorityCode, [c_void_p, c_char_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L66_C0", "label": "isgeographic = int_output()", "type": "assigned_variable", "loc": [66, 66], "level": 0, "parent": null, "vector": [14, 0, 0.9167, 0.0139, 0, 0.66, 0.8824, 978, 3, 2, 0, 0, 974, 10, 1], "semantic": {"name": "isgeographic", "arg_names": [], "import_names": [], "rhs_call_name": "int_output", "annotation": ""}, "snippet": "isgeographic = int_output(lgdal.OSRIsGeographic, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L67_C0", "label": "islocal = int_output()", "type": "assigned_variable", "loc": [67, 67], "level": 0, "parent": null, "vector": [14, 0, 0.9306, 0.0139, 0, 0.66, 0.9118, 326, 3, 2, 0, 0, 974, 10, 1], "semantic": {"name": "islocal", "arg_names": [], "import_names": [], "rhs_call_name": "int_output", "annotation": ""}, "snippet": "islocal = int_output(lgdal.OSRIsLocal, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L68_C0", "label": "isprojected = int_output()", "type": "assigned_variable", "loc": [68, 68], "level": 0, "parent": null, "vector": [14, 0, 0.9444, 0.0139, 0, 0.66, 0.9412, 361, 3, 2, 0, 0, 974, 10, 1], "semantic": {"name": "isprojected", "arg_names": [], "import_names": [], "rhs_call_name": "int_output", "annotation": ""}, "snippet": "isprojected = int_output(lgdal.OSRIsProjected, [c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L71_C0", "label": "new_ct = srs_output()", "type": "assigned_variable", "loc": [71, 71], "level": 0, "parent": null, "vector": [14, 0, 0.9861, 0.0139, 0, 0.66, 0.9706, 404, 3, 2, 0, 0, 98, 10, 2], "semantic": {"name": "new_ct", "arg_names": [], "import_names": [], "rhs_call_name": "srs_output", "annotation": ""}, "snippet": "new_ct= srs_output(std_call('OCTNewCoordinateTransformation'), [c_void_p, c_void_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98705:Assign_L72_C0", "label": "destroy_ct = void_output()", "type": "assigned_variable", "loc": [72, 72], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.0139, 0, 0.66, 1.0, 575, 3, 3, 0, 0, 301, 10, 2], "semantic": {"name": "destroy_ct", "arg_names": [], "import_names": [], "rhs_call_name": "void_output", "annotation": ""}, "snippet": "destroy_ct = void_output(std_call('OCTDestroyCoordinateTransformation'), [c_void_p], errcheck=False)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98705:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98705:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98705:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98705:Return_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98705:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98705:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98705:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98705:Return_L20_C4"}] |
from django.contrib.gis.gdal.error import OGRException
#### OGRGeomType ####
class OGRGeomType(object):
"Encapulates OGR Geometry Types."
wkb25bit = -2147483648
# Dictionary of acceptable OGRwkbGeometryType s and their string names.
_types = {0 : 'Unknown',
1 : 'Point',
2 : 'LineString',
3 : 'Polygon',
4 : 'MultiPoint',
5 : 'MultiLineString',
6 : 'MultiPolygon',
7 : 'GeometryCollection',
100 : 'None',
101 : 'LinearRing',
1 + wkb25bit: 'Point25D',
2 + wkb25bit: 'LineString25D',
3 + wkb25bit: 'Polygon25D',
4 + wkb25bit: 'MultiPoint25D',
5 + wkb25bit : 'MultiLineString25D',
6 + wkb25bit : 'MultiPolygon25D',
7 + wkb25bit : 'GeometryCollection25D',
}
# Reverse type dictionary, keyed by lower-case of the name.
_str_types = dict([(v.lower(), k) for k, v in _types.items()])
def __init__(self, type_input):
"Figures out the correct OGR Type based upon the input."
if isinstance(type_input, OGRGeomType):
num = type_input.num
elif isinstance(type_input, basestring):
type_input = type_input.lower()
if type_input == 'geometry': type_input='unknown'
num = self._str_types.get(type_input, None)
if num is None:
raise OGRException('Invalid OGR String Type "%s"' % type_input)
elif isinstance(type_input, int):
if not type_input in self._types:
raise OGRException('Invalid OGR Integer Type: %d' % type_input)
num = type_input
else:
raise TypeError('Invalid OGR input type given.')
# Setting the OGR geometry type number.
self.num = num
def __str__(self):
"Returns the value of the name property."
return self.name
def __eq__(self, other):
"""
Does an equivalence test on the OGR type with the given
other OGRGeomType, the short-hand string, or the integer.
"""
if isinstance(other, OGRGeomType):
return self.num == other.num
elif isinstance(other, basestring):
return self.name.lower() == other.lower()
elif isinstance(other, int):
return self.num == other
else:
return False
def __ne__(self, other):
return not (self == other)
@property
def name(self):
"Returns a short-hand string form of the OGR Geometry type."
return self._types[self.num]
@property
def django(self):
"Returns the Django GeometryField for this OGR Type."
s = self.name.replace('25D', '')
if s in ('LinearRing', 'None'):
return None
elif s == 'Unknown':
s = 'Geometry'
return s + 'Field'
| ajibawa-2023/Python-Code-Large/train/row_98706 | 45 | 85 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98706:ImportFrom_L1_C0", "label": "from django.contrib.gis.gdal.error import OGRException", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0118, 0.0118, 0, 0.66, 0.0, 76, 0, 1, 0, 0, 76, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.error", "arg_names": [], "import_names": ["OGRException"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.error import OGRException"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:ClassDef_L4_C0", "label": "OGRGeomType", "type": "class", "loc": [4, 85], "level": 0, "parent": null, "vector": [3, 0, 0.5235, 0.9647, 0, 0.66, 1.0, 85, 0, 6, 0, 0, 186, 0, 17], "semantic": {"name": "OGRGeomType", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OGRGeomType(object):\n \"Encapulates OGR Geometry Types.\"\n\n wkb25bit = -2147483648\n\n # Dictionary of acceptable OGRwkbGeometryType s and their string names.\n _types = {0 : 'Unknown',\n 1 : 'Point',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Expr_L5_C4", "label": "expression", "type": "expression", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:ClassDef_L4_C0", "vector": [8, 1, 0.0588, 0.0118, 1, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Encapulates OGR Geometry Types.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Assign_L7_C4", "label": "wkb25bit =", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:ClassDef_L4_C0", "vector": [14, 1, 0.0824, 0.0118, 1, 0.84, 0.1111, 767, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "wkb25bit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wkb25bit = -2147483648"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Assign_L10_C4", "label": "_types =", "type": "assigned_variable", "loc": [10, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:ClassDef_L4_C0", "vector": [14, 1, 0.2176, 0.2118, 1, 0.84, 0.2222, 513, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_types", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _types = {0 : 'Unknown',\n 1 : 'Point',\n 2 : 'LineString',\n 3 : 'Polygon',\n 4 : 'MultiPoint',\n 5 : 'MultiLineString',\n 6 : 'MultiPolygon',\n 7 : 'GeometryCollection',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Assign_L29_C4", "label": "_str_types = dict()", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:ClassDef_L4_C0", "vector": [14, 1, 0.3412, 0.0118, 1, 0.84, 0.3333, 561, 3, 1, 0, 0, 827, 10, 3], "semantic": {"name": "_str_types", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " _str_types = dict([(v.lower(), k) for k, v in _types.items()])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L31_C4", "label": "__init__", "type": "function", "loc": [31, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:ClassDef_L4_C0", "vector": [2, 1, 0.4706, 0.2235, 1, 0.84, 0.4444, 555, 0, 2, 0, 0, 0, 0, 8], "semantic": {"name": "__init__", "arg_names": ["self", "type_input"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, type_input):\n \"Figures out the correct OGR Type based upon the input.\"\n if isinstance(type_input, OGRGeomType):\n num = type_input.num\n elif isinstance(type_input, basestring):\n type_input = type_input.lower()\n if type_input == 'geometry': type_input='unknown'\n num = self._str_types.get(type_input, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Expr_L32_C8", "label": "expression", "type": "expression", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L31_C4", "vector": [8, 2, 0.3765, 0.0118, 2, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Figures out the correct OGR Type based upon the input.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L33_C8", "label": "if", "type": "if", "loc": [33, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L31_C4", "vector": [4, 2, 0.4647, 0.1647, 2, 0.44, 0.5, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(type_input, OGRGeomType):\n num = type_input.num\n elif isinstance(type_input, basestring):\n type_input = type_input.lower()\n if type_input == 'geometry': type_input='unknown'\n num = self._str_types.get(type_input, None)\n if num is None:\n raise OGRException('Invalid OGR String Type \"%s\"' % type_input)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Assign_L34_C12", "label": "num =", "type": "assigned_variable", "loc": [34, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L33_C8", "vector": [14, 3, 0.4, 0.0118, 3, 0.9, 0.0, 328, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "num", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " num = type_input.num"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L35_C8", "label": "if", "type": "if", "loc": [35, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L33_C8", "vector": [4, 3, 0.4765, 0.1412, 3, 0.9, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(type_input, basestring):\n type_input = type_input.lower()\n if type_input == 'geometry': type_input='unknown'\n num = self._str_types.get(type_input, None)\n if num is None:\n raise OGRException('Invalid OGR String Type \"%s\"' % type_input)\n elif isinstance(type_input, int):\n if not type_input in self._types:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Assign_L36_C12", "label": "type_input = lower()", "type": "assigned_variable", "loc": [36, 36], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L35_C8", "vector": [14, 4, 0.4235, 0.0118, 4, 0.45, 0.0, 536, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "type_input", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " type_input = type_input.lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L37_C12", "label": "if", "type": "if", "loc": [37, 37], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L35_C8", "vector": [4, 4, 0.4353, 0.0118, 4, 0.45, 0.25, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if type_input == 'geometry': type_input='unknown'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Assign_L37_C41", "label": "type_input =", "type": "assigned_variable", "loc": [37, 37], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L37_C12", "vector": [14, 5, 0.4353, 0.0118, 5, 0.51, 0.0, 536, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type_input", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if type_input == 'geometry': type_input='unknown'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Assign_L38_C12", "label": "num = get()", "type": "assigned_variable", "loc": [38, 38], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L35_C8", "vector": [14, 4, 0.4471, 0.0118, 4, 0.45, 0.5, 328, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "num", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " num = self._str_types.get(type_input, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L39_C12", "label": "if", "type": "if", "loc": [39, 40], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L35_C8", "vector": [4, 4, 0.4647, 0.0235, 4, 0.45, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if num is None:\n raise OGRException('Invalid OGR String Type \"%s\"' % type_input)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L41_C8", "label": "if", "type": "if", "loc": [41, 46], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L35_C8", "vector": [4, 4, 0.5118, 0.0706, 4, 0.45, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(type_input, int):\n if not type_input in self._types:\n raise OGRException('Invalid OGR Integer Type: %d' % type_input)\n num = type_input\n else:\n raise TypeError('Invalid OGR input type given.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L42_C12", "label": "if", "type": "if", "loc": [42, 43], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L41_C8", "vector": [4, 5, 0.5, 0.0235, 5, 0.23, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not type_input in self._types:\n raise OGRException('Invalid OGR Integer Type: %d' % type_input)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Assign_L44_C12", "label": "num =", "type": "assigned_variable", "loc": [44, 44], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L41_C8", "vector": [14, 5, 0.5176, 0.0118, 5, 0.23, 1.0, 328, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "num", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " num = type_input"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Assign_L49_C8", "label": "self.num =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L31_C4", "vector": [14, 2, 0.5765, 0.0118, 2, 0.44, 1.0, 970, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.num", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.num = num"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L51_C4", "label": "__str__", "type": "function", "loc": [51, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:ClassDef_L4_C0", "vector": [2, 1, 0.6118, 0.0353, 1, 0.84, 0.5556, 527, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n \"Returns the value of the name property.\"\n return self.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Expr_L52_C8", "label": "expression", "type": "expression", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L51_C4", "vector": [8, 2, 0.6118, 0.0118, 2, 0.12, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the value of the name property.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Return_L53_C8", "label": "return", "type": "return", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L51_C4", "vector": [13, 2, 0.6235, 0.0118, 2, 0.12, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L55_C4", "label": "__eq__", "type": "function", "loc": [55, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:ClassDef_L4_C0", "vector": [2, 1, 0.7176, 0.1529, 1, 0.84, 0.6667, 763, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "__eq__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __eq__(self, other):\n \"\"\"\n Does an equivalence test on the OGR type with the given\n other OGRGeomType, the short-hand string, or the integer.\n \"\"\"\n if isinstance(other, OGRGeomType):\n return self.num == other.num\n elif isinstance(other, basestring):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Expr_L56_C8", "label": "expression", "type": "expression", "loc": [56, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L55_C4", "vector": [8, 2, 0.6765, 0.0471, 2, 0.04, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Does an equivalence test on the OGR type with the given\n other OGRGeomType, the short-hand string, or the integer.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L60_C8", "label": "if", "type": "if", "loc": [60, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L55_C4", "vector": [4, 2, 0.7471, 0.0941, 2, 0.04, 1.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, OGRGeomType):\n return self.num == other.num\n elif isinstance(other, basestring):\n return self.name.lower() == other.lower()\n elif isinstance(other, int):\n return self.num == other\n else:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Return_L61_C12", "label": "return", "type": "return", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L60_C8", "vector": [13, 3, 0.7176, 0.0118, 3, 0.68, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.num == other.num"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L62_C8", "label": "if", "type": "if", "loc": [62, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L60_C8", "vector": [4, 3, 0.7588, 0.0706, 3, 0.68, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(other, basestring):\n return self.name.lower() == other.lower()\n elif isinstance(other, int):\n return self.num == other\n else:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Return_L63_C12", "label": "return", "type": "return", "loc": [63, 63], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L62_C8", "vector": [13, 4, 0.7412, 0.0118, 4, 0.45, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.name.lower() == other.lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L64_C8", "label": "if", "type": "if", "loc": [64, 67], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L62_C8", "vector": [4, 4, 0.7706, 0.0471, 4, 0.45, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(other, int):\n return self.num == other\n else:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Return_L65_C12", "label": "return", "type": "return", "loc": [65, 65], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L64_C8", "vector": [13, 5, 0.7647, 0.0118, 5, 0.48, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.num == other"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Return_L67_C12", "label": "return", "type": "return", "loc": [67, 67], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L64_C8", "vector": [13, 5, 0.7882, 0.0118, 5, 0.48, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L69_C4", "label": "__ne__", "type": "function", "loc": [69, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:ClassDef_L4_C0", "vector": [2, 1, 0.8176, 0.0235, 1, 0.84, 0.7778, 254, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__ne__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __ne__(self, other):\n return not (self == other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Return_L70_C8", "label": "return", "type": "return", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L69_C4", "vector": [13, 2, 0.8235, 0.0118, 2, 0.47, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return not (self == other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L73_C4", "label": "name", "type": "function", "loc": [73, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:ClassDef_L4_C0", "vector": [2, 1, 0.8706, 0.0353, 1, 0.84, 0.8889, 57, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def name(self):\n \"Returns a short-hand string form of the OGR Geometry type.\"\n return self._types[self.num]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Expr_L74_C8", "label": "expression", "type": "expression", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L73_C4", "vector": [8, 2, 0.8706, 0.0118, 2, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a short-hand string form of the OGR Geometry type.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Return_L75_C8", "label": "return", "type": "return", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L73_C4", "vector": [13, 2, 0.8824, 0.0118, 2, 0.05, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._types[self.num]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L78_C4", "label": "django", "type": "function", "loc": [78, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:ClassDef_L4_C0", "vector": [2, 1, 0.9588, 0.0941, 1, 0.84, 1.0, 294, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "django", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def django(self):\n \"Returns the Django GeometryField for this OGR Type.\"\n s = self.name.replace('25D', '')\n if s in ('LinearRing', 'None'):\n return None\n elif s == 'Unknown':\n s = 'Geometry'\n return s + 'Field'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Expr_L79_C8", "label": "expression", "type": "expression", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L78_C4", "vector": [8, 2, 0.9294, 0.0118, 2, 0.51, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the Django GeometryField for this OGR Type.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Assign_L80_C8", "label": "s = replace()", "type": "assigned_variable", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L78_C4", "vector": [14, 2, 0.9412, 0.0118, 2, 0.51, 0.3333, 553, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " s = self.name.replace('25D', '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L81_C8", "label": "if", "type": "if", "loc": [81, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L78_C4", "vector": [4, 2, 0.9706, 0.0471, 2, 0.51, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if s in ('LinearRing', 'None'):\n return None\n elif s == 'Unknown':\n s = 'Geometry'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Return_L82_C12", "label": "return", "type": "return", "loc": [82, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L81_C8", "vector": [13, 3, 0.9647, 0.0118, 3, 0.22, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L83_C8", "label": "if", "type": "if", "loc": [83, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L81_C8", "vector": [4, 3, 0.9824, 0.0235, 3, 0.22, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif s == 'Unknown':\n s = 'Geometry'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Assign_L84_C12", "label": "s =", "type": "assigned_variable", "loc": [84, 84], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L83_C8", "vector": [14, 4, 0.9882, 0.0118, 4, 0.62, 0.0, 553, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = 'Geometry'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98706:Return_L85_C8", "label": "return", "type": "return", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L78_C4", "vector": [13, 2, 1.0, 0.0118, 2, 0.51, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return s + 'Field'"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98706:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Expr_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Assign_L34_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Assign_L36_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L37_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L37_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Assign_L37_C41"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Assign_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L39_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L42_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Assign_L44_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Expr_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Return_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Expr_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L60_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Return_L61_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L60_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Return_L63_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L64_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Return_L65_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L64_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Return_L67_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Return_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Expr_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Return_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Expr_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Assign_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L81_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Return_L82_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L81_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:If_L83_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Assign_L84_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:FunctionDef_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Return_L85_C8"}] |
"""
Module for executing all of the GDAL tests. None
of these tests require the use of the database.
"""
from django.utils.unittest import TestSuite, TextTestRunner
# Importing the GDAL test modules.
import test_driver, test_ds, test_envelope, test_geom, test_srs
test_suites = [test_driver.suite(),
test_ds.suite(),
test_envelope.suite(),
test_geom.suite(),
test_srs.suite(),
]
def suite():
"Builds a test suite for the GDAL tests."
s = TestSuite()
map(s.addTest, test_suites)
return s
def run(verbosity=1):
"Runs the GDAL tests."
TextTestRunner(verbosity=verbosity).run(suite())
| ajibawa-2023/Python-Code-Large/train/row_98707 | 12 | 25 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98707:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.1, 0.16, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nModule for executing all of the GDAL tests. None\nof these tests require the use of the database.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98707:ImportFrom_L5_C0", "label": "from django.utils.unittest import TestSuite, TextTestRunner", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.04, 0, 0.66, 0.2, 270, 0, 2, 0, 0, 270, 0, 0], "semantic": {"name": "django.utils.unittest", "arg_names": [], "import_names": ["TestSuite", "TextTestRunner"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.unittest import TestSuite, TextTestRunner"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98707:Import_L8_C0", "label": "test_driver import test_driver, test_ds, test_envelope\u2026", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.32, 0.04, 0, 0.66, 0.4, 924, 0, 5, 0, 0, 924, 0, 0], "semantic": {"name": "test_driver", "arg_names": [], "import_names": ["test_driver", "test_ds", "test_envelope", "test_geom", "test_srs"], "rhs_call_name": "", "annotation": ""}, "snippet": "import test_driver, test_ds, test_envelope, test_geom, test_srs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98707:Assign_L10_C0", "label": "test_suites =", "type": "assigned_variable", "loc": [10, 15], "level": 0, "parent": null, "vector": [14, 0, 0.5, 0.24, 0, 0.66, 0.6, 781, 0, 0, 0, 0, 0, 5, 5], "semantic": {"name": "test_suites", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "test_suites = [test_driver.suite(),\n test_ds.suite(),\n test_envelope.suite(),\n test_geom.suite(),\n test_srs.suite(),\n ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98707:FunctionDef_L17_C0", "label": "suite", "type": "function", "loc": [17, 21], "level": 0, "parent": null, "vector": [2, 0, 0.76, 0.2, 0, 0.66, 0.8, 425, 0, 0, 1, 0, 0, 0, 2], "semantic": {"name": "suite", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def suite():\n \"Builds a test suite for the GDAL tests.\"\n s = TestSuite()\n map(s.addTest, test_suites)\n return s"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98707:Expr_L18_C4", "label": "expression", "type": "expression", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98707:FunctionDef_L17_C0", "vector": [8, 1, 0.72, 0.04, 1, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Builds a test suite for the GDAL tests.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98707:Assign_L19_C4", "label": "s = TestSuite()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98707:FunctionDef_L17_C0", "vector": [14, 1, 0.76, 0.04, 1, 0.75, 0.3333, 553, 3, 0, 0, 0, 75, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "TestSuite", "annotation": ""}, "snippet": " s = TestSuite()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98707:Expr_L20_C4", "label": "map()", "type": "expression", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98707:FunctionDef_L17_C0", "vector": [8, 1, 0.8, 0.04, 1, 0.75, 0.6667, 53, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "map", "arg_names": [], "import_names": [], "rhs_call_name": "map", "annotation": ""}, "snippet": " map(s.addTest, test_suites)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98707:Return_L21_C4", "label": "return", "type": "return", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98707:FunctionDef_L17_C0", "vector": [13, 1, 0.84, 0.04, 1, 0.75, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return s"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98707:FunctionDef_L23_C0", "label": "run", "type": "function", "loc": [23, 25], "level": 0, "parent": null, "vector": [2, 0, 0.96, 0.12, 0, 0.66, 1.0, 679, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "run", "arg_names": ["verbosity"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def run(verbosity=1):\n \"Runs the GDAL tests.\"\n TextTestRunner(verbosity=verbosity).run(suite())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98707:Expr_L24_C4", "label": "expression", "type": "expression", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98707:FunctionDef_L23_C0", "vector": [8, 1, 0.96, 0.04, 1, 0.08, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Runs the GDAL tests.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98707:Expr_L25_C4", "label": "run()", "type": "expression", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98707:FunctionDef_L23_C0", "vector": [8, 1, 1.0, 0.04, 1, 0.08, 1.0, 679, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " TextTestRunner(verbosity=verbosity).run(suite())"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98707:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98707:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98707:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98707:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98707:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98707:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98707:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98707:Return_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98707:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98707:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98707:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98707:Expr_L25_C4"}] |
# The GDAL C library, OGR exception, and the Field object
from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.error import OGRException, OGRIndexError
from django.contrib.gis.gdal.field import Field
from django.contrib.gis.gdal.geometries import OGRGeometry, OGRGeomType
from django.contrib.gis.gdal.srs import SpatialReference
# ctypes function prototypes
from django.contrib.gis.gdal.prototypes import ds as capi, geom as geom_api
# For more information, see the OGR C API source code:
# http://www.gdal.org/ogr/ogr__api_8h.html
#
# The OGR_F_* routines are relevant here.
class Feature(GDALBase):
"A class that wraps an OGR Feature, needs to be instantiated from a Layer object."
#### Python 'magic' routines ####
def __init__(self, feat, fdefn):
"Initializes on the pointers for the feature and the layer definition."
if not feat or not fdefn:
raise OGRException('Cannot create OGR Feature, invalid pointer given.')
self.ptr = feat
self._fdefn = fdefn
def __del__(self):
"Releases a reference to this object."
if self._ptr: capi.destroy_feature(self._ptr)
def __getitem__(self, index):
"""
Gets the Field object at the specified index, which may be either
an integer or the Field's string label. Note that the Field object
is not the field's _value_ -- use the `get` method instead to
retrieve the value (e.g. an integer) instead of a Field instance.
"""
if isinstance(index, basestring):
i = self.index(index)
else:
if index < 0 or index > self.num_fields:
raise OGRIndexError('index out of range')
i = index
return Field(self.ptr, i)
def __iter__(self):
"Iterates over each field in the Feature."
for i in xrange(self.num_fields):
yield self[i]
def __len__(self):
"Returns the count of fields in this feature."
return self.num_fields
def __str__(self):
"The string name of the feature."
return 'Feature FID %d in Layer<%s>' % (self.fid, self.layer_name)
def __eq__(self, other):
"Does equivalence testing on the features."
return bool(capi.feature_equal(self.ptr, other._ptr))
#### Feature Properties ####
@property
def fid(self):
"Returns the feature identifier."
return capi.get_fid(self.ptr)
@property
def layer_name(self):
"Returns the name of the layer for the feature."
return capi.get_feat_name(self._fdefn)
@property
def num_fields(self):
"Returns the number of fields in the Feature."
return capi.get_feat_field_count(self.ptr)
@property
def fields(self):
"Returns a list of fields in the Feature."
return [capi.get_field_name(capi.get_field_defn(self._fdefn, i))
for i in xrange(self.num_fields)]
@property
def geom(self):
"Returns the OGR Geometry for this Feature."
# Retrieving the geometry pointer for the feature.
geom_ptr = capi.get_feat_geom_ref(self.ptr)
return OGRGeometry(geom_api.clone_geom(geom_ptr))
@property
def geom_type(self):
"Returns the OGR Geometry Type for this Feture."
return OGRGeomType(capi.get_fd_geom_type(self._fdefn))
#### Feature Methods ####
def get(self, field):
"""
Returns the value of the field, instead of an instance of the Field
object. May take a string of the field name or a Field object as
parameters.
"""
field_name = getattr(field, 'name', field)
return self[field_name].value
def index(self, field_name):
"Returns the index of the given field name."
i = capi.get_field_index(self.ptr, field_name)
if i < 0: raise OGRIndexError('invalid OFT field name given: "%s"' % field_name)
return i
| ajibawa-2023/Python-Code-Large/train/row_98708 | 65 | 110 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98708:ImportFrom_L2_C0", "label": "from django.contrib.gis.gdal.base import GDALBase", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0182, 0.0091, 0, 0.66, 0.0, 771, 0, 1, 0, 0, 771, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.base", "arg_names": [], "import_names": ["GDALBase"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.base import GDALBase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:ImportFrom_L3_C0", "label": "from django.contrib.gis.gdal.error import OGRException, OGRIndexError", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0273, 0.0091, 0, 0.66, 0.1667, 76, 0, 2, 0, 0, 76, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.error", "arg_names": [], "import_names": ["OGRException", "OGRIndexError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.error import OGRException, OGRIndexError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:ImportFrom_L4_C0", "label": "from django.contrib.gis.gdal.field import Field", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0364, 0.0091, 0, 0.66, 0.3333, 367, 0, 1, 0, 0, 367, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.field", "arg_names": [], "import_names": ["Field"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.field import Field"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:ImportFrom_L5_C0", "label": "from django.contrib.gis.gdal.geometries import OGRGeometry, OGRGeomType", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0091, 0, 0.66, 0.5, 671, 0, 2, 0, 0, 671, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.geometries", "arg_names": [], "import_names": ["OGRGeometry", "OGRGeomType"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.geometries import OGRGeometry, OGRGeomType"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:ImportFrom_L6_C0", "label": "from django.contrib.gis.gdal.srs import SpatialReference", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0545, 0.0091, 0, 0.66, 0.6667, 912, 0, 1, 0, 0, 912, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.srs", "arg_names": [], "import_names": ["SpatialReference"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.srs import SpatialReference"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:ImportFrom_L9_C0", "label": "from django.contrib.gis.gdal.prototypes import capi, geom_api", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0818, 0.0091, 0, 0.66, 0.8333, 730, 0, 2, 0, 0, 730, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.prototypes", "arg_names": [], "import_names": ["capi", "geom_api"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.prototypes import ds as capi, geom as geom_api"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "label": "Feature", "type": "class", "loc": [15, 110], "level": 0, "parent": null, "vector": [3, 0, 0.5682, 0.8727, 0, 0.66, 1.0, 382, 0, 15, 0, 0, 436, 0, 23], "semantic": {"name": "Feature", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Feature(GDALBase):\n \"A class that wraps an OGR Feature, needs to be instantiated from a Layer object.\"\n\n #### Python 'magic' routines ####\n def __init__(self, feat, fdefn):\n \"Initializes on the pointers for the feature and the layer definition.\"\n if not feat or not fdefn:\n raise OGRException('Cannot create OGR Feature, invalid pointer given.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L16_C4", "label": "expression", "type": "expression", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "vector": [8, 1, 0.1455, 0.0091, 1, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"A class that wraps an OGR Feature, needs to be instantiated from a Layer object.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L19_C4", "label": "__init__", "type": "function", "loc": [19, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "vector": [2, 1, 0.1955, 0.0545, 1, 0.07, 0.0667, 555, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "feat", "fdefn"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, feat, fdefn):\n \"Initializes on the pointers for the feature and the layer definition.\"\n if not feat or not fdefn:\n raise OGRException('Cannot create OGR Feature, invalid pointer given.')\n self.ptr = feat\n self._fdefn = fdefn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L20_C8", "label": "expression", "type": "expression", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L19_C4", "vector": [8, 2, 0.1818, 0.0091, 2, 0.39, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Initializes on the pointers for the feature and the layer definition.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:If_L21_C8", "label": "if", "type": "if", "loc": [21, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L19_C4", "vector": [4, 2, 0.1955, 0.0182, 2, 0.39, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not feat or not fdefn:\n raise OGRException('Cannot create OGR Feature, invalid pointer given.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Assign_L23_C8", "label": "self.ptr =", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L19_C4", "vector": [14, 2, 0.2091, 0.0091, 2, 0.39, 0.6667, 386, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.ptr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ptr = feat"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Assign_L24_C8", "label": "self._fdefn =", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L19_C4", "vector": [14, 2, 0.2182, 0.0091, 2, 0.39, 1.0, 419, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._fdefn", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._fdefn = fdefn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L26_C4", "label": "__del__", "type": "function", "loc": [26, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "vector": [2, 1, 0.2455, 0.0273, 1, 0.07, 0.1333, 258, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__del__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __del__(self):\n \"Releases a reference to this object.\"\n if self._ptr: capi.destroy_feature(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L27_C8", "label": "expression", "type": "expression", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L26_C4", "vector": [8, 2, 0.2455, 0.0091, 2, 0.77, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Releases a reference to this object.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:If_L28_C8", "label": "if", "type": "if", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L26_C4", "vector": [4, 2, 0.2545, 0.0091, 2, 0.77, 1.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._ptr: capi.destroy_feature(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L28_C22", "label": "destroy_feature()", "type": "expression", "loc": [28, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:If_L28_C8", "vector": [8, 3, 0.2545, 0.0091, 3, 0.56, 0.0, 748, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "destroy_feature", "arg_names": [], "import_names": [], "rhs_call_name": "destroy_feature", "annotation": ""}, "snippet": " if self._ptr: capi.destroy_feature(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L30_C4", "label": "__getitem__", "type": "function", "loc": [30, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "vector": [2, 1, 0.3318, 0.1273, 1, 0.07, 0.2, 698, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "__getitem__", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getitem__(self, index):\n \"\"\"\n Gets the Field object at the specified index, which may be either\n an integer or the Field's string label. Note that the Field object\n is not the field's _value_ -- use the `get` method instead to \n retrieve the value (e.g. an integer) instead of a Field instance.\n \"\"\"\n if isinstance(index, basestring):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L31_C8", "label": "expression", "type": "expression", "loc": [31, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L30_C4", "vector": [8, 2, 0.3045, 0.0545, 2, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Gets the Field object at the specified index, which may be either\n an integer or the Field's string label. Note that the Field object\n is not the field's _value_ -- use the `get` method instead to \n retrieve the value (e.g. an integer) instead of a Field instance.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:If_L37_C8", "label": "if", "type": "if", "loc": [37, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L30_C4", "vector": [4, 2, 0.3591, 0.0545, 2, 0.18, 0.5, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(index, basestring):\n i = self.index(index)\n else:\n if index < 0 or index > self.num_fields:\n raise OGRIndexError('index out of range')\n i = index"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Assign_L38_C12", "label": "i = index()", "type": "assigned_variable", "loc": [38, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:If_L37_C8", "vector": [14, 3, 0.3455, 0.0091, 3, 0.74, 0.0, 826, 3, 1, 0, 0, 780, 10, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "index", "annotation": ""}, "snippet": " i = self.index(index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:If_L40_C12", "label": "if", "type": "if", "loc": [40, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:If_L37_C8", "vector": [4, 3, 0.3682, 0.0182, 3, 0.74, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if index < 0 or index > self.num_fields:\n raise OGRIndexError('index out of range')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Assign_L42_C12", "label": "i =", "type": "assigned_variable", "loc": [42, 42], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:If_L37_C8", "vector": [14, 3, 0.3818, 0.0091, 3, 0.74, 1.0, 826, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " i = index"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Return_L43_C8", "label": "return", "type": "return", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L30_C4", "vector": [13, 2, 0.3909, 0.0091, 2, 0.18, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Field(self.ptr, i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L45_C4", "label": "__iter__", "type": "function", "loc": [45, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "vector": [2, 1, 0.4227, 0.0364, 1, 0.07, 0.2667, 891, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n \"Iterates over each field in the Feature.\"\n for i in xrange(self.num_fields):\n yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L46_C8", "label": "expression", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L45_C4", "vector": [8, 2, 0.4182, 0.0091, 2, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Iterates over each field in the Feature.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:For_L47_C8", "label": "for i", "type": "for", "loc": [47, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L45_C4", "vector": [6, 2, 0.4318, 0.0182, 2, 0.94, 1.0, 826, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange(self.num_fields):\n yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L48_C12", "label": "expression", "type": "expression", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:For_L47_C8", "vector": [8, 3, 0.4364, 0.0091, 3, 0.96, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L50_C4", "label": "__len__", "type": "function", "loc": [50, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "vector": [2, 1, 0.4636, 0.0273, 1, 0.07, 0.3333, 76, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__len__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __len__(self):\n \"Returns the count of fields in this feature.\"\n return self.num_fields"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L51_C8", "label": "expression", "type": "expression", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L50_C4", "vector": [8, 2, 0.4636, 0.0091, 2, 0.19, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the count of fields in this feature.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Return_L52_C8", "label": "return", "type": "return", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L50_C4", "vector": [13, 2, 0.4727, 0.0091, 2, 0.19, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.num_fields"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L54_C4", "label": "__str__", "type": "function", "loc": [54, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "vector": [2, 1, 0.5, 0.0273, 1, 0.07, 0.4, 527, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n \"The string name of the feature.\"\n return 'Feature FID %d in Layer<%s>' % (self.fid, self.layer_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L55_C8", "label": "expression", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L54_C4", "vector": [8, 2, 0.5, 0.0091, 2, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"The string name of the feature.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Return_L56_C8", "label": "return", "type": "return", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L54_C4", "vector": [13, 2, 0.5091, 0.0091, 2, 0.75, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'Feature FID %d in Layer<%s>' % (self.fid, self.layer_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L58_C4", "label": "__eq__", "type": "function", "loc": [58, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "vector": [2, 1, 0.5364, 0.0273, 1, 0.07, 0.4667, 763, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__eq__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __eq__(self, other):\n \"Does equivalence testing on the features.\"\n return bool(capi.feature_equal(self.ptr, other._ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L59_C8", "label": "expression", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L58_C4", "vector": [8, 2, 0.5364, 0.0091, 2, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Does equivalence testing on the features.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Return_L60_C8", "label": "return", "type": "return", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L58_C4", "vector": [13, 2, 0.5455, 0.0091, 2, 0.28, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bool(capi.feature_equal(self.ptr, other._ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L64_C4", "label": "fid", "type": "function", "loc": [64, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "vector": [2, 1, 0.5909, 0.0273, 1, 0.07, 0.5333, 572, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "fid", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fid(self):\n \"Returns the feature identifier.\"\n return capi.get_fid(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L65_C8", "label": "expression", "type": "expression", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L64_C4", "vector": [8, 2, 0.5909, 0.0091, 2, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the feature identifier.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Return_L66_C8", "label": "return", "type": "return", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L64_C4", "vector": [13, 2, 0.6, 0.0091, 2, 0.37, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_fid(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L69_C4", "label": "layer_name", "type": "function", "loc": [69, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "vector": [2, 1, 0.6364, 0.0273, 1, 0.07, 0.6, 120, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "layer_name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def layer_name(self):\n \"Returns the name of the layer for the feature.\"\n return capi.get_feat_name(self._fdefn)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L70_C8", "label": "expression", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L69_C4", "vector": [8, 2, 0.6364, 0.0091, 2, 0.2, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the name of the layer for the feature.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Return_L71_C8", "label": "return", "type": "return", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L69_C4", "vector": [13, 2, 0.6455, 0.0091, 2, 0.2, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_feat_name(self._fdefn)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L74_C4", "label": "num_fields", "type": "function", "loc": [74, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "vector": [2, 1, 0.6818, 0.0273, 1, 0.07, 0.6667, 589, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "num_fields", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def num_fields(self):\n \"Returns the number of fields in the Feature.\"\n return capi.get_feat_field_count(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L75_C8", "label": "expression", "type": "expression", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L74_C4", "vector": [8, 2, 0.6818, 0.0091, 2, 0.48, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the number of fields in the Feature.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Return_L76_C8", "label": "return", "type": "return", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L74_C4", "vector": [13, 2, 0.6909, 0.0091, 2, 0.48, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_feat_field_count(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L79_C4", "label": "fields", "type": "function", "loc": [79, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "vector": [2, 1, 0.7318, 0.0364, 1, 0.07, 0.7333, 358, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "fields", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fields(self):\n \"Returns a list of fields in the Feature.\"\n return [capi.get_field_name(capi.get_field_defn(self._fdefn, i)) \n for i in xrange(self.num_fields)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L80_C8", "label": "expression", "type": "expression", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L79_C4", "vector": [8, 2, 0.7273, 0.0091, 2, 0.09, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a list of fields in the Feature.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Return_L81_C8", "label": "return", "type": "return", "loc": [81, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L79_C4", "vector": [13, 2, 0.7409, 0.0182, 2, 0.09, 1.0, 0, 5, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [capi.get_field_name(capi.get_field_defn(self._fdefn, i)) \n for i in xrange(self.num_fields)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L85_C4", "label": "geom", "type": "function", "loc": [85, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "vector": [2, 1, 0.7909, 0.0455, 1, 0.07, 0.8, 5, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "geom", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geom(self):\n \"Returns the OGR Geometry for this Feature.\"\n # Retrieving the geometry pointer for the feature.\n geom_ptr = capi.get_feat_geom_ref(self.ptr)\n return OGRGeometry(geom_api.clone_geom(geom_ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L86_C8", "label": "expression", "type": "expression", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L85_C4", "vector": [8, 2, 0.7818, 0.0091, 2, 0.5, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the OGR Geometry for this Feature.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Assign_L88_C8", "label": "geom_ptr = get_feat_geom_ref()", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L85_C4", "vector": [14, 2, 0.8, 0.0091, 2, 0.5, 0.5, 562, 3, 1, 0, 0, 349, 10, 1], "semantic": {"name": "geom_ptr", "arg_names": [], "import_names": [], "rhs_call_name": "get_feat_geom_ref", "annotation": ""}, "snippet": " geom_ptr = capi.get_feat_geom_ref(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Return_L89_C8", "label": "return", "type": "return", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L85_C4", "vector": [13, 2, 0.8091, 0.0091, 2, 0.5, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return OGRGeometry(geom_api.clone_geom(geom_ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L92_C4", "label": "geom_type", "type": "function", "loc": [92, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "vector": [2, 1, 0.8455, 0.0273, 1, 0.07, 0.8667, 770, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "geom_type", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geom_type(self):\n \"Returns the OGR Geometry Type for this Feture.\"\n return OGRGeomType(capi.get_fd_geom_type(self._fdefn))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L93_C8", "label": "expression", "type": "expression", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L92_C4", "vector": [8, 2, 0.8455, 0.0091, 2, 0.86, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the OGR Geometry Type for this Feture.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Return_L94_C8", "label": "return", "type": "return", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L92_C4", "vector": [13, 2, 0.8545, 0.0091, 2, 0.86, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return OGRGeomType(capi.get_fd_geom_type(self._fdefn))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L97_C4", "label": "get", "type": "function", "loc": [97, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "vector": [2, 1, 0.9136, 0.0727, 1, 0.07, 0.9333, 607, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "get", "arg_names": ["self", "field"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self, field):\n \"\"\"\n Returns the value of the field, instead of an instance of the Field\n object. May take a string of the field name or a Field object as\n parameters.\n \"\"\"\n field_name = getattr(field, 'name', field)\n return self[field_name].value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L98_C8", "label": "expression", "type": "expression", "loc": [98, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L97_C4", "vector": [8, 2, 0.9091, 0.0455, 2, 0.69, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the value of the field, instead of an instance of the Field\n object. May take a string of the field name or a Field object as\n parameters.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Assign_L103_C8", "label": "field_name = getattr()", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L97_C4", "vector": [14, 2, 0.9364, 0.0091, 2, 0.69, 0.5, 918, 3, 3, 0, 0, 121, 10, 1], "semantic": {"name": "field_name", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " field_name = getattr(field, 'name', field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Return_L104_C8", "label": "return", "type": "return", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L97_C4", "vector": [13, 2, 0.9455, 0.0091, 2, 0.69, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self[field_name].value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L106_C4", "label": "index", "type": "function", "loc": [106, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "vector": [2, 1, 0.9818, 0.0455, 1, 0.07, 1.0, 780, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "index", "arg_names": ["self", "field_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def index(self, field_name):\n \"Returns the index of the given field name.\"\n i = capi.get_field_index(self.ptr, field_name)\n if i < 0: raise OGRIndexError('invalid OFT field name given: \"%s\"' % field_name)\n return i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L107_C8", "label": "expression", "type": "expression", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L106_C4", "vector": [8, 2, 0.9727, 0.0091, 2, 0.53, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the index of the given field name.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Assign_L108_C8", "label": "i = get_field_index()", "type": "assigned_variable", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L106_C4", "vector": [14, 2, 0.9818, 0.0091, 2, 0.53, 0.3333, 826, 3, 2, 0, 0, 718, 10, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "get_field_index", "annotation": ""}, "snippet": " i = capi.get_field_index(self.ptr, field_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:If_L109_C8", "label": "if", "type": "if", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L106_C4", "vector": [4, 2, 0.9909, 0.0091, 2, 0.53, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i < 0: raise OGRIndexError('invalid OFT field name given: \"%s\"' % field_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98708:Return_L110_C8", "label": "return", "type": "return", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L106_C4", "vector": [13, 2, 1.0, 0.0091, 2, 0.53, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return i"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:If_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Assign_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:If_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:If_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L28_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:If_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:If_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Assign_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:If_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:If_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:If_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Assign_L42_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Return_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:For_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:For_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Return_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Return_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Return_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Return_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Return_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Return_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Return_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Assign_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Return_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Return_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Assign_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Return_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Assign_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:If_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:FunctionDef_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Return_L110_C8"}] |
"""
The OGRGeometry is a wrapper for using the OGR Geometry class
(see http://www.gdal.org/ogr/classOGRGeometry.html). OGRGeometry
may be instantiated when reading geometries from OGR Data Sources
(e.g. SHP files), or when given OGC WKT (a string).
While the 'full' API is not present yet, the API is "pythonic" unlike
the traditional and "next-generation" OGR Python bindings. One major
advantage OGR Geometries have over their GEOS counterparts is support
for spatial reference systems and their transformation.
Example:
>>> from django.contrib.gis.gdal import OGRGeometry, OGRGeomType, SpatialReference
>>> wkt1, wkt2 = 'POINT(-90 30)', 'POLYGON((0 0, 5 0, 5 5, 0 5)'
>>> pnt = OGRGeometry(wkt1)
>>> print pnt
POINT (-90 30)
>>> mpnt = OGRGeometry(OGRGeomType('MultiPoint'), SpatialReference('WGS84'))
>>> mpnt.add(wkt1)
>>> mpnt.add(wkt1)
>>> print mpnt
MULTIPOINT (-90 30,-90 30)
>>> print mpnt.srs.name
WGS 84
>>> print mpnt.srs.proj
+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
>>> mpnt.transform_to(SpatialReference('NAD27'))
>>> print mpnt.proj
+proj=longlat +ellps=clrk66 +datum=NAD27 +no_defs
>>> print mpnt
MULTIPOINT (-89.999930378602485 29.999797886557641,-89.999930378602485 29.999797886557641)
The OGRGeomType class is to make it easy to specify an OGR geometry type:
>>> from django.contrib.gis.gdal import OGRGeomType
>>> gt1 = OGRGeomType(3) # Using an integer for the type
>>> gt2 = OGRGeomType('Polygon') # Using a string
>>> gt3 = OGRGeomType('POLYGON') # It's case-insensitive
>>> print gt1 == 3, gt1 == 'Polygon' # Equivalence works w/non-OGRGeomType objects
True
"""
# Python library requisites.
import sys
from binascii import a2b_hex
from ctypes import byref, string_at, c_char_p, c_double, c_ubyte, c_void_p
# Getting GDAL prerequisites
from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.envelope import Envelope, OGREnvelope
from django.contrib.gis.gdal.error import OGRException, OGRIndexError, SRSException
from django.contrib.gis.gdal.geomtype import OGRGeomType
from django.contrib.gis.gdal.libgdal import GEOJSON, GDAL_VERSION
from django.contrib.gis.gdal.srs import SpatialReference, CoordTransform
# Getting the ctypes prototype functions that interface w/the GDAL C library.
from django.contrib.gis.gdal.prototypes import geom as capi, srs as srs_api
# For recognizing geometry input.
from django.contrib.gis.geometry.regex import hex_regex, wkt_regex, json_regex
# For more information, see the OGR C API source code:
# http://www.gdal.org/ogr/ogr__api_8h.html
#
# The OGR_G_* routines are relevant here.
#### OGRGeometry Class ####
class OGRGeometry(GDALBase):
"Generally encapsulates an OGR geometry."
def __init__(self, geom_input, srs=None):
"Initializes Geometry on either WKT or an OGR pointer as input."
str_instance = isinstance(geom_input, basestring)
# If HEX, unpack input to to a binary buffer.
if str_instance and hex_regex.match(geom_input):
geom_input = buffer(a2b_hex(geom_input.upper()))
str_instance = False
# Constructing the geometry,
if str_instance:
# Checking if unicode
if isinstance(geom_input, unicode):
# Encoding to ASCII, WKT or HEX doesn't need any more.
geom_input = geom_input.encode('ascii')
wkt_m = wkt_regex.match(geom_input)
json_m = json_regex.match(geom_input)
if wkt_m:
if wkt_m.group('srid'):
# If there's EWKT, set the SRS w/value of the SRID.
srs = int(wkt_m.group('srid'))
if wkt_m.group('type').upper() == 'LINEARRING':
# OGR_G_CreateFromWkt doesn't work with LINEARRING WKT.
# See http://trac.osgeo.org/gdal/ticket/1992.
g = capi.create_geom(OGRGeomType(wkt_m.group('type')).num)
capi.import_wkt(g, byref(c_char_p(wkt_m.group('wkt'))))
else:
g = capi.from_wkt(byref(c_char_p(wkt_m.group('wkt'))), None, byref(c_void_p()))
elif json_m:
if GEOJSON:
g = capi.from_json(geom_input)
else:
raise NotImplementedError('GeoJSON input only supported on GDAL 1.5+.')
else:
# Seeing if the input is a valid short-hand string
# (e.g., 'Point', 'POLYGON').
ogr_t = OGRGeomType(geom_input)
g = capi.create_geom(OGRGeomType(geom_input).num)
elif isinstance(geom_input, buffer):
# WKB was passed in
g = capi.from_wkb(str(geom_input), None, byref(c_void_p()), len(geom_input))
elif isinstance(geom_input, OGRGeomType):
# OGRGeomType was passed in, an empty geometry will be created.
g = capi.create_geom(geom_input.num)
elif isinstance(geom_input, self.ptr_type):
# OGR pointer (c_void_p) was the input.
g = geom_input
else:
raise OGRException('Invalid input type for OGR Geometry construction: %s' % type(geom_input))
# Now checking the Geometry pointer before finishing initialization
# by setting the pointer for the object.
if not g:
raise OGRException('Cannot create OGR Geometry from input: %s' % str(geom_input))
self.ptr = g
# Assigning the SpatialReference object to the geometry, if valid.
if bool(srs): self.srs = srs
# Setting the class depending upon the OGR Geometry Type
self.__class__ = GEO_CLASSES[self.geom_type.num]
def __del__(self):
"Deletes this Geometry."
if self._ptr: capi.destroy_geom(self._ptr)
# Pickle routines
def __getstate__(self):
srs = self.srs
if srs:
srs = srs.wkt
else:
srs = None
return str(self.wkb), srs
def __setstate__(self, state):
wkb, srs = state
ptr = capi.from_wkb(wkb, None, byref(c_void_p()), len(wkb))
if not ptr: raise OGRException('Invalid OGRGeometry loaded from pickled state.')
self.ptr = ptr
self.srs = srs
@classmethod
def from_bbox(cls, bbox):
"Constructs a Polygon from a bounding box (4-tuple)."
x0, y0, x1, y1 = bbox
return OGRGeometry( 'POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))' % (
x0, y0, x0, y1, x1, y1, x1, y0, x0, y0) )
### Geometry set-like operations ###
# g = g1 | g2
def __or__(self, other):
"Returns the union of the two geometries."
return self.union(other)
# g = g1 & g2
def __and__(self, other):
"Returns the intersection of this Geometry and the other."
return self.intersection(other)
# g = g1 - g2
def __sub__(self, other):
"Return the difference this Geometry and the other."
return self.difference(other)
# g = g1 ^ g2
def __xor__(self, other):
"Return the symmetric difference of this Geometry and the other."
return self.sym_difference(other)
def __eq__(self, other):
"Is this Geometry equal to the other?"
if isinstance(other, OGRGeometry):
return self.equals(other)
else:
return False
def __ne__(self, other):
"Tests for inequality."
return not (self == other)
def __str__(self):
"WKT is used for the string representation."
return self.wkt
#### Geometry Properties ####
@property
def dimension(self):
"Returns 0 for points, 1 for lines, and 2 for surfaces."
return capi.get_dims(self.ptr)
def _get_coord_dim(self):
"Returns the coordinate dimension of the Geometry."
if isinstance(self, GeometryCollection) and GDAL_VERSION < (1, 5, 2):
# On GDAL versions prior to 1.5.2, there exists a bug in which
# the coordinate dimension of geometry collections is always 2:
# http://trac.osgeo.org/gdal/ticket/2334
# Here we workaround by returning the coordinate dimension of the
# first geometry in the collection instead.
if len(self):
return capi.get_coord_dim(capi.get_geom_ref(self.ptr, 0))
return capi.get_coord_dim(self.ptr)
def _set_coord_dim(self, dim):
"Sets the coordinate dimension of this Geometry."
if not dim in (2, 3):
raise ValueError('Geometry dimension must be either 2 or 3')
capi.set_coord_dim(self.ptr, dim)
coord_dim = property(_get_coord_dim, _set_coord_dim)
@property
def geom_count(self):
"The number of elements in this Geometry."
return capi.get_geom_count(self.ptr)
@property
def point_count(self):
"Returns the number of Points in this Geometry."
return capi.get_point_count(self.ptr)
@property
def num_points(self):
"Alias for `point_count` (same name method in GEOS API.)"
return self.point_count
@property
def num_coords(self):
"Alais for `point_count`."
return self.point_count
@property
def geom_type(self):
"Returns the Type for this Geometry."
return OGRGeomType(capi.get_geom_type(self.ptr))
@property
def geom_name(self):
"Returns the Name of this Geometry."
return capi.get_geom_name(self.ptr)
@property
def area(self):
"Returns the area for a LinearRing, Polygon, or MultiPolygon; 0 otherwise."
return capi.get_area(self.ptr)
@property
def envelope(self):
"Returns the envelope for this Geometry."
# TODO: Fix Envelope() for Point geometries.
return Envelope(capi.get_envelope(self.ptr, byref(OGREnvelope())))
@property
def extent(self):
"Returns the envelope as a 4-tuple, instead of as an Envelope object."
return self.envelope.tuple
#### SpatialReference-related Properties ####
# The SRS property
def _get_srs(self):
"Returns the Spatial Reference for this Geometry."
try:
srs_ptr = capi.get_geom_srs(self.ptr)
return SpatialReference(srs_api.clone_srs(srs_ptr))
except SRSException:
return None
def _set_srs(self, srs):
"Sets the SpatialReference for this geometry."
# Do not have to clone the `SpatialReference` object pointer because
# when it is assigned to this `OGRGeometry` it's internal OGR
# reference count is incremented, and will likewise be released
# (decremented) when this geometry's destructor is called.
if isinstance(srs, SpatialReference):
srs_ptr = srs.ptr
elif isinstance(srs, (int, long, basestring)):
sr = SpatialReference(srs)
srs_ptr = sr.ptr
else:
raise TypeError('Cannot assign spatial reference with object of type: %s' % type(srs))
capi.assign_srs(self.ptr, srs_ptr)
srs = property(_get_srs, _set_srs)
# The SRID property
def _get_srid(self):
srs = self.srs
if srs: return srs.srid
return None
def _set_srid(self, srid):
if isinstance(srid, (int, long)):
self.srs = srid
else:
raise TypeError('SRID must be set with an integer.')
srid = property(_get_srid, _set_srid)
#### Output Methods ####
@property
def geos(self):
"Returns a GEOSGeometry object from this OGRGeometry."
from django.contrib.gis.geos import GEOSGeometry
return GEOSGeometry(self.wkb, self.srid)
@property
def gml(self):
"Returns the GML representation of the Geometry."
return capi.to_gml(self.ptr)
@property
def hex(self):
"Returns the hexadecimal representation of the WKB (a string)."
return str(self.wkb).encode('hex').upper()
#return b2a_hex(self.wkb).upper()
@property
def json(self):
"""
Returns the GeoJSON representation of this Geometry (requires
GDAL 1.5+).
"""
if GEOJSON:
return capi.to_json(self.ptr)
else:
raise NotImplementedError('GeoJSON output only supported on GDAL 1.5+.')
geojson = json
@property
def kml(self):
"Returns the KML representation of the Geometry."
if GEOJSON:
return capi.to_kml(self.ptr, None)
else:
raise NotImplementedError('KML output only supported on GDAL 1.5+.')
@property
def wkb_size(self):
"Returns the size of the WKB buffer."
return capi.get_wkbsize(self.ptr)
@property
def wkb(self):
"Returns the WKB representation of the Geometry."
if sys.byteorder == 'little':
byteorder = 1 # wkbNDR (from ogr_core.h)
else:
byteorder = 0 # wkbXDR
sz = self.wkb_size
# Creating the unsigned character buffer, and passing it in by reference.
buf = (c_ubyte * sz)()
wkb = capi.to_wkb(self.ptr, byteorder, byref(buf))
# Returning a buffer of the string at the pointer.
return buffer(string_at(buf, sz))
@property
def wkt(self):
"Returns the WKT representation of the Geometry."
return capi.to_wkt(self.ptr, byref(c_char_p()))
@property
def ewkt(self):
"Returns the EWKT representation of the Geometry."
srs = self.srs
if srs and srs.srid:
return 'SRID=%s;%s' % (srs.srid, self.wkt)
else:
return self.wkt
#### Geometry Methods ####
def clone(self):
"Clones this OGR Geometry."
return OGRGeometry(capi.clone_geom(self.ptr), self.srs)
def close_rings(self):
"""
If there are any rings within this geometry that have not been
closed, this routine will do so by adding the starting point at the
end.
"""
# Closing the open rings.
capi.geom_close_rings(self.ptr)
def transform(self, coord_trans, clone=False):
"""
Transforms this geometry to a different spatial reference system.
May take a CoordTransform object, a SpatialReference object, string
WKT or PROJ.4, and/or an integer SRID. By default nothing is returned
and the geometry is transformed in-place. However, if the `clone`
keyword is set, then a transformed clone of this geometry will be
returned.
"""
if clone:
klone = self.clone()
klone.transform(coord_trans)
return klone
# Have to get the coordinate dimension of the original geometry
# so it can be used to reset the transformed geometry's dimension
# afterwards. This is done because of GDAL bug (in versions prior
# to 1.7) that turns geometries 3D after transformation, see:
# http://trac.osgeo.org/gdal/changeset/17792
if GDAL_VERSION < (1, 7):
orig_dim = self.coord_dim
# Depending on the input type, use the appropriate OGR routine
# to perform the transformation.
if isinstance(coord_trans, CoordTransform):
capi.geom_transform(self.ptr, coord_trans.ptr)
elif isinstance(coord_trans, SpatialReference):
capi.geom_transform_to(self.ptr, coord_trans.ptr)
elif isinstance(coord_trans, (int, long, basestring)):
sr = SpatialReference(coord_trans)
capi.geom_transform_to(self.ptr, sr.ptr)
else:
raise TypeError('Transform only accepts CoordTransform, '
'SpatialReference, string, and integer objects.')
# Setting with original dimension, see comment above.
if GDAL_VERSION < (1, 7):
if isinstance(self, GeometryCollection):
# With geometry collections have to set dimension on
# each internal geometry reference, as the collection
# dimension isn't affected.
for i in xrange(len(self)):
internal_ptr = capi.get_geom_ref(self.ptr, i)
if orig_dim != capi.get_coord_dim(internal_ptr):
capi.set_coord_dim(internal_ptr, orig_dim)
else:
if self.coord_dim != orig_dim:
self.coord_dim = orig_dim
def transform_to(self, srs):
"For backwards-compatibility."
self.transform(srs)
#### Topology Methods ####
def _topology(self, func, other):
"""A generalized function for topology operations, takes a GDAL function and
the other geometry to perform the operation on."""
if not isinstance(other, OGRGeometry):
raise TypeError('Must use another OGRGeometry object for topology operations!')
# Returning the output of the given function with the other geometry's
# pointer.
return func(self.ptr, other.ptr)
def intersects(self, other):
"Returns True if this geometry intersects with the other."
return self._topology(capi.ogr_intersects, other)
def equals(self, other):
"Returns True if this geometry is equivalent to the other."
return self._topology(capi.ogr_equals, other)
def disjoint(self, other):
"Returns True if this geometry and the other are spatially disjoint."
return self._topology(capi.ogr_disjoint, other)
def touches(self, other):
"Returns True if this geometry touches the other."
return self._topology(capi.ogr_touches, other)
def crosses(self, other):
"Returns True if this geometry crosses the other."
return self._topology(capi.ogr_crosses, other)
def within(self, other):
"Returns True if this geometry is within the other."
return self._topology(capi.ogr_within, other)
def contains(self, other):
"Returns True if this geometry contains the other."
return self._topology(capi.ogr_contains, other)
def overlaps(self, other):
"Returns True if this geometry overlaps the other."
return self._topology(capi.ogr_overlaps, other)
#### Geometry-generation Methods ####
def _geomgen(self, gen_func, other=None):
"A helper routine for the OGR routines that generate geometries."
if isinstance(other, OGRGeometry):
return OGRGeometry(gen_func(self.ptr, other.ptr), self.srs)
else:
return OGRGeometry(gen_func(self.ptr), self.srs)
@property
def boundary(self):
"Returns the boundary of this geometry."
return self._geomgen(capi.get_boundary)
@property
def convex_hull(self):
"""
Returns the smallest convex Polygon that contains all the points in
this Geometry.
"""
return self._geomgen(capi.geom_convex_hull)
def difference(self, other):
"""
Returns a new geometry consisting of the region which is the difference
of this geometry and the other.
"""
return self._geomgen(capi.geom_diff, other)
def intersection(self, other):
"""
Returns a new geometry consisting of the region of intersection of this
geometry and the other.
"""
return self._geomgen(capi.geom_intersection, other)
def sym_difference(self, other):
"""
Returns a new geometry which is the symmetric difference of this
geometry and the other.
"""
return self._geomgen(capi.geom_sym_diff, other)
def union(self, other):
"""
Returns a new geometry consisting of the region which is the union of
this geometry and the other.
"""
return self._geomgen(capi.geom_union, other)
# The subclasses for OGR Geometry.
class Point(OGRGeometry):
@property
def x(self):
"Returns the X coordinate for this Point."
return capi.getx(self.ptr, 0)
@property
def y(self):
"Returns the Y coordinate for this Point."
return capi.gety(self.ptr, 0)
@property
def z(self):
"Returns the Z coordinate for this Point."
if self.coord_dim == 3:
return capi.getz(self.ptr, 0)
@property
def tuple(self):
"Returns the tuple of this point."
if self.coord_dim == 2:
return (self.x, self.y)
elif self.coord_dim == 3:
return (self.x, self.y, self.z)
coords = tuple
class LineString(OGRGeometry):
def __getitem__(self, index):
"Returns the Point at the given index."
if index >= 0 and index < self.point_count:
x, y, z = c_double(), c_double(), c_double()
capi.get_point(self.ptr, index, byref(x), byref(y), byref(z))
dim = self.coord_dim
if dim == 1:
return (x.value,)
elif dim == 2:
return (x.value, y.value)
elif dim == 3:
return (x.value, y.value, z.value)
else:
raise OGRIndexError('index out of range: %s' % str(index))
def __iter__(self):
"Iterates over each point in the LineString."
for i in xrange(self.point_count):
yield self[i]
def __len__(self):
"The length returns the number of points in the LineString."
return self.point_count
@property
def tuple(self):
"Returns the tuple representation of this LineString."
return tuple([self[i] for i in xrange(len(self))])
coords = tuple
def _listarr(self, func):
"""
Internal routine that returns a sequence (list) corresponding with
the given function.
"""
return [func(self.ptr, i) for i in xrange(len(self))]
@property
def x(self):
"Returns the X coordinates in a list."
return self._listarr(capi.getx)
@property
def y(self):
"Returns the Y coordinates in a list."
return self._listarr(capi.gety)
@property
def z(self):
"Returns the Z coordinates in a list."
if self.coord_dim == 3:
return self._listarr(capi.getz)
# LinearRings are used in Polygons.
class LinearRing(LineString): pass
class Polygon(OGRGeometry):
def __len__(self):
"The number of interior rings in this Polygon."
return self.geom_count
def __iter__(self):
"Iterates through each ring in the Polygon."
for i in xrange(self.geom_count):
yield self[i]
def __getitem__(self, index):
"Gets the ring at the specified index."
if index < 0 or index >= self.geom_count:
raise OGRIndexError('index out of range: %s' % index)
else:
return OGRGeometry(capi.clone_geom(capi.get_geom_ref(self.ptr, index)), self.srs)
# Polygon Properties
@property
def shell(self):
"Returns the shell of this Polygon."
return self[0] # First ring is the shell
exterior_ring = shell
@property
def tuple(self):
"Returns a tuple of LinearRing coordinate tuples."
return tuple([self[i].tuple for i in xrange(self.geom_count)])
coords = tuple
@property
def point_count(self):
"The number of Points in this Polygon."
# Summing up the number of points in each ring of the Polygon.
return sum([self[i].point_count for i in xrange(self.geom_count)])
@property
def centroid(self):
"Returns the centroid (a Point) of this Polygon."
# The centroid is a Point, create a geometry for this.
p = OGRGeometry(OGRGeomType('Point'))
capi.get_centroid(self.ptr, p.ptr)
return p
# Geometry Collection base class.
class GeometryCollection(OGRGeometry):
"The Geometry Collection class."
def __getitem__(self, index):
"Gets the Geometry at the specified index."
if index < 0 or index >= self.geom_count:
raise OGRIndexError('index out of range: %s' % index)
else:
return OGRGeometry(capi.clone_geom(capi.get_geom_ref(self.ptr, index)), self.srs)
def __iter__(self):
"Iterates over each Geometry."
for i in xrange(self.geom_count):
yield self[i]
def __len__(self):
"The number of geometries in this Geometry Collection."
return self.geom_count
def add(self, geom):
"Add the geometry to this Geometry Collection."
if isinstance(geom, OGRGeometry):
if isinstance(geom, self.__class__):
for g in geom: capi.add_geom(self.ptr, g.ptr)
else:
capi.add_geom(self.ptr, geom.ptr)
elif isinstance(geom, basestring):
tmp = OGRGeometry(geom)
capi.add_geom(self.ptr, tmp.ptr)
else:
raise OGRException('Must add an OGRGeometry.')
@property
def point_count(self):
"The number of Points in this Geometry Collection."
# Summing up the number of points in each geometry in this collection
return sum([self[i].point_count for i in xrange(self.geom_count)])
@property
def tuple(self):
"Returns a tuple representation of this Geometry Collection."
return tuple([self[i].tuple for i in xrange(self.geom_count)])
coords = tuple
# Multiple Geometry types.
class MultiPoint(GeometryCollection): pass
class MultiLineString(GeometryCollection): pass
class MultiPolygon(GeometryCollection): pass
# Class mapping dictionary (using the OGRwkbGeometryType as the key)
GEO_CLASSES = {1 : Point,
2 : LineString,
3 : Polygon,
4 : MultiPoint,
5 : MultiLineString,
6 : MultiPolygon,
7 : GeometryCollection,
101: LinearRing,
1 + OGRGeomType.wkb25bit : Point,
2 + OGRGeomType.wkb25bit : LineString,
3 + OGRGeomType.wkb25bit : Polygon,
4 + OGRGeomType.wkb25bit : MultiPoint,
5 + OGRGeomType.wkb25bit : MultiLineString,
6 + OGRGeomType.wkb25bit : MultiPolygon,
7 + OGRGeomType.wkb25bit : GeometryCollection,
}
| ajibawa-2023/Python-Code-Large/train/row_98709 | 397 | 737 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 40], "level": 0, "parent": null, "vector": [8, 0, 0.0278, 0.0543, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n The OGRGeometry is a wrapper for using the OGR Geometry class\n (see http://www.gdal.org/ogr/classOGRGeometry.html). OGRGeometry\n may be instantiated when reading geometries from OGR Data Sources\n (e.g. SHP files), or when given OGC WKT (a string).\n\n While the 'full' API is not present yet, the API is \"pythonic\" unlike\n the traditional and \"next-generation\" OGR Python bindings. One major"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Import_L42_C0", "label": "sys import sys", "type": "import", "loc": [42, 42], "level": 0, "parent": null, "vector": [1, 0, 0.057, 0.0014, 0, 0.66, 0.0476, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:ImportFrom_L43_C0", "label": "from binascii import a2b_hex", "type": "import", "loc": [43, 43], "level": 0, "parent": null, "vector": [1, 0, 0.0583, 0.0014, 0, 0.66, 0.0952, 984, 0, 1, 0, 0, 984, 0, 0], "semantic": {"name": "binascii", "arg_names": [], "import_names": ["a2b_hex"], "rhs_call_name": "", "annotation": ""}, "snippet": "from binascii import a2b_hex"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:ImportFrom_L44_C0", "label": "from ctypes import byref, string_at, c_char_p\u2026", "type": "import", "loc": [44, 44], "level": 0, "parent": null, "vector": [1, 0, 0.0597, 0.0014, 0, 0.66, 0.1429, 182, 0, 6, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["byref", "string_at", "c_char_p", "c_double", "c_ubyte", "c_void_p"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import byref, string_at, c_char_p, c_double, c_ubyte, c_void_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:ImportFrom_L47_C0", "label": "from django.contrib.gis.gdal.base import GDALBase", "type": "import", "loc": [47, 47], "level": 0, "parent": null, "vector": [1, 0, 0.0638, 0.0014, 0, 0.66, 0.1905, 771, 0, 1, 0, 0, 771, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.base", "arg_names": [], "import_names": ["GDALBase"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.base import GDALBase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:ImportFrom_L48_C0", "label": "from django.contrib.gis.gdal.envelope import Envelope, OGREnvelope", "type": "import", "loc": [48, 48], "level": 0, "parent": null, "vector": [1, 0, 0.0651, 0.0014, 0, 0.66, 0.2381, 796, 0, 2, 0, 0, 796, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.envelope", "arg_names": [], "import_names": ["Envelope", "OGREnvelope"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.envelope import Envelope, OGREnvelope"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:ImportFrom_L49_C0", "label": "from django.contrib.gis.gdal.error import OGRException, OGRIndexError, SRSException", "type": "import", "loc": [49, 49], "level": 0, "parent": null, "vector": [1, 0, 0.0665, 0.0014, 0, 0.66, 0.2857, 76, 0, 3, 0, 0, 76, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.error", "arg_names": [], "import_names": ["OGRException", "OGRIndexError", "SRSException"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.error import OGRException, OGRIndexError, SRSException"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:ImportFrom_L50_C0", "label": "from django.contrib.gis.gdal.geomtype import OGRGeomType", "type": "import", "loc": [50, 50], "level": 0, "parent": null, "vector": [1, 0, 0.0678, 0.0014, 0, 0.66, 0.3333, 621, 0, 1, 0, 0, 621, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.geomtype", "arg_names": [], "import_names": ["OGRGeomType"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.geomtype import OGRGeomType"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:ImportFrom_L51_C0", "label": "from django.contrib.gis.gdal.libgdal import GEOJSON, GDAL_VERSION", "type": "import", "loc": [51, 51], "level": 0, "parent": null, "vector": [1, 0, 0.0692, 0.0014, 0, 0.66, 0.381, 460, 0, 2, 0, 0, 460, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.libgdal", "arg_names": [], "import_names": ["GEOJSON", "GDAL_VERSION"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.libgdal import GEOJSON, GDAL_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:ImportFrom_L52_C0", "label": "from django.contrib.gis.gdal.srs import SpatialReference, CoordTransform", "type": "import", "loc": [52, 52], "level": 0, "parent": null, "vector": [1, 0, 0.0706, 0.0014, 0, 0.66, 0.4286, 912, 0, 2, 0, 0, 912, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.srs", "arg_names": [], "import_names": ["SpatialReference", "CoordTransform"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.srs import SpatialReference, CoordTransform"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:ImportFrom_L55_C0", "label": "from django.contrib.gis.gdal.prototypes import capi, srs_api", "type": "import", "loc": [55, 55], "level": 0, "parent": null, "vector": [1, 0, 0.0746, 0.0014, 0, 0.66, 0.4762, 730, 0, 2, 0, 0, 730, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.prototypes", "arg_names": [], "import_names": ["capi", "srs_api"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.prototypes import geom as capi, srs as srs_api"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:ImportFrom_L58_C0", "label": "from django.contrib.gis.geometry.regex import hex_regex, wkt_regex, json_regex", "type": "import", "loc": [58, 58], "level": 0, "parent": null, "vector": [1, 0, 0.0787, 0.0014, 0, 0.66, 0.5238, 508, 0, 3, 0, 0, 508, 0, 0], "semantic": {"name": "django.contrib.gis.geometry.regex", "arg_names": [], "import_names": ["hex_regex", "wkt_regex", "json_regex"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geometry.regex import hex_regex, wkt_regex, json_regex"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "label": "OGRGeometry", "type": "class", "loc": [66, 538], "level": 0, "parent": null, "vector": [3, 0, 0.4098, 0.6418, 0, 0.66, 0.5714, 488, 0, 57, 0, 0, 436, 0, 99], "semantic": {"name": "OGRGeometry", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OGRGeometry(GDALBase):\n \"Generally encapsulates an OGR geometry.\"\n\n def __init__(self, geom_input, srs=None):\n \"Initializes Geometry on either WKT or an OGR pointer as input.\"\n\n str_instance = isinstance(geom_input, basestring)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L67_C4", "label": "expression", "type": "expression", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [8, 1, 0.0909, 0.0014, 1, 0.61, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Generally encapsulates an OGR geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L69_C4", "label": "__init__", "type": "function", "loc": [69, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.1357, 0.0855, 1, 0.61, 0.0164, 555, 0, 3, 0, 0, 0, 0, 46], "semantic": {"name": "__init__", "arg_names": ["self", "geom_input", "srs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, geom_input, srs=None):\n \"Initializes Geometry on either WKT or an OGR pointer as input.\"\n\n str_instance = isinstance(geom_input, basestring)\n\n # If HEX, unpack input to to a binary buffer.\n if str_instance and hex_regex.match(geom_input):\n geom_input = buffer(a2b_hex(geom_input.upper()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L70_C8", "label": "expression", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L69_C4", "vector": [8, 2, 0.095, 0.0014, 2, 0.27, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Initializes Geometry on either WKT or an OGR pointer as input.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L72_C8", "label": "str_instance = isinstance()", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L69_C4", "vector": [14, 2, 0.0977, 0.0014, 2, 0.27, 0.1429, 953, 3, 2, 0, 0, 552, 10, 1], "semantic": {"name": "str_instance", "arg_names": [], "import_names": [], "rhs_call_name": "isinstance", "annotation": ""}, "snippet": " str_instance = isinstance(geom_input, basestring)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L75_C8", "label": "if", "type": "if", "loc": [75, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L69_C4", "vector": [4, 2, 0.1031, 0.0041, 2, 0.27, 0.2857, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if str_instance and hex_regex.match(geom_input):\n geom_input = buffer(a2b_hex(geom_input.upper()))\n str_instance = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L76_C12", "label": "geom_input = buffer()", "type": "assigned_variable", "loc": [76, 76], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L75_C8", "vector": [14, 3, 0.1031, 0.0014, 3, 0.07, 0.0, 828, 3, 1, 0, 0, 640, 10, 3], "semantic": {"name": "geom_input", "arg_names": [], "import_names": [], "rhs_call_name": "buffer", "annotation": ""}, "snippet": " geom_input = buffer(a2b_hex(geom_input.upper()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L77_C12", "label": "str_instance =", "type": "assigned_variable", "loc": [77, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L75_C8", "vector": [14, 3, 0.1045, 0.0014, 3, 0.07, 1.0, 953, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "str_instance", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " str_instance = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L80_C8", "label": "if", "type": "if", "loc": [80, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L69_C4", "vector": [4, 2, 0.135, 0.0543, 2, 0.27, 0.4286, 0, 2, 0, 0, 0, 0, 0, 38], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if str_instance:\n # Checking if unicode\n if isinstance(geom_input, unicode):\n # Encoding to ASCII, WKT or HEX doesn't need any more.\n geom_input = geom_input.encode('ascii')\n\n wkt_m = wkt_regex.match(geom_input)\n json_m = json_regex.match(geom_input)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L82_C12", "label": "if", "type": "if", "loc": [82, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L80_C8", "vector": [4, 3, 0.1126, 0.0041, 3, 0.86, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(geom_input, unicode):\n # Encoding to ASCII, WKT or HEX doesn't need any more.\n geom_input = geom_input.encode('ascii')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L84_C16", "label": "geom_input = encode()", "type": "assigned_variable", "loc": [84, 84], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L82_C12", "vector": [14, 4, 0.114, 0.0014, 4, 0.74, 0.0, 828, 3, 1, 0, 0, 623, 10, 1], "semantic": {"name": "geom_input", "arg_names": [], "import_names": [], "rhs_call_name": "encode", "annotation": ""}, "snippet": " geom_input = geom_input.encode('ascii')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L86_C12", "label": "wkt_m = match()", "type": "assigned_variable", "loc": [86, 86], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L80_C8", "vector": [14, 3, 0.1167, 0.0014, 3, 0.86, 0.25, 422, 3, 1, 0, 0, 36, 10, 1], "semantic": {"name": "wkt_m", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " wkt_m = wkt_regex.match(geom_input)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L87_C12", "label": "json_m = match()", "type": "assigned_variable", "loc": [87, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L80_C8", "vector": [14, 3, 0.118, 0.0014, 3, 0.86, 0.5, 46, 3, 1, 0, 0, 36, 10, 1], "semantic": {"name": "json_m", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " json_m = json_regex.match(geom_input)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L88_C12", "label": "if", "type": "if", "loc": [88, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L80_C8", "vector": [4, 3, 0.133, 0.0285, 3, 0.86, 0.75, 0, 2, 0, 0, 0, 0, 0, 23], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if wkt_m:\n if wkt_m.group('srid'):\n # If there's EWKT, set the SRS w/value of the SRID.\n srs = int(wkt_m.group('srid'))\n if wkt_m.group('type').upper() == 'LINEARRING':\n # OGR_G_CreateFromWkt doesn't work with LINEARRING WKT.\n # See http://trac.osgeo.org/gdal/ticket/1992.\n g = capi.create_geom(OGRGeomType(wkt_m.group('type')).num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L89_C16", "label": "if", "type": "if", "loc": [89, 91], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L88_C12", "vector": [4, 4, 0.1221, 0.0041, 4, 0.38, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if wkt_m.group('srid'):\n # If there's EWKT, set the SRS w/value of the SRID.\n srs = int(wkt_m.group('srid'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L91_C20", "label": "srs = int()", "type": "assigned_variable", "loc": [91, 91], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L89_C16", "vector": [14, 5, 0.1235, 0.0014, 5, 0.69, 0.0, 95, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "srs", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " srs = int(wkt_m.group('srid'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L92_C16", "label": "if", "type": "if", "loc": [92, 98], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L88_C12", "vector": [4, 4, 0.1289, 0.0095, 4, 0.38, 0.5, 0, 0, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if wkt_m.group('type').upper() == 'LINEARRING':\n # OGR_G_CreateFromWkt doesn't work with LINEARRING WKT.\n # See http://trac.osgeo.org/gdal/ticket/1992.\n g = capi.create_geom(OGRGeomType(wkt_m.group('type')).num)\n capi.import_wkt(g, byref(c_char_p(wkt_m.group('wkt'))))\n else:\n g = capi.from_wkt(byref(c_char_p(wkt_m.group('wkt'))), None, byref(c_void_p()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L95_C20", "label": "g = create_geom()", "type": "assigned_variable", "loc": [95, 95], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L92_C16", "vector": [14, 5, 0.1289, 0.0014, 5, 0.1, 0.0, 384, 3, 1, 0, 0, 725, 10, 3], "semantic": {"name": "g", "arg_names": [], "import_names": [], "rhs_call_name": "create_geom", "annotation": ""}, "snippet": " g = capi.create_geom(OGRGeomType(wkt_m.group('type')).num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L96_C20", "label": "import_wkt()", "type": "expression", "loc": [96, 96], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L92_C16", "vector": [8, 5, 0.1303, 0.0014, 5, 0.1, 0.5, 796, 3, 2, 0, 0, 0, 0, 4], "semantic": {"name": "import_wkt", "arg_names": [], "import_names": [], "rhs_call_name": "import_wkt", "annotation": ""}, "snippet": " capi.import_wkt(g, byref(c_char_p(wkt_m.group('wkt'))))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L98_C20", "label": "g = from_wkt()", "type": "assigned_variable", "loc": [98, 98], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L92_C16", "vector": [14, 5, 0.133, 0.0014, 5, 0.1, 1.0, 384, 3, 3, 0, 0, 252, 10, 6], "semantic": {"name": "g", "arg_names": [], "import_names": [], "rhs_call_name": "from_wkt", "annotation": ""}, "snippet": " g = capi.from_wkt(byref(c_char_p(wkt_m.group('wkt'))), None, byref(c_void_p()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L99_C12", "label": "if", "type": "if", "loc": [99, 108], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L88_C12", "vector": [4, 4, 0.1404, 0.0136, 4, 0.38, 1.0, 0, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif json_m:\n if GEOJSON:\n g = capi.from_json(geom_input)\n else:\n raise NotImplementedError('GeoJSON input only supported on GDAL 1.5+.')\n else:\n # Seeing if the input is a valid short-hand string\n # (e.g., 'Point', 'POLYGON')."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L100_C16", "label": "if", "type": "if", "loc": [100, 103], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L99_C12", "vector": [4, 5, 0.1377, 0.0054, 5, 0.31, 0.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if GEOJSON:\n g = capi.from_json(geom_input)\n else:\n raise NotImplementedError('GeoJSON input only supported on GDAL 1.5+.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L101_C20", "label": "g = from_json()", "type": "assigned_variable", "loc": [101, 101], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L100_C16", "vector": [14, 6, 0.137, 0.0014, 6, 0.58, 0.0, 384, 3, 1, 0, 0, 975, 10, 1], "semantic": {"name": "g", "arg_names": [], "import_names": [], "rhs_call_name": "from_json", "annotation": ""}, "snippet": " g = capi.from_json(geom_input)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L107_C16", "label": "ogr_t = OGRGeomType()", "type": "assigned_variable", "loc": [107, 107], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L99_C12", "vector": [14, 5, 0.1452, 0.0014, 5, 0.31, 0.5, 514, 3, 1, 0, 0, 85, 10, 1], "semantic": {"name": "ogr_t", "arg_names": [], "import_names": [], "rhs_call_name": "OGRGeomType", "annotation": ""}, "snippet": " ogr_t = OGRGeomType(geom_input)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L108_C16", "label": "g = create_geom()", "type": "assigned_variable", "loc": [108, 108], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L99_C12", "vector": [14, 5, 0.1465, 0.0014, 5, 0.31, 1.0, 384, 3, 1, 0, 0, 725, 10, 2], "semantic": {"name": "g", "arg_names": [], "import_names": [], "rhs_call_name": "create_geom", "annotation": ""}, "snippet": " g = capi.create_geom(OGRGeomType(geom_input).num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L109_C8", "label": "if", "type": "if", "loc": [109, 119], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L80_C8", "vector": [4, 3, 0.1547, 0.0149, 3, 0.86, 1.0, 0, 3, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(geom_input, buffer):\n # WKB was passed in\n g = capi.from_wkb(str(geom_input), None, byref(c_void_p()), len(geom_input))\n elif isinstance(geom_input, OGRGeomType):\n # OGRGeomType was passed in, an empty geometry will be created.\n g = capi.create_geom(geom_input.num)\n elif isinstance(geom_input, self.ptr_type):\n # OGR pointer (c_void_p) was the input."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L111_C12", "label": "g = from_wkb()", "type": "assigned_variable", "loc": [111, 111], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L109_C8", "vector": [14, 4, 0.1506, 0.0014, 4, 0.17, 0.0, 384, 3, 4, 0, 0, 581, 10, 5], "semantic": {"name": "g", "arg_names": [], "import_names": [], "rhs_call_name": "from_wkb", "annotation": ""}, "snippet": " g = capi.from_wkb(str(geom_input), None, byref(c_void_p()), len(geom_input))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L112_C8", "label": "if", "type": "if", "loc": [112, 119], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L109_C8", "vector": [4, 4, 0.1567, 0.0109, 4, 0.17, 1.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(geom_input, OGRGeomType):\n # OGRGeomType was passed in, an empty geometry will be created.\n g = capi.create_geom(geom_input.num)\n elif isinstance(geom_input, self.ptr_type):\n # OGR pointer (c_void_p) was the input.\n g = geom_input\n else:\n raise OGRException('Invalid input type for OGR Geometry construction: %s' % type(geom_input))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L114_C12", "label": "g = create_geom()", "type": "assigned_variable", "loc": [114, 114], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L112_C8", "vector": [14, 5, 0.1547, 0.0014, 5, 0.74, 0.0, 384, 3, 1, 0, 0, 725, 10, 1], "semantic": {"name": "g", "arg_names": [], "import_names": [], "rhs_call_name": "create_geom", "annotation": ""}, "snippet": " g = capi.create_geom(geom_input.num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L115_C8", "label": "if", "type": "if", "loc": [115, 119], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L112_C8", "vector": [4, 5, 0.1588, 0.0068, 5, 0.74, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(geom_input, self.ptr_type):\n # OGR pointer (c_void_p) was the input.\n g = geom_input\n else:\n raise OGRException('Invalid input type for OGR Geometry construction: %s' % type(geom_input))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L117_C12", "label": "g =", "type": "assigned_variable", "loc": [117, 117], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L115_C8", "vector": [14, 6, 0.1588, 0.0014, 6, 0.66, 0.0, 384, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "g", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " g = geom_input"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L123_C8", "label": "if", "type": "if", "loc": [123, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L69_C4", "vector": [4, 2, 0.1676, 0.0027, 2, 0.27, 0.5714, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not g:\n raise OGRException('Cannot create OGR Geometry from input: %s' % str(geom_input))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L125_C8", "label": "self.ptr =", "type": "assigned_variable", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L69_C4", "vector": [14, 2, 0.1696, 0.0014, 2, 0.27, 0.7143, 386, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.ptr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ptr = g"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L128_C8", "label": "if", "type": "if", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L69_C4", "vector": [4, 2, 0.1737, 0.0014, 2, 0.27, 0.8571, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if bool(srs): self.srs = srs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L128_C22", "label": "self.srs =", "type": "assigned_variable", "loc": [128, 128], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L128_C8", "vector": [14, 3, 0.1737, 0.0014, 3, 0.74, 0.0, 233, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.srs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if bool(srs): self.srs = srs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L131_C8", "label": "self.__class__ =", "type": "assigned_variable", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L69_C4", "vector": [14, 2, 0.1777, 0.0014, 2, 0.27, 1.0, 366, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.__class__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__class__ = GEO_CLASSES[self.geom_type.num]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L133_C4", "label": "__del__", "type": "function", "loc": [133, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.1818, 0.0041, 1, 0.61, 0.0328, 258, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__del__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __del__(self):\n \"Deletes this Geometry.\"\n if self._ptr: capi.destroy_geom(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L134_C8", "label": "expression", "type": "expression", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L133_C4", "vector": [8, 2, 0.1818, 0.0014, 2, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Deletes this Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L135_C8", "label": "if", "type": "if", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L133_C4", "vector": [4, 2, 0.1832, 0.0014, 2, 0.67, 1.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._ptr: capi.destroy_geom(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L135_C22", "label": "destroy_geom()", "type": "expression", "loc": [135, 135], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L135_C8", "vector": [8, 3, 0.1832, 0.0014, 3, 0.75, 0.0, 266, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "destroy_geom", "arg_names": [], "import_names": [], "rhs_call_name": "destroy_geom", "annotation": ""}, "snippet": " if self._ptr: capi.destroy_geom(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L138_C4", "label": "__getstate__", "type": "function", "loc": [138, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.1913, 0.0095, 1, 0.61, 0.0492, 250, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__getstate__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getstate__(self):\n srs = self.srs\n if srs:\n srs = srs.wkt\n else:\n srs = None\n return str(self.wkb), srs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L139_C8", "label": "srs =", "type": "assigned_variable", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L138_C4", "vector": [14, 2, 0.1886, 0.0014, 2, 0.35, 0.0, 95, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "srs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " srs = self.srs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L140_C8", "label": "if", "type": "if", "loc": [140, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L138_C4", "vector": [4, 2, 0.192, 0.0054, 2, 0.35, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if srs:\n srs = srs.wkt\n else:\n srs = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L141_C12", "label": "srs =", "type": "assigned_variable", "loc": [141, 141], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L140_C8", "vector": [14, 3, 0.1913, 0.0014, 3, 0.14, 0.0, 95, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "srs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " srs = srs.wkt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L143_C12", "label": "srs =", "type": "assigned_variable", "loc": [143, 143], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L140_C8", "vector": [14, 3, 0.194, 0.0014, 3, 0.14, 1.0, 95, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "srs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " srs = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L144_C8", "label": "return", "type": "return", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L138_C4", "vector": [13, 2, 0.1954, 0.0014, 2, 0.35, 1.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str(self.wkb), srs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L146_C4", "label": "__setstate__", "type": "function", "loc": [146, 151], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.2015, 0.0081, 1, 0.61, 0.0656, 698, 0, 2, 0, 0, 0, 0, 5], "semantic": {"name": "__setstate__", "arg_names": ["self", "state"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __setstate__(self, state):\n wkb, srs = state\n ptr = capi.from_wkb(wkb, None, byref(c_void_p()), len(wkb))\n if not ptr: raise OGRException('Invalid OGRGeometry loaded from pickled state.')\n self.ptr = ptr\n self.srs = srs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L147_C8", "label": "wkb, srs =", "type": "assigned_variable", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L146_C4", "vector": [14, 2, 0.1995, 0.0014, 2, 0.71, 0.0, 555, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "wkb, srs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wkb, srs = state"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L148_C8", "label": "ptr = from_wkb()", "type": "assigned_variable", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L146_C4", "vector": [14, 2, 0.2008, 0.0014, 2, 0.71, 0.25, 676, 3, 4, 0, 0, 581, 10, 4], "semantic": {"name": "ptr", "arg_names": [], "import_names": [], "rhs_call_name": "from_wkb", "annotation": ""}, "snippet": " ptr = capi.from_wkb(wkb, None, byref(c_void_p()), len(wkb))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L149_C8", "label": "if", "type": "if", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L146_C4", "vector": [4, 2, 0.2022, 0.0014, 2, 0.71, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not ptr: raise OGRException('Invalid OGRGeometry loaded from pickled state.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L150_C8", "label": "self.ptr =", "type": "assigned_variable", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L146_C4", "vector": [14, 2, 0.2035, 0.0014, 2, 0.71, 0.75, 386, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.ptr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ptr = ptr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L151_C8", "label": "self.srs =", "type": "assigned_variable", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L146_C4", "vector": [14, 2, 0.2049, 0.0014, 2, 0.71, 1.0, 233, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.srs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.srs = srs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L154_C4", "label": "from_bbox", "type": "function", "loc": [154, 158], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.2117, 0.0068, 1, 0.61, 0.082, 671, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "from_bbox", "arg_names": ["cls", "bbox"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_bbox(cls, bbox):\n \"Constructs a Polygon from a bounding box (4-tuple).\"\n x0, y0, x1, y1 = bbox\n return OGRGeometry( 'POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))' % (\n x0, y0, x0, y1, x1, y1, x1, y0, x0, y0) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L155_C8", "label": "expression", "type": "expression", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L154_C4", "vector": [8, 2, 0.2103, 0.0014, 2, 0.93, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Constructs a Polygon from a bounding box (4-tuple).\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L156_C8", "label": "x0, y0, x1, y1 =", "type": "assigned_variable", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L154_C4", "vector": [14, 2, 0.2117, 0.0014, 2, 0.93, 0.5, 793, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "x0, y0, x1, y1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " x0, y0, x1, y1 = bbox"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L157_C8", "label": "return", "type": "return", "loc": [157, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L154_C4", "vector": [13, 2, 0.2137, 0.0027, 2, 0.93, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return OGRGeometry( 'POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))' % (\n x0, y0, x0, y1, x1, y1, x1, y0, x0, y0) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L162_C4", "label": "__or__", "type": "function", "loc": [162, 164], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.2212, 0.0041, 1, 0.61, 0.0984, 789, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__or__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __or__(self, other):\n \"Returns the union of the two geometries.\"\n return self.union(other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L163_C8", "label": "expression", "type": "expression", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L162_C4", "vector": [8, 2, 0.2212, 0.0014, 2, 0.65, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the union of the two geometries.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L164_C8", "label": "return", "type": "return", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L162_C4", "vector": [13, 2, 0.2225, 0.0014, 2, 0.65, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.union(other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L167_C4", "label": "__and__", "type": "function", "loc": [167, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.228, 0.0041, 1, 0.61, 0.1148, 916, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__and__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __and__(self, other):\n \"Returns the intersection of this Geometry and the other.\"\n return self.intersection(other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L168_C8", "label": "expression", "type": "expression", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L167_C4", "vector": [8, 2, 0.228, 0.0014, 2, 0.87, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the intersection of this Geometry and the other.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L169_C8", "label": "return", "type": "return", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L167_C4", "vector": [13, 2, 0.2293, 0.0014, 2, 0.87, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.intersection(other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L172_C4", "label": "__sub__", "type": "function", "loc": [172, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.2347, 0.0041, 1, 0.61, 0.1311, 555, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__sub__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __sub__(self, other):\n \"Return the difference this Geometry and the other.\"\n return self.difference(other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L173_C8", "label": "expression", "type": "expression", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L172_C4", "vector": [8, 2, 0.2347, 0.0014, 2, 0.36, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Return the difference this Geometry and the other.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L174_C8", "label": "return", "type": "return", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L172_C4", "vector": [13, 2, 0.2361, 0.0014, 2, 0.36, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.difference(other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L177_C4", "label": "__xor__", "type": "function", "loc": [177, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.2415, 0.0041, 1, 0.61, 0.1475, 746, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__xor__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __xor__(self, other):\n \"Return the symmetric difference of this Geometry and the other.\"\n return self.sym_difference(other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L178_C8", "label": "expression", "type": "expression", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L177_C4", "vector": [8, 2, 0.2415, 0.0014, 2, 0.04, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Return the symmetric difference of this Geometry and the other.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L179_C8", "label": "return", "type": "return", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L177_C4", "vector": [13, 2, 0.2429, 0.0014, 2, 0.04, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.sym_difference(other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L181_C4", "label": "__eq__", "type": "function", "loc": [181, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.249, 0.0081, 1, 0.61, 0.1639, 763, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__eq__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __eq__(self, other):\n \"Is this Geometry equal to the other?\"\n if isinstance(other, OGRGeometry):\n return self.equals(other)\n else:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L182_C8", "label": "expression", "type": "expression", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L181_C4", "vector": [8, 2, 0.2469, 0.0014, 2, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Is this Geometry equal to the other?\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L183_C8", "label": "if", "type": "if", "loc": [183, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L181_C4", "vector": [4, 2, 0.2503, 0.0054, 2, 0.83, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, OGRGeometry):\n return self.equals(other)\n else:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L184_C12", "label": "return", "type": "return", "loc": [184, 184], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L183_C8", "vector": [13, 3, 0.2497, 0.0014, 3, 0.91, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.equals(other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L186_C12", "label": "return", "type": "return", "loc": [186, 186], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L183_C8", "vector": [13, 3, 0.2524, 0.0014, 3, 0.91, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L188_C4", "label": "__ne__", "type": "function", "loc": [188, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.2564, 0.0041, 1, 0.61, 0.1803, 254, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__ne__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __ne__(self, other):\n \"Tests for inequality.\"\n return not (self == other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L189_C8", "label": "expression", "type": "expression", "loc": [189, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L188_C4", "vector": [8, 2, 0.2564, 0.0014, 2, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Tests for inequality.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L190_C8", "label": "return", "type": "return", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L188_C4", "vector": [13, 2, 0.2578, 0.0014, 2, 0.28, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return not (self == other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L192_C4", "label": "__str__", "type": "function", "loc": [192, 194], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.2619, 0.0041, 1, 0.61, 0.1967, 527, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n \"WKT is used for the string representation.\"\n return self.wkt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L193_C8", "label": "expression", "type": "expression", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L192_C4", "vector": [8, 2, 0.2619, 0.0014, 2, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"WKT is used for the string representation.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L194_C8", "label": "return", "type": "return", "loc": [194, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L192_C4", "vector": [13, 2, 0.2632, 0.0014, 2, 0.74, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.wkt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L198_C4", "label": "dimension", "type": "function", "loc": [198, 200], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.27, 0.0041, 1, 0.61, 0.2131, 631, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "dimension", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def dimension(self):\n \"Returns 0 for points, 1 for lines, and 2 for surfaces.\"\n return capi.get_dims(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L199_C8", "label": "expression", "type": "expression", "loc": [199, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L198_C4", "vector": [8, 2, 0.27, 0.0014, 2, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns 0 for points, 1 for lines, and 2 for surfaces.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L200_C8", "label": "return", "type": "return", "loc": [200, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L198_C4", "vector": [13, 2, 0.2714, 0.0014, 2, 0.46, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_dims(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L202_C4", "label": "_get_coord_dim", "type": "function", "loc": [202, 212], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.2809, 0.0149, 1, 0.61, 0.2295, 276, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "_get_coord_dim", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_coord_dim(self):\n \"Returns the coordinate dimension of the Geometry.\"\n if isinstance(self, GeometryCollection) and GDAL_VERSION < (1, 5, 2):\n # On GDAL versions prior to 1.5.2, there exists a bug in which\n # the coordinate dimension of geometry collections is always 2:\n # http://trac.osgeo.org/gdal/ticket/2334\n # Here we workaround by returning the coordinate dimension of the\n # first geometry in the collection instead."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L203_C8", "label": "expression", "type": "expression", "loc": [203, 203], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L202_C4", "vector": [8, 2, 0.2754, 0.0014, 2, 0.64, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the coordinate dimension of the Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L204_C8", "label": "if", "type": "if", "loc": [204, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L202_C4", "vector": [4, 2, 0.2815, 0.0109, 2, 0.64, 0.5, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(self, GeometryCollection) and GDAL_VERSION < (1, 5, 2):\n # On GDAL versions prior to 1.5.2, there exists a bug in which\n # the coordinate dimension of geometry collections is always 2:\n # http://trac.osgeo.org/gdal/ticket/2334\n # Here we workaround by returning the coordinate dimension of the\n # first geometry in the collection instead.\n if len(self):\n return capi.get_coord_dim(capi.get_geom_ref(self.ptr, 0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L210_C12", "label": "if", "type": "if", "loc": [210, 211], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L204_C8", "vector": [4, 3, 0.2856, 0.0027, 3, 0.75, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(self):\n return capi.get_coord_dim(capi.get_geom_ref(self.ptr, 0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L211_C16", "label": "return", "type": "return", "loc": [211, 211], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L210_C12", "vector": [13, 4, 0.2863, 0.0014, 4, 0.8, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_coord_dim(capi.get_geom_ref(self.ptr, 0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L212_C8", "label": "return", "type": "return", "loc": [212, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L202_C4", "vector": [13, 2, 0.2877, 0.0014, 2, 0.64, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_coord_dim(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L214_C4", "label": "_set_coord_dim", "type": "function", "loc": [214, 218], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.2931, 0.0068, 1, 0.61, 0.2459, 536, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_set_coord_dim", "arg_names": ["self", "dim"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_coord_dim(self, dim):\n \"Sets the coordinate dimension of this Geometry.\"\n if not dim in (2, 3):\n raise ValueError('Geometry dimension must be either 2 or 3')\n capi.set_coord_dim(self.ptr, dim)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L215_C8", "label": "expression", "type": "expression", "loc": [215, 215], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L214_C4", "vector": [8, 2, 0.2917, 0.0014, 2, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Sets the coordinate dimension of this Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L216_C8", "label": "if", "type": "if", "loc": [216, 217], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L214_C4", "vector": [4, 2, 0.2938, 0.0027, 2, 0.88, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not dim in (2, 3):\n raise ValueError('Geometry dimension must be either 2 or 3')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L218_C8", "label": "set_coord_dim()", "type": "expression", "loc": [218, 218], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L214_C4", "vector": [8, 2, 0.2958, 0.0014, 2, 0.88, 1.0, 687, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_coord_dim", "arg_names": [], "import_names": [], "rhs_call_name": "set_coord_dim", "annotation": ""}, "snippet": " capi.set_coord_dim(self.ptr, dim)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L220_C4", "label": "coord_dim = property()", "type": "assigned_variable", "loc": [220, 220], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [14, 1, 0.2985, 0.0014, 1, 0.61, 0.2623, 147, 3, 2, 0, 0, 244, 10, 1], "semantic": {"name": "coord_dim", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " coord_dim = property(_get_coord_dim, _set_coord_dim)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L223_C4", "label": "geom_count", "type": "function", "loc": [223, 225], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.3039, 0.0041, 1, 0.61, 0.2787, 613, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "geom_count", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geom_count(self):\n \"The number of elements in this Geometry.\"\n return capi.get_geom_count(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L224_C8", "label": "expression", "type": "expression", "loc": [224, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L223_C4", "vector": [8, 2, 0.3039, 0.0014, 2, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"The number of elements in this Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L225_C8", "label": "return", "type": "return", "loc": [225, 225], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L223_C4", "vector": [13, 2, 0.3053, 0.0014, 2, 0.49, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_geom_count(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L228_C4", "label": "point_count", "type": "function", "loc": [228, 230], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.3107, 0.0041, 1, 0.61, 0.2951, 963, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "point_count", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def point_count(self):\n \"Returns the number of Points in this Geometry.\"\n return capi.get_point_count(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L229_C8", "label": "expression", "type": "expression", "loc": [229, 229], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L228_C4", "vector": [8, 2, 0.3107, 0.0014, 2, 0.22, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the number of Points in this Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L230_C8", "label": "return", "type": "return", "loc": [230, 230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L228_C4", "vector": [13, 2, 0.3121, 0.0014, 2, 0.22, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_point_count(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L233_C4", "label": "num_points", "type": "function", "loc": [233, 235], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.3175, 0.0041, 1, 0.61, 0.3115, 754, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "num_points", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def num_points(self):\n \"Alias for `point_count` (same name method in GEOS API.)\"\n return self.point_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L234_C8", "label": "expression", "type": "expression", "loc": [234, 234], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L233_C4", "vector": [8, 2, 0.3175, 0.0014, 2, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Alias for `point_count` (same name method in GEOS API.)\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L235_C8", "label": "return", "type": "return", "loc": [235, 235], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L233_C4", "vector": [13, 2, 0.3189, 0.0014, 2, 0.28, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.point_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L238_C4", "label": "num_coords", "type": "function", "loc": [238, 240], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.3243, 0.0041, 1, 0.61, 0.3279, 586, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "num_coords", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def num_coords(self):\n \"Alais for `point_count`.\"\n return self.point_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L239_C8", "label": "expression", "type": "expression", "loc": [239, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L238_C4", "vector": [8, 2, 0.3243, 0.0014, 2, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Alais for `point_count`.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L240_C8", "label": "return", "type": "return", "loc": [240, 240], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L238_C4", "vector": [13, 2, 0.3256, 0.0014, 2, 0.72, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.point_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L243_C4", "label": "geom_type", "type": "function", "loc": [243, 245], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.3311, 0.0041, 1, 0.61, 0.3443, 770, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "geom_type", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geom_type(self):\n \"Returns the Type for this Geometry.\"\n return OGRGeomType(capi.get_geom_type(self.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L244_C8", "label": "expression", "type": "expression", "loc": [244, 244], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L243_C4", "vector": [8, 2, 0.3311, 0.0014, 2, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the Type for this Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L245_C8", "label": "return", "type": "return", "loc": [245, 245], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L243_C4", "vector": [13, 2, 0.3324, 0.0014, 2, 0.83, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return OGRGeomType(capi.get_geom_type(self.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L248_C4", "label": "geom_name", "type": "function", "loc": [248, 250], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.3379, 0.0041, 1, 0.61, 0.3607, 544, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "geom_name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geom_name(self):\n \"Returns the Name of this Geometry.\"\n return capi.get_geom_name(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L249_C8", "label": "expression", "type": "expression", "loc": [249, 249], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L248_C4", "vector": [8, 2, 0.3379, 0.0014, 2, 0.6, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the Name of this Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L250_C8", "label": "return", "type": "return", "loc": [250, 250], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L248_C4", "vector": [13, 2, 0.3392, 0.0014, 2, 0.6, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_geom_name(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L253_C4", "label": "area", "type": "function", "loc": [253, 255], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.3446, 0.0041, 1, 0.61, 0.377, 715, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "area", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def area(self):\n \"Returns the area for a LinearRing, Polygon, or MultiPolygon; 0 otherwise.\"\n return capi.get_area(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L254_C8", "label": "expression", "type": "expression", "loc": [254, 254], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L253_C4", "vector": [8, 2, 0.3446, 0.0014, 2, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the area for a LinearRing, Polygon, or MultiPolygon; 0 otherwise.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L255_C8", "label": "return", "type": "return", "loc": [255, 255], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L253_C4", "vector": [13, 2, 0.346, 0.0014, 2, 0.94, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_area(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L258_C4", "label": "envelope", "type": "function", "loc": [258, 261], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.3521, 0.0054, 1, 0.61, 0.3934, 48, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "envelope", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def envelope(self):\n \"Returns the envelope for this Geometry.\"\n # TODO: Fix Envelope() for Point geometries.\n return Envelope(capi.get_envelope(self.ptr, byref(OGREnvelope())))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L259_C8", "label": "expression", "type": "expression", "loc": [259, 259], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L258_C4", "vector": [8, 2, 0.3514, 0.0014, 2, 0.62, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the envelope for this Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L261_C8", "label": "return", "type": "return", "loc": [261, 261], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L258_C4", "vector": [13, 2, 0.3541, 0.0014, 2, 0.62, 1.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Envelope(capi.get_envelope(self.ptr, byref(OGREnvelope())))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L264_C4", "label": "extent", "type": "function", "loc": [264, 266], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.3596, 0.0041, 1, 0.61, 0.4098, 962, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "extent", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def extent(self):\n \"Returns the envelope as a 4-tuple, instead of as an Envelope object.\"\n return self.envelope.tuple"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L265_C8", "label": "expression", "type": "expression", "loc": [265, 265], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L264_C4", "vector": [8, 2, 0.3596, 0.0014, 2, 0.27, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the envelope as a 4-tuple, instead of as an Envelope object.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L266_C8", "label": "return", "type": "return", "loc": [266, 266], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L264_C4", "vector": [13, 2, 0.3609, 0.0014, 2, 0.27, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.envelope.tuple"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L271_C4", "label": "_get_srs", "type": "function", "loc": [271, 277], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.3718, 0.0095, 1, 0.61, 0.4262, 959, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "_get_srs", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_srs(self):\n \"Returns the Spatial Reference for this Geometry.\"\n try:\n srs_ptr = capi.get_geom_srs(self.ptr)\n return SpatialReference(srs_api.clone_srs(srs_ptr))\n except SRSException:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L272_C8", "label": "expression", "type": "expression", "loc": [272, 272], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L271_C4", "vector": [8, 2, 0.3691, 0.0014, 2, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the Spatial Reference for this Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Try_L273_C8", "label": "try", "type": "try", "loc": [273, 277], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L271_C4", "vector": [7, 2, 0.3731, 0.0068, 2, 0.25, 1.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n srs_ptr = capi.get_geom_srs(self.ptr)\n return SpatialReference(srs_api.clone_srs(srs_ptr))\n except SRSException:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L274_C12", "label": "srs_ptr = get_geom_srs()", "type": "assigned_variable", "loc": [274, 274], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:Try_L273_C8", "vector": [14, 3, 0.3718, 0.0014, 3, 0.22, 0.0, 946, 3, 1, 0, 0, 75, 10, 1], "semantic": {"name": "srs_ptr", "arg_names": [], "import_names": [], "rhs_call_name": "get_geom_srs", "annotation": ""}, "snippet": " srs_ptr = capi.get_geom_srs(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L275_C12", "label": "return", "type": "return", "loc": [275, 275], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:Try_L273_C8", "vector": [13, 3, 0.3731, 0.0014, 3, 0.22, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return SpatialReference(srs_api.clone_srs(srs_ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L277_C12", "label": "return", "type": "return", "loc": [277, 277], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:Try_L273_C8", "vector": [13, 3, 0.3758, 0.0014, 3, 0.22, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L279_C4", "label": "_set_srs", "type": "function", "loc": [279, 292], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.3874, 0.019, 1, 0.61, 0.4426, 195, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "_set_srs", "arg_names": ["self", "srs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_srs(self, srs):\n \"Sets the SpatialReference for this geometry.\"\n # Do not have to clone the `SpatialReference` object pointer because\n # when it is assigned to this `OGRGeometry` it's internal OGR\n # reference count is incremented, and will likewise be released\n # (decremented) when this geometry's destructor is called.\n if isinstance(srs, SpatialReference):\n srs_ptr = srs.ptr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L280_C8", "label": "expression", "type": "expression", "loc": [280, 280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L279_C4", "vector": [8, 2, 0.3799, 0.0014, 2, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Sets the SpatialReference for this geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L285_C8", "label": "if", "type": "if", "loc": [285, 291], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L279_C4", "vector": [4, 2, 0.3908, 0.0095, 2, 0.72, 0.5, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(srs, SpatialReference):\n srs_ptr = srs.ptr\n elif isinstance(srs, (int, long, basestring)):\n sr = SpatialReference(srs)\n srs_ptr = sr.ptr\n else:\n raise TypeError('Cannot assign spatial reference with object of type: %s' % type(srs))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L286_C12", "label": "srs_ptr =", "type": "assigned_variable", "loc": [286, 286], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L285_C8", "vector": [14, 3, 0.3881, 0.0014, 3, 0.48, 0.0, 946, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "srs_ptr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " srs_ptr = srs.ptr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L287_C8", "label": "if", "type": "if", "loc": [287, 291], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L285_C8", "vector": [4, 3, 0.3921, 0.0068, 3, 0.48, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(srs, (int, long, basestring)):\n sr = SpatialReference(srs)\n srs_ptr = sr.ptr\n else:\n raise TypeError('Cannot assign spatial reference with object of type: %s' % type(srs))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L288_C12", "label": "sr = SpatialReference()", "type": "assigned_variable", "loc": [288, 288], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L287_C8", "vector": [14, 4, 0.3908, 0.0014, 4, 0.63, 0.0, 498, 3, 1, 0, 0, 590, 10, 1], "semantic": {"name": "sr", "arg_names": [], "import_names": [], "rhs_call_name": "SpatialReference", "annotation": ""}, "snippet": " sr = SpatialReference(srs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L289_C12", "label": "srs_ptr =", "type": "assigned_variable", "loc": [289, 289], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L287_C8", "vector": [14, 4, 0.3921, 0.0014, 4, 0.63, 1.0, 946, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "srs_ptr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " srs_ptr = sr.ptr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L292_C8", "label": "assign_srs()", "type": "expression", "loc": [292, 292], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L279_C4", "vector": [8, 2, 0.3962, 0.0014, 2, 0.72, 1.0, 984, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assign_srs", "arg_names": [], "import_names": [], "rhs_call_name": "assign_srs", "annotation": ""}, "snippet": " capi.assign_srs(self.ptr, srs_ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L294_C4", "label": "srs = property()", "type": "assigned_variable", "loc": [294, 294], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [14, 1, 0.3989, 0.0014, 1, 0.61, 0.459, 95, 3, 2, 0, 0, 244, 10, 1], "semantic": {"name": "srs", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " srs = property(_get_srs, _set_srs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L297_C4", "label": "_get_srid", "type": "function", "loc": [297, 300], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.405, 0.0054, 1, 0.61, 0.4754, 774, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "_get_srid", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_srid(self):\n srs = self.srs\n if srs: return srs.srid\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L298_C8", "label": "srs =", "type": "assigned_variable", "loc": [298, 298], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L297_C4", "vector": [14, 2, 0.4043, 0.0014, 2, 0.17, 0.0, 95, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "srs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " srs = self.srs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L299_C8", "label": "if", "type": "if", "loc": [299, 299], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L297_C4", "vector": [4, 2, 0.4057, 0.0014, 2, 0.17, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if srs: return srs.srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L299_C16", "label": "return", "type": "return", "loc": [299, 299], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L299_C8", "vector": [13, 3, 0.4057, 0.0014, 3, 0.34, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if srs: return srs.srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L300_C8", "label": "return", "type": "return", "loc": [300, 300], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L297_C4", "vector": [13, 2, 0.4071, 0.0014, 2, 0.17, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L302_C4", "label": "_set_srid", "type": "function", "loc": [302, 306], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.4125, 0.0068, 1, 0.61, 0.4918, 415, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_set_srid", "arg_names": ["self", "srid"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_srid(self, srid):\n if isinstance(srid, (int, long)):\n self.srs = srid\n else:\n raise TypeError('SRID must be set with an integer.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L303_C8", "label": "if", "type": "if", "loc": [303, 306], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L302_C4", "vector": [4, 2, 0.4132, 0.0054, 2, 0.77, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(srid, (int, long)):\n self.srs = srid\n else:\n raise TypeError('SRID must be set with an integer.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L304_C12", "label": "self.srs =", "type": "assigned_variable", "loc": [304, 304], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L303_C8", "vector": [14, 3, 0.4125, 0.0014, 3, 0.01, 0.0, 233, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.srs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.srs = srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L308_C4", "label": "srid = property()", "type": "assigned_variable", "loc": [308, 308], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [14, 1, 0.4179, 0.0014, 1, 0.61, 0.5082, 357, 3, 2, 0, 0, 244, 10, 1], "semantic": {"name": "srid", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " srid = property(_get_srid, _set_srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L312_C4", "label": "geos", "type": "function", "loc": [312, 315], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.4254, 0.0054, 1, 0.61, 0.5246, 437, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "geos", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geos(self):\n \"Returns a GEOSGeometry object from this OGRGeometry.\"\n from django.contrib.gis.geos import GEOSGeometry\n return GEOSGeometry(self.wkb, self.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L313_C8", "label": "expression", "type": "expression", "loc": [313, 313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L312_C4", "vector": [8, 2, 0.4247, 0.0014, 2, 0.3, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a GEOSGeometry object from this OGRGeometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:ImportFrom_L314_C8", "label": "from django.contrib.gis.geos import GEOSGeometry", "type": "import", "loc": [314, 314], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L312_C4", "vector": [1, 2, 0.4261, 0.0014, 2, 0.3, 0.5, 886, 0, 1, 0, 0, 886, 0, 0], "semantic": {"name": "django.contrib.gis.geos", "arg_names": [], "import_names": ["GEOSGeometry"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.geos import GEOSGeometry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L315_C8", "label": "return", "type": "return", "loc": [315, 315], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L312_C4", "vector": [13, 2, 0.4274, 0.0014, 2, 0.3, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return GEOSGeometry(self.wkb, self.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L318_C4", "label": "gml", "type": "function", "loc": [318, 320], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.4328, 0.0041, 1, 0.61, 0.541, 410, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "gml", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def gml(self):\n \"Returns the GML representation of the Geometry.\"\n return capi.to_gml(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L319_C8", "label": "expression", "type": "expression", "loc": [319, 319], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L318_C4", "vector": [8, 2, 0.4328, 0.0014, 2, 0.58, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the GML representation of the Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L320_C8", "label": "return", "type": "return", "loc": [320, 320], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L318_C4", "vector": [13, 2, 0.4342, 0.0014, 2, 0.58, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.to_gml(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L323_C4", "label": "hex", "type": "function", "loc": [323, 325], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.4396, 0.0041, 1, 0.61, 0.5574, 224, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "hex", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def hex(self):\n \"Returns the hexadecimal representation of the WKB (a string).\"\n return str(self.wkb).encode('hex').upper()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L324_C8", "label": "expression", "type": "expression", "loc": [324, 324], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L323_C4", "vector": [8, 2, 0.4396, 0.0014, 2, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the hexadecimal representation of the WKB (a string).\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L325_C8", "label": "return", "type": "return", "loc": [325, 325], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L323_C4", "vector": [13, 2, 0.441, 0.0014, 2, 0.07, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str(self.wkb).encode('hex').upper()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L329_C4", "label": "json", "type": "function", "loc": [329, 337], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.4518, 0.0122, 1, 0.61, 0.5738, 463, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "json", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def json(self):\n \"\"\"\n Returns the GeoJSON representation of this Geometry (requires\n GDAL 1.5+).\n \"\"\"\n if GEOJSON:\n return capi.to_json(self.ptr)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L330_C8", "label": "expression", "type": "expression", "loc": [330, 333], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L329_C4", "vector": [8, 2, 0.4498, 0.0054, 2, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the GeoJSON representation of this Geometry (requires\n GDAL 1.5+).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L334_C8", "label": "if", "type": "if", "loc": [334, 337], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L329_C4", "vector": [4, 2, 0.4552, 0.0054, 2, 0.88, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if GEOJSON:\n return capi.to_json(self.ptr)\n else:\n raise NotImplementedError('GeoJSON output only supported on GDAL 1.5+.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L335_C12", "label": "return", "type": "return", "loc": [335, 335], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L334_C8", "vector": [13, 3, 0.4545, 0.0014, 3, 0.2, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.to_json(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L338_C4", "label": "geojson =", "type": "assigned_variable", "loc": [338, 338], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [14, 1, 0.4586, 0.0014, 1, 0.61, 0.5902, 89, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geojson", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geojson = json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L341_C4", "label": "kml", "type": "function", "loc": [341, 346], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.4661, 0.0081, 1, 0.61, 0.6066, 168, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "kml", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def kml(self):\n \"Returns the KML representation of the Geometry.\"\n if GEOJSON:\n return capi.to_kml(self.ptr, None)\n else:\n raise NotImplementedError('KML output only supported on GDAL 1.5+.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L342_C8", "label": "expression", "type": "expression", "loc": [342, 342], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L341_C4", "vector": [8, 2, 0.464, 0.0014, 2, 0.96, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the KML representation of the Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L343_C8", "label": "if", "type": "if", "loc": [343, 346], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L341_C4", "vector": [4, 2, 0.4674, 0.0054, 2, 0.96, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if GEOJSON:\n return capi.to_kml(self.ptr, None)\n else:\n raise NotImplementedError('KML output only supported on GDAL 1.5+.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L344_C12", "label": "return", "type": "return", "loc": [344, 344], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L343_C8", "vector": [13, 3, 0.4668, 0.0014, 3, 0.8, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.to_kml(self.ptr, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L349_C4", "label": "wkb_size", "type": "function", "loc": [349, 351], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.4749, 0.0041, 1, 0.61, 0.623, 575, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "wkb_size", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wkb_size(self):\n \"Returns the size of the WKB buffer.\"\n return capi.get_wkbsize(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L350_C8", "label": "expression", "type": "expression", "loc": [350, 350], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L349_C4", "vector": [8, 2, 0.4749, 0.0014, 2, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the size of the WKB buffer.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L351_C8", "label": "return", "type": "return", "loc": [351, 351], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L349_C4", "vector": [13, 2, 0.4763, 0.0014, 2, 0.38, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_wkbsize(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L354_C4", "label": "wkb", "type": "function", "loc": [354, 365], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.4878, 0.0163, 1, 0.61, 0.6393, 848, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "wkb", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wkb(self):\n \"Returns the WKB representation of the Geometry.\"\n if sys.byteorder == 'little':\n byteorder = 1 # wkbNDR (from ogr_core.h)\n else:\n byteorder = 0 # wkbXDR\n sz = self.wkb_size\n # Creating the unsigned character buffer, and passing it in by reference."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L355_C8", "label": "expression", "type": "expression", "loc": [355, 355], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L354_C4", "vector": [8, 2, 0.4817, 0.0014, 2, 0.97, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the WKB representation of the Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L356_C8", "label": "if", "type": "if", "loc": [356, 359], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L354_C4", "vector": [4, 2, 0.4851, 0.0054, 2, 0.97, 0.2, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if sys.byteorder == 'little':\n byteorder = 1 # wkbNDR (from ogr_core.h)\n else:\n byteorder = 0 # wkbXDR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L357_C12", "label": "byteorder =", "type": "assigned_variable", "loc": [357, 357], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L356_C8", "vector": [14, 3, 0.4844, 0.0014, 3, 0.42, 0.0, 509, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "byteorder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " byteorder = 1 # wkbNDR (from ogr_core.h)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L359_C12", "label": "byteorder =", "type": "assigned_variable", "loc": [359, 359], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L356_C8", "vector": [14, 3, 0.4871, 0.0014, 3, 0.42, 1.0, 509, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "byteorder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " byteorder = 0 # wkbXDR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L360_C8", "label": "sz =", "type": "assigned_variable", "loc": [360, 360], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L354_C4", "vector": [14, 2, 0.4885, 0.0014, 2, 0.97, 0.4, 780, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sz", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sz = self.wkb_size"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L362_C8", "label": "buf =", "type": "assigned_variable", "loc": [362, 362], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L354_C4", "vector": [14, 2, 0.4912, 0.0014, 2, 0.97, 0.6, 840, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "buf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " buf = (c_ubyte * sz)()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L363_C8", "label": "wkb = to_wkb()", "type": "assigned_variable", "loc": [363, 363], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L354_C4", "vector": [14, 2, 0.4925, 0.0014, 2, 0.97, 0.8, 848, 3, 3, 0, 0, 265, 10, 2], "semantic": {"name": "wkb", "arg_names": [], "import_names": [], "rhs_call_name": "to_wkb", "annotation": ""}, "snippet": " wkb = capi.to_wkb(self.ptr, byteorder, byref(buf))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L365_C8", "label": "return", "type": "return", "loc": [365, 365], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L354_C4", "vector": [13, 2, 0.4953, 0.0014, 2, 0.97, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return buffer(string_at(buf, sz))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L368_C4", "label": "wkt", "type": "function", "loc": [368, 370], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.5007, 0.0041, 1, 0.61, 0.6557, 836, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "wkt", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wkt(self):\n \"Returns the WKT representation of the Geometry.\"\n return capi.to_wkt(self.ptr, byref(c_char_p()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L369_C8", "label": "expression", "type": "expression", "loc": [369, 369], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L368_C4", "vector": [8, 2, 0.5007, 0.0014, 2, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the WKT representation of the Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L370_C8", "label": "return", "type": "return", "loc": [370, 370], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L368_C4", "vector": [13, 2, 0.502, 0.0014, 2, 0.88, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.to_wkt(self.ptr, byref(c_char_p()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L373_C4", "label": "ewkt", "type": "function", "loc": [373, 379], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.5102, 0.0095, 1, 0.61, 0.6721, 484, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "ewkt", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def ewkt(self):\n \"Returns the EWKT representation of the Geometry.\"\n srs = self.srs\n if srs and srs.srid:\n return 'SRID=%s;%s' % (srs.srid, self.wkt)\n else:\n return self.wkt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L374_C8", "label": "expression", "type": "expression", "loc": [374, 374], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L373_C4", "vector": [8, 2, 0.5075, 0.0014, 2, 0.2, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the EWKT representation of the Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L375_C8", "label": "srs =", "type": "assigned_variable", "loc": [375, 375], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L373_C4", "vector": [14, 2, 0.5088, 0.0014, 2, 0.2, 0.5, 95, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "srs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " srs = self.srs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L376_C8", "label": "if", "type": "if", "loc": [376, 379], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L373_C4", "vector": [4, 2, 0.5122, 0.0054, 2, 0.2, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if srs and srs.srid:\n return 'SRID=%s;%s' % (srs.srid, self.wkt)\n else:\n return self.wkt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L377_C12", "label": "return", "type": "return", "loc": [377, 377], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L376_C8", "vector": [13, 3, 0.5115, 0.0014, 3, 0.82, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'SRID=%s;%s' % (srs.srid, self.wkt)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L379_C12", "label": "return", "type": "return", "loc": [379, 379], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L376_C8", "vector": [13, 3, 0.5142, 0.0014, 3, 0.82, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.wkt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L382_C4", "label": "clone", "type": "function", "loc": [382, 384], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.5197, 0.0041, 1, 0.61, 0.6885, 911, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "clone", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clone(self):\n \"Clones this OGR Geometry.\"\n return OGRGeometry(capi.clone_geom(self.ptr), self.srs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L383_C8", "label": "expression", "type": "expression", "loc": [383, 383], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L382_C4", "vector": [8, 2, 0.5197, 0.0014, 2, 0.06, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Clones this OGR Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L384_C8", "label": "return", "type": "return", "loc": [384, 384], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L382_C4", "vector": [13, 2, 0.521, 0.0014, 2, 0.06, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return OGRGeometry(capi.clone_geom(self.ptr), self.srs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L386_C4", "label": "close_rings", "type": "function", "loc": [386, 393], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.5285, 0.0109, 1, 0.61, 0.7049, 366, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "close_rings", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def close_rings(self):\n \"\"\"\n If there are any rings within this geometry that have not been\n closed, this routine will do so by adding the starting point at the\n end.\n \"\"\"\n # Closing the open rings.\n capi.geom_close_rings(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L387_C8", "label": "expression", "type": "expression", "loc": [387, 391], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L386_C4", "vector": [8, 2, 0.5278, 0.0068, 2, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n If there are any rings within this geometry that have not been\n closed, this routine will do so by adding the starting point at the\n end.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L393_C8", "label": "geom_close_rings()", "type": "expression", "loc": [393, 393], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L386_C4", "vector": [8, 2, 0.5332, 0.0014, 2, 0.54, 1.0, 949, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "geom_close_rings", "arg_names": [], "import_names": [], "rhs_call_name": "geom_close_rings", "annotation": ""}, "snippet": " capi.geom_close_rings(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L395_C4", "label": "transform", "type": "function", "loc": [395, 442], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.5678, 0.0651, 1, 0.61, 0.7213, 48, 0, 3, 1, 0, 0, 0, 16], "semantic": {"name": "transform", "arg_names": ["self", "coord_trans", "clone"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def transform(self, coord_trans, clone=False):\n \"\"\"\n Transforms this geometry to a different spatial reference system.\n May take a CoordTransform object, a SpatialReference object, string\n WKT or PROJ.4, and/or an integer SRID. By default nothing is returned\n and the geometry is transformed in-place. However, if the `clone`\n keyword is set, then a transformed clone of this geometry will be\n returned."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L396_C8", "label": "expression", "type": "expression", "loc": [396, 403], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L395_C4", "vector": [8, 2, 0.5421, 0.0109, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Transforms this geometry to a different spatial reference system.\n May take a CoordTransform object, a SpatialReference object, string\n WKT or PROJ.4, and/or an integer SRID. By default nothing is returned\n and the geometry is transformed in-place. However, if the `clone`\n keyword is set, then a transformed clone of this geometry will be\n returned.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L404_C8", "label": "if", "type": "if", "loc": [404, 407], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L395_C4", "vector": [4, 2, 0.5502, 0.0054, 2, 0.98, 0.25, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if clone:\n klone = self.clone()\n klone.transform(coord_trans)\n return klone"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L405_C12", "label": "klone = clone()", "type": "assigned_variable", "loc": [405, 405], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L404_C8", "vector": [14, 3, 0.5495, 0.0014, 3, 0.3, 0.0, 101, 3, 0, 0, 0, 911, 10, 1], "semantic": {"name": "klone", "arg_names": [], "import_names": [], "rhs_call_name": "clone", "annotation": ""}, "snippet": " klone = self.clone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L406_C12", "label": "transform()", "type": "expression", "loc": [406, 406], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L404_C8", "vector": [8, 3, 0.5509, 0.0014, 3, 0.3, 0.5, 48, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "transform", "arg_names": [], "import_names": [], "rhs_call_name": "transform", "annotation": ""}, "snippet": " klone.transform(coord_trans)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L407_C12", "label": "return", "type": "return", "loc": [407, 407], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L404_C8", "vector": [13, 3, 0.5522, 0.0014, 3, 0.3, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return klone"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L414_C8", "label": "if", "type": "if", "loc": [414, 415], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L395_C4", "vector": [4, 2, 0.5624, 0.0027, 2, 0.98, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if GDAL_VERSION < (1, 7):\n orig_dim = self.coord_dim"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L415_C12", "label": "orig_dim =", "type": "assigned_variable", "loc": [415, 415], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L414_C8", "vector": [14, 3, 0.5631, 0.0014, 3, 0.4, 0.0, 128, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "orig_dim", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " orig_dim = self.coord_dim"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L419_C8", "label": "if", "type": "if", "loc": [419, 428], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L395_C4", "vector": [4, 2, 0.5746, 0.0136, 2, 0.98, 0.75, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(coord_trans, CoordTransform):\n capi.geom_transform(self.ptr, coord_trans.ptr)\n elif isinstance(coord_trans, SpatialReference):\n capi.geom_transform_to(self.ptr, coord_trans.ptr)\n elif isinstance(coord_trans, (int, long, basestring)):\n sr = SpatialReference(coord_trans)\n capi.geom_transform_to(self.ptr, sr.ptr)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L420_C12", "label": "geom_transform()", "type": "expression", "loc": [420, 420], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L419_C8", "vector": [8, 3, 0.5699, 0.0014, 3, 0.8, 0.0, 340, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "geom_transform", "arg_names": [], "import_names": [], "rhs_call_name": "geom_transform", "annotation": ""}, "snippet": " capi.geom_transform(self.ptr, coord_trans.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L421_C8", "label": "if", "type": "if", "loc": [421, 428], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L419_C8", "vector": [4, 3, 0.576, 0.0109, 3, 0.8, 1.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(coord_trans, SpatialReference):\n capi.geom_transform_to(self.ptr, coord_trans.ptr)\n elif isinstance(coord_trans, (int, long, basestring)):\n sr = SpatialReference(coord_trans)\n capi.geom_transform_to(self.ptr, sr.ptr)\n else:\n raise TypeError('Transform only accepts CoordTransform, '\n 'SpatialReference, string, and integer objects.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L422_C12", "label": "geom_transform_to()", "type": "expression", "loc": [422, 422], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L421_C8", "vector": [8, 4, 0.5726, 0.0014, 4, 0.77, 0.0, 274, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "geom_transform_to", "arg_names": [], "import_names": [], "rhs_call_name": "geom_transform_to", "annotation": ""}, "snippet": " capi.geom_transform_to(self.ptr, coord_trans.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L423_C8", "label": "if", "type": "if", "loc": [423, 428], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L421_C8", "vector": [4, 4, 0.5773, 0.0081, 4, 0.77, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(coord_trans, (int, long, basestring)):\n sr = SpatialReference(coord_trans)\n capi.geom_transform_to(self.ptr, sr.ptr)\n else:\n raise TypeError('Transform only accepts CoordTransform, '\n 'SpatialReference, string, and integer objects.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L424_C12", "label": "sr = SpatialReference()", "type": "assigned_variable", "loc": [424, 424], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L423_C8", "vector": [14, 5, 0.5753, 0.0014, 5, 0.9, 0.0, 498, 3, 1, 0, 0, 590, 10, 1], "semantic": {"name": "sr", "arg_names": [], "import_names": [], "rhs_call_name": "SpatialReference", "annotation": ""}, "snippet": " sr = SpatialReference(coord_trans)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L425_C12", "label": "geom_transform_to()", "type": "expression", "loc": [425, 425], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L423_C8", "vector": [8, 5, 0.5767, 0.0014, 5, 0.9, 1.0, 274, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "geom_transform_to", "arg_names": [], "import_names": [], "rhs_call_name": "geom_transform_to", "annotation": ""}, "snippet": " capi.geom_transform_to(self.ptr, sr.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L431_C8", "label": "if", "type": "if", "loc": [431, 442], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L395_C4", "vector": [4, 2, 0.5923, 0.0163, 2, 0.98, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if GDAL_VERSION < (1, 7):\n if isinstance(self, GeometryCollection):\n # With geometry collections have to set dimension on\n # each internal geometry reference, as the collection\n # dimension isn't affected.\n for i in xrange(len(self)):\n internal_ptr = capi.get_geom_ref(self.ptr, i)\n if orig_dim != capi.get_coord_dim(internal_ptr):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L432_C12", "label": "if", "type": "if", "loc": [432, 442], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L431_C8", "vector": [4, 3, 0.5929, 0.0149, 3, 0.55, 0.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(self, GeometryCollection):\n # With geometry collections have to set dimension on\n # each internal geometry reference, as the collection\n # dimension isn't affected.\n for i in xrange(len(self)):\n internal_ptr = capi.get_geom_ref(self.ptr, i)\n if orig_dim != capi.get_coord_dim(internal_ptr):\n capi.set_coord_dim(internal_ptr, orig_dim)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:For_L436_C16", "label": "for i", "type": "for", "loc": [436, 439], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L432_C12", "vector": [6, 4, 0.5936, 0.0054, 4, 0.34, 0.0, 826, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange(len(self)):\n internal_ptr = capi.get_geom_ref(self.ptr, i)\n if orig_dim != capi.get_coord_dim(internal_ptr):\n capi.set_coord_dim(internal_ptr, orig_dim)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L437_C20", "label": "internal_ptr = get_geom_ref()", "type": "assigned_variable", "loc": [437, 437], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:For_L436_C16", "vector": [14, 5, 0.5929, 0.0014, 5, 0.33, 0.0, 410, 3, 2, 0, 0, 339, 10, 1], "semantic": {"name": "internal_ptr", "arg_names": [], "import_names": [], "rhs_call_name": "get_geom_ref", "annotation": ""}, "snippet": " internal_ptr = capi.get_geom_ref(self.ptr, i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L438_C20", "label": "if", "type": "if", "loc": [438, 439], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:For_L436_C16", "vector": [4, 5, 0.595, 0.0027, 5, 0.33, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if orig_dim != capi.get_coord_dim(internal_ptr):\n capi.set_coord_dim(internal_ptr, orig_dim)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L439_C24", "label": "set_coord_dim()", "type": "expression", "loc": [439, 439], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L438_C20", "vector": [8, 6, 0.5957, 0.0014, 6, 0.83, 0.0, 687, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_coord_dim", "arg_names": [], "import_names": [], "rhs_call_name": "set_coord_dim", "annotation": ""}, "snippet": " capi.set_coord_dim(internal_ptr, orig_dim)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L441_C16", "label": "if", "type": "if", "loc": [441, 442], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L432_C12", "vector": [4, 4, 0.5991, 0.0027, 4, 0.34, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.coord_dim != orig_dim:\n self.coord_dim = orig_dim"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L442_C20", "label": "self.coord_dim =", "type": "assigned_variable", "loc": [442, 442], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L441_C16", "vector": [14, 5, 0.5997, 0.0014, 5, 0.38, 0.0, 373, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.coord_dim", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.coord_dim = orig_dim"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L444_C4", "label": "transform_to", "type": "function", "loc": [444, 446], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.6038, 0.0041, 1, 0.61, 0.7377, 701, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "transform_to", "arg_names": ["self", "srs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def transform_to(self, srs):\n \"For backwards-compatibility.\"\n self.transform(srs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L445_C8", "label": "expression", "type": "expression", "loc": [445, 445], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L444_C4", "vector": [8, 2, 0.6038, 0.0014, 2, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"For backwards-compatibility.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L446_C8", "label": "transform()", "type": "expression", "loc": [446, 446], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L444_C4", "vector": [8, 2, 0.6052, 0.0014, 2, 0.84, 1.0, 48, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "transform", "arg_names": [], "import_names": [], "rhs_call_name": "transform", "annotation": ""}, "snippet": " self.transform(srs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L449_C4", "label": "_topology", "type": "function", "loc": [449, 457], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.6147, 0.0122, 1, 0.61, 0.7541, 985, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "_topology", "arg_names": ["self", "func", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _topology(self, func, other):\n \"\"\"A generalized function for topology operations, takes a GDAL function and\n the other geometry to perform the operation on.\"\"\"\n if not isinstance(other, OGRGeometry):\n raise TypeError('Must use another OGRGeometry object for topology operations!')\n\n # Returning the output of the given function with the other geometry's\n # pointer."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L450_C8", "label": "expression", "type": "expression", "loc": [450, 451], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L449_C4", "vector": [8, 2, 0.6113, 0.0027, 2, 0.65, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A generalized function for topology operations, takes a GDAL function and\n the other geometry to perform the operation on.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L452_C8", "label": "if", "type": "if", "loc": [452, 453], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L449_C4", "vector": [4, 2, 0.614, 0.0027, 2, 0.65, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(other, OGRGeometry):\n raise TypeError('Must use another OGRGeometry object for topology operations!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L457_C8", "label": "return", "type": "return", "loc": [457, 457], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L449_C4", "vector": [13, 2, 0.6201, 0.0014, 2, 0.65, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L459_C4", "label": "intersects", "type": "function", "loc": [459, 461], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.6242, 0.0041, 1, 0.61, 0.7705, 772, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "intersects", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def intersects(self, other):\n \"Returns True if this geometry intersects with the other.\"\n return self._topology(capi.ogr_intersects, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L460_C8", "label": "expression", "type": "expression", "loc": [460, 460], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L459_C4", "vector": [8, 2, 0.6242, 0.0014, 2, 0.51, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns True if this geometry intersects with the other.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L461_C8", "label": "return", "type": "return", "loc": [461, 461], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L459_C4", "vector": [13, 2, 0.6255, 0.0014, 2, 0.51, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._topology(capi.ogr_intersects, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L463_C4", "label": "equals", "type": "function", "loc": [463, 465], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.6296, 0.0041, 1, 0.61, 0.7869, 135, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "equals", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def equals(self, other):\n \"Returns True if this geometry is equivalent to the other.\"\n return self._topology(capi.ogr_equals, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L464_C8", "label": "expression", "type": "expression", "loc": [464, 464], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L463_C4", "vector": [8, 2, 0.6296, 0.0014, 2, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns True if this geometry is equivalent to the other.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L465_C8", "label": "return", "type": "return", "loc": [465, 465], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L463_C4", "vector": [13, 2, 0.6309, 0.0014, 2, 0.43, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._topology(capi.ogr_equals, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L467_C4", "label": "disjoint", "type": "function", "loc": [467, 469], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.635, 0.0041, 1, 0.61, 0.8033, 303, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "disjoint", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def disjoint(self, other):\n \"Returns True if this geometry and the other are spatially disjoint.\"\n return self._topology(capi.ogr_disjoint, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L468_C8", "label": "expression", "type": "expression", "loc": [468, 468], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L467_C4", "vector": [8, 2, 0.635, 0.0014, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns True if this geometry and the other are spatially disjoint.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L469_C8", "label": "return", "type": "return", "loc": [469, 469], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L467_C4", "vector": [13, 2, 0.6364, 0.0014, 2, 0.98, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._topology(capi.ogr_disjoint, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L471_C4", "label": "touches", "type": "function", "loc": [471, 473], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.6404, 0.0041, 1, 0.61, 0.8197, 422, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "touches", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def touches(self, other):\n \"Returns True if this geometry touches the other.\"\n return self._topology(capi.ogr_touches, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L472_C8", "label": "expression", "type": "expression", "loc": [472, 472], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L471_C4", "vector": [8, 2, 0.6404, 0.0014, 2, 0.27, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns True if this geometry touches the other.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L473_C8", "label": "return", "type": "return", "loc": [473, 473], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L471_C4", "vector": [13, 2, 0.6418, 0.0014, 2, 0.27, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._topology(capi.ogr_touches, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L475_C4", "label": "crosses", "type": "function", "loc": [475, 477], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.6459, 0.0041, 1, 0.61, 0.8361, 690, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "crosses", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def crosses(self, other):\n \"Returns True if this geometry crosses the other.\"\n return self._topology(capi.ogr_crosses, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L476_C8", "label": "expression", "type": "expression", "loc": [476, 476], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L475_C4", "vector": [8, 2, 0.6459, 0.0014, 2, 0.7, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns True if this geometry crosses the other.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L477_C8", "label": "return", "type": "return", "loc": [477, 477], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L475_C4", "vector": [13, 2, 0.6472, 0.0014, 2, 0.7, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._topology(capi.ogr_crosses, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L479_C4", "label": "within", "type": "function", "loc": [479, 481], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.6513, 0.0041, 1, 0.61, 0.8525, 912, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "within", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def within(self, other):\n \"Returns True if this geometry is within the other.\"\n return self._topology(capi.ogr_within, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L480_C8", "label": "expression", "type": "expression", "loc": [480, 480], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L479_C4", "vector": [8, 2, 0.6513, 0.0014, 2, 0.65, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns True if this geometry is within the other.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L481_C8", "label": "return", "type": "return", "loc": [481, 481], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L479_C4", "vector": [13, 2, 0.6526, 0.0014, 2, 0.65, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._topology(capi.ogr_within, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L483_C4", "label": "contains", "type": "function", "loc": [483, 485], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.6567, 0.0041, 1, 0.61, 0.8689, 848, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "contains", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def contains(self, other):\n \"Returns True if this geometry contains the other.\"\n return self._topology(capi.ogr_contains, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L484_C8", "label": "expression", "type": "expression", "loc": [484, 484], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L483_C4", "vector": [8, 2, 0.6567, 0.0014, 2, 0.32, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns True if this geometry contains the other.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L485_C8", "label": "return", "type": "return", "loc": [485, 485], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L483_C4", "vector": [13, 2, 0.6581, 0.0014, 2, 0.32, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._topology(capi.ogr_contains, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L487_C4", "label": "overlaps", "type": "function", "loc": [487, 489], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.6621, 0.0041, 1, 0.61, 0.8852, 458, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "overlaps", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def overlaps(self, other):\n \"Returns True if this geometry overlaps the other.\"\n return self._topology(capi.ogr_overlaps, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L488_C8", "label": "expression", "type": "expression", "loc": [488, 488], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L487_C4", "vector": [8, 2, 0.6621, 0.0014, 2, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns True if this geometry overlaps the other.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L489_C8", "label": "return", "type": "return", "loc": [489, 489], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L487_C4", "vector": [13, 2, 0.6635, 0.0014, 2, 0.67, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._topology(capi.ogr_overlaps, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L492_C4", "label": "_geomgen", "type": "function", "loc": [492, 497], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.671, 0.0081, 1, 0.61, 0.9016, 76, 0, 3, 1, 0, 0, 0, 5], "semantic": {"name": "_geomgen", "arg_names": ["self", "gen_func", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _geomgen(self, gen_func, other=None):\n \"A helper routine for the OGR routines that generate geometries.\"\n if isinstance(other, OGRGeometry):\n return OGRGeometry(gen_func(self.ptr, other.ptr), self.srs)\n else:\n return OGRGeometry(gen_func(self.ptr), self.srs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L493_C8", "label": "expression", "type": "expression", "loc": [493, 493], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L492_C4", "vector": [8, 2, 0.6689, 0.0014, 2, 0.16, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"A helper routine for the OGR routines that generate geometries.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L494_C8", "label": "if", "type": "if", "loc": [494, 497], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L492_C4", "vector": [4, 2, 0.6723, 0.0054, 2, 0.16, 1.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, OGRGeometry):\n return OGRGeometry(gen_func(self.ptr, other.ptr), self.srs)\n else:\n return OGRGeometry(gen_func(self.ptr), self.srs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L495_C12", "label": "return", "type": "return", "loc": [495, 495], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L494_C8", "vector": [13, 3, 0.6716, 0.0014, 3, 0.23, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return OGRGeometry(gen_func(self.ptr, other.ptr), self.srs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L497_C12", "label": "return", "type": "return", "loc": [497, 497], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L494_C8", "vector": [13, 3, 0.6744, 0.0014, 3, 0.23, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return OGRGeometry(gen_func(self.ptr), self.srs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L500_C4", "label": "boundary", "type": "function", "loc": [500, 502], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.6798, 0.0041, 1, 0.61, 0.918, 780, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "boundary", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def boundary(self):\n \"Returns the boundary of this geometry.\"\n return self._geomgen(capi.get_boundary)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L501_C8", "label": "expression", "type": "expression", "loc": [501, 501], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L500_C4", "vector": [8, 2, 0.6798, 0.0014, 2, 0.81, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the boundary of this geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L502_C8", "label": "return", "type": "return", "loc": [502, 502], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L500_C4", "vector": [13, 2, 0.6811, 0.0014, 2, 0.81, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._geomgen(capi.get_boundary)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L505_C4", "label": "convex_hull", "type": "function", "loc": [505, 510], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.6886, 0.0081, 1, 0.61, 0.9344, 1, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "convex_hull", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def convex_hull(self):\n \"\"\"\n Returns the smallest convex Polygon that contains all the points in\n this Geometry.\n \"\"\"\n return self._geomgen(capi.geom_convex_hull)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L506_C8", "label": "expression", "type": "expression", "loc": [506, 509], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L505_C4", "vector": [8, 2, 0.6886, 0.0054, 2, 0.64, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the smallest convex Polygon that contains all the points in\n this Geometry.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L510_C8", "label": "return", "type": "return", "loc": [510, 510], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L505_C4", "vector": [13, 2, 0.692, 0.0014, 2, 0.64, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._geomgen(capi.geom_convex_hull)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L512_C4", "label": "difference", "type": "function", "loc": [512, 517], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.6981, 0.0081, 1, 0.61, 0.9508, 498, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "difference", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def difference(self, other):\n \"\"\"\n Returns a new geometry consisting of the region which is the difference\n of this geometry and the other.\n \"\"\"\n return self._geomgen(capi.geom_diff, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L513_C8", "label": "expression", "type": "expression", "loc": [513, 516], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L512_C4", "vector": [8, 2, 0.6981, 0.0054, 2, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a new geometry consisting of the region which is the difference\n of this geometry and the other.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L517_C8", "label": "return", "type": "return", "loc": [517, 517], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L512_C4", "vector": [13, 2, 0.7015, 0.0014, 2, 0.44, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._geomgen(capi.geom_diff, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L519_C4", "label": "intersection", "type": "function", "loc": [519, 524], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.7076, 0.0081, 1, 0.61, 0.9672, 568, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "intersection", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def intersection(self, other):\n \"\"\"\n Returns a new geometry consisting of the region of intersection of this\n geometry and the other.\n \"\"\"\n return self._geomgen(capi.geom_intersection, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L520_C8", "label": "expression", "type": "expression", "loc": [520, 523], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L519_C4", "vector": [8, 2, 0.7076, 0.0054, 2, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a new geometry consisting of the region of intersection of this\n geometry and the other.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L524_C8", "label": "return", "type": "return", "loc": [524, 524], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L519_C4", "vector": [13, 2, 0.711, 0.0014, 2, 0.83, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._geomgen(capi.geom_intersection, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L526_C4", "label": "sym_difference", "type": "function", "loc": [526, 531], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.7171, 0.0081, 1, 0.61, 0.9836, 37, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "sym_difference", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def sym_difference(self, other):\n \"\"\"\n Returns a new geometry which is the symmetric difference of this\n geometry and the other.\n \"\"\"\n return self._geomgen(capi.geom_sym_diff, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L527_C8", "label": "expression", "type": "expression", "loc": [527, 530], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L526_C4", "vector": [8, 2, 0.7171, 0.0054, 2, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a new geometry which is the symmetric difference of this\n geometry and the other.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L531_C8", "label": "return", "type": "return", "loc": [531, 531], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L526_C4", "vector": [13, 2, 0.7205, 0.0014, 2, 0.54, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._geomgen(capi.geom_sym_diff, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L533_C4", "label": "union", "type": "function", "loc": [533, 538], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "vector": [2, 1, 0.7266, 0.0081, 1, 0.61, 1.0, 140, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "union", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def union(self, other):\n \"\"\"\n Returns a new geometry consisting of the region which is the union of\n this geometry and the other.\n \"\"\"\n return self._geomgen(capi.geom_union, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L534_C8", "label": "expression", "type": "expression", "loc": [534, 537], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L533_C4", "vector": [8, 2, 0.7266, 0.0054, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a new geometry consisting of the region which is the union of\n this geometry and the other.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L538_C8", "label": "return", "type": "return", "loc": [538, 538], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L533_C4", "vector": [13, 2, 0.73, 0.0014, 2, 0.98, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._geomgen(capi.geom_union, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L541_C0", "label": "Point", "type": "class", "loc": [541, 566], "level": 0, "parent": null, "vector": [3, 0, 0.751, 0.0353, 0, 0.66, 0.619, 652, 0, 4, 0, 0, 488, 0, 3], "semantic": {"name": "Point", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Point(OGRGeometry):\n\n @property\n def x(self):\n \"Returns the X coordinate for this Point.\"\n return capi.getx(self.ptr, 0)\n\n @property"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L544_C4", "label": "x", "type": "function", "loc": [544, 546], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L541_C0", "vector": [2, 1, 0.7395, 0.0041, 1, 0.45, 0.0, 190, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "x", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def x(self):\n \"Returns the X coordinate for this Point.\"\n return capi.getx(self.ptr, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L545_C8", "label": "expression", "type": "expression", "loc": [545, 545], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L544_C4", "vector": [8, 2, 0.7395, 0.0014, 2, 0.6, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the X coordinate for this Point.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L546_C8", "label": "return", "type": "return", "loc": [546, 546], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L544_C4", "vector": [13, 2, 0.7408, 0.0014, 2, 0.6, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.getx(self.ptr, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L549_C4", "label": "y", "type": "function", "loc": [549, 551], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L541_C0", "vector": [2, 1, 0.7463, 0.0041, 1, 0.45, 0.25, 304, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "y", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def y(self):\n \"Returns the Y coordinate for this Point.\"\n return capi.gety(self.ptr, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L550_C8", "label": "expression", "type": "expression", "loc": [550, 550], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L549_C4", "vector": [8, 2, 0.7463, 0.0014, 2, 0.77, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the Y coordinate for this Point.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L551_C8", "label": "return", "type": "return", "loc": [551, 551], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L549_C4", "vector": [13, 2, 0.7476, 0.0014, 2, 0.77, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.gety(self.ptr, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L554_C4", "label": "z", "type": "function", "loc": [554, 557], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L541_C0", "vector": [2, 1, 0.7537, 0.0054, 1, 0.45, 0.5, 859, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "z", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def z(self):\n \"Returns the Z coordinate for this Point.\"\n if self.coord_dim == 3:\n return capi.getz(self.ptr, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L555_C8", "label": "expression", "type": "expression", "loc": [555, 555], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L554_C4", "vector": [8, 2, 0.7531, 0.0014, 2, 0.03, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the Z coordinate for this Point.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L556_C8", "label": "if", "type": "if", "loc": [556, 557], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L554_C4", "vector": [4, 2, 0.7551, 0.0027, 2, 0.03, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.coord_dim == 3:\n return capi.getz(self.ptr, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L557_C12", "label": "return", "type": "return", "loc": [557, 557], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L556_C8", "vector": [13, 3, 0.7558, 0.0014, 3, 0.61, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.getz(self.ptr, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L560_C4", "label": "tuple", "type": "function", "loc": [560, 565], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L541_C0", "vector": [2, 1, 0.7632, 0.0081, 1, 0.45, 0.75, 259, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "tuple", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def tuple(self):\n \"Returns the tuple of this point.\"\n if self.coord_dim == 2:\n return (self.x, self.y)\n elif self.coord_dim == 3:\n return (self.x, self.y, self.z)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L561_C8", "label": "expression", "type": "expression", "loc": [561, 561], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L560_C4", "vector": [8, 2, 0.7612, 0.0014, 2, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the tuple of this point.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L562_C8", "label": "if", "type": "if", "loc": [562, 565], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L560_C4", "vector": [4, 2, 0.7646, 0.0054, 2, 0.83, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.coord_dim == 2:\n return (self.x, self.y)\n elif self.coord_dim == 3:\n return (self.x, self.y, self.z)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L563_C12", "label": "return", "type": "return", "loc": [563, 563], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L562_C8", "vector": [13, 3, 0.7639, 0.0014, 3, 0.81, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (self.x, self.y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L564_C8", "label": "if", "type": "if", "loc": [564, 565], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L562_C8", "vector": [4, 3, 0.7659, 0.0027, 3, 0.81, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self.coord_dim == 3:\n return (self.x, self.y, self.z)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L565_C12", "label": "return", "type": "return", "loc": [565, 565], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L564_C8", "vector": [13, 4, 0.7666, 0.0014, 4, 0.45, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (self.x, self.y, self.z)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L566_C4", "label": "coords =", "type": "assigned_variable", "loc": [566, 566], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L541_C0", "vector": [14, 1, 0.768, 0.0014, 1, 0.45, 1.0, 216, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "coords", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " coords = tuple"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L568_C0", "label": "LineString", "type": "class", "loc": [568, 621], "level": 0, "parent": null, "vector": [3, 0, 0.8066, 0.0733, 0, 0.66, 0.6667, 440, 0, 8, 0, 0, 488, 0, 19], "semantic": {"name": "LineString", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class LineString(OGRGeometry):\n\n def __getitem__(self, index):\n \"Returns the Point at the given index.\"\n if index >= 0 and index < self.point_count:\n x, y, z = c_double(), c_double(), c_double()\n capi.get_point(self.ptr, index, byref(x), byref(y), byref(z))\n dim = self.coord_dim"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L570_C4", "label": "__getitem__", "type": "function", "loc": [570, 583], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L568_C0", "vector": [2, 1, 0.7822, 0.019, 1, 0.23, 0.0, 698, 0, 2, 1, 0, 0, 0, 9], "semantic": {"name": "__getitem__", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getitem__(self, index):\n \"Returns the Point at the given index.\"\n if index >= 0 and index < self.point_count:\n x, y, z = c_double(), c_double(), c_double()\n capi.get_point(self.ptr, index, byref(x), byref(y), byref(z))\n dim = self.coord_dim\n if dim == 1:\n return (x.value,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L571_C8", "label": "expression", "type": "expression", "loc": [571, 571], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L570_C4", "vector": [8, 2, 0.7748, 0.0014, 2, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the Point at the given index.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L572_C8", "label": "if", "type": "if", "loc": [572, 583], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L570_C4", "vector": [4, 2, 0.7836, 0.0163, 2, 0.41, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if index >= 0 and index < self.point_count:\n x, y, z = c_double(), c_double(), c_double()\n capi.get_point(self.ptr, index, byref(x), byref(y), byref(z))\n dim = self.coord_dim\n if dim == 1:\n return (x.value,)\n elif dim == 2:\n return (x.value, y.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L573_C12", "label": "x, y, z =", "type": "assigned_variable", "loc": [573, 573], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L572_C8", "vector": [14, 3, 0.7775, 0.0014, 3, 0.44, 0.0, 971, 0, 0, 0, 0, 0, 8, 3], "semantic": {"name": "x, y, z", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " x, y, z = c_double(), c_double(), c_double()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L574_C12", "label": "get_point()", "type": "expression", "loc": [574, 574], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L572_C8", "vector": [8, 3, 0.7788, 0.0014, 3, 0.44, 0.3333, 346, 3, 5, 0, 0, 0, 0, 4], "semantic": {"name": "get_point", "arg_names": [], "import_names": [], "rhs_call_name": "get_point", "annotation": ""}, "snippet": " capi.get_point(self.ptr, index, byref(x), byref(y), byref(z))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L575_C12", "label": "dim =", "type": "assigned_variable", "loc": [575, 575], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L572_C8", "vector": [14, 3, 0.7802, 0.0014, 3, 0.44, 0.6667, 596, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dim", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dim = self.coord_dim"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L576_C12", "label": "if", "type": "if", "loc": [576, 581], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L572_C8", "vector": [4, 3, 0.7849, 0.0081, 3, 0.44, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if dim == 1:\n return (x.value,)\n elif dim == 2:\n return (x.value, y.value)\n elif dim == 3:\n return (x.value, y.value, z.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L577_C16", "label": "return", "type": "return", "loc": [577, 577], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L576_C12", "vector": [13, 4, 0.7829, 0.0014, 4, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (x.value,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L578_C12", "label": "if", "type": "if", "loc": [578, 581], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L576_C12", "vector": [4, 4, 0.7863, 0.0054, 4, 0.0, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif dim == 2:\n return (x.value, y.value)\n elif dim == 3:\n return (x.value, y.value, z.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L579_C16", "label": "return", "type": "return", "loc": [579, 579], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L578_C12", "vector": [13, 5, 0.7856, 0.0014, 5, 0.16, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (x.value, y.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L580_C12", "label": "if", "type": "if", "loc": [580, 581], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L578_C12", "vector": [4, 5, 0.7877, 0.0027, 5, 0.16, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif dim == 3:\n return (x.value, y.value, z.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L581_C16", "label": "return", "type": "return", "loc": [581, 581], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L580_C12", "vector": [13, 6, 0.7883, 0.0014, 6, 0.48, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (x.value, y.value, z.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L585_C4", "label": "__iter__", "type": "function", "loc": [585, 588], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L568_C0", "vector": [2, 1, 0.7958, 0.0054, 1, 0.23, 0.125, 891, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n \"Iterates over each point in the LineString.\"\n for i in xrange(self.point_count):\n yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L586_C8", "label": "expression", "type": "expression", "loc": [586, 586], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L585_C4", "vector": [8, 2, 0.7951, 0.0014, 2, 0.65, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Iterates over each point in the LineString.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:For_L587_C8", "label": "for i", "type": "for", "loc": [587, 588], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L585_C4", "vector": [6, 2, 0.7972, 0.0027, 2, 0.65, 1.0, 826, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange(self.point_count):\n yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L588_C12", "label": "expression", "type": "expression", "loc": [588, 588], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:For_L587_C8", "vector": [8, 3, 0.7978, 0.0014, 3, 0.58, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L590_C4", "label": "__len__", "type": "function", "loc": [590, 592], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L568_C0", "vector": [2, 1, 0.8019, 0.0041, 1, 0.23, 0.25, 76, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__len__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __len__(self):\n \"The length returns the number of points in the LineString.\"\n return self.point_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L591_C8", "label": "expression", "type": "expression", "loc": [591, 591], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L590_C4", "vector": [8, 2, 0.8019, 0.0014, 2, 0.42, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"The length returns the number of points in the LineString.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L592_C8", "label": "return", "type": "return", "loc": [592, 592], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L590_C4", "vector": [13, 2, 0.8033, 0.0014, 2, 0.42, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.point_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L595_C4", "label": "tuple", "type": "function", "loc": [595, 597], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L568_C0", "vector": [2, 1, 0.8087, 0.0041, 1, 0.23, 0.375, 259, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "tuple", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def tuple(self):\n \"Returns the tuple representation of this LineString.\"\n return tuple([self[i] for i in xrange(len(self))])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L596_C8", "label": "expression", "type": "expression", "loc": [596, 596], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L595_C4", "vector": [8, 2, 0.8087, 0.0014, 2, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the tuple representation of this LineString.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L597_C8", "label": "return", "type": "return", "loc": [597, 597], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L595_C4", "vector": [13, 2, 0.81, 0.0014, 2, 0.85, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return tuple([self[i] for i in xrange(len(self))])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L598_C4", "label": "coords =", "type": "assigned_variable", "loc": [598, 598], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L568_C0", "vector": [14, 1, 0.8114, 0.0014, 1, 0.23, 0.5, 216, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "coords", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " coords = tuple"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L600_C4", "label": "_listarr", "type": "function", "loc": [600, 605], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L568_C0", "vector": [2, 1, 0.8175, 0.0081, 1, 0.23, 0.625, 923, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "_listarr", "arg_names": ["self", "func"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _listarr(self, func):\n \"\"\"\n Internal routine that returns a sequence (list) corresponding with\n the given function.\n \"\"\"\n return [func(self.ptr, i) for i in xrange(len(self))]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L601_C8", "label": "expression", "type": "expression", "loc": [601, 604], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L600_C4", "vector": [8, 2, 0.8175, 0.0054, 2, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Internal routine that returns a sequence (list) corresponding with\n the given function.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L605_C8", "label": "return", "type": "return", "loc": [605, 605], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L600_C4", "vector": [13, 2, 0.8209, 0.0014, 2, 0.49, 1.0, 0, 5, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [func(self.ptr, i) for i in xrange(len(self))]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L608_C4", "label": "x", "type": "function", "loc": [608, 610], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L568_C0", "vector": [2, 1, 0.8263, 0.0041, 1, 0.23, 0.75, 190, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "x", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def x(self):\n \"Returns the X coordinates in a list.\"\n return self._listarr(capi.getx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L609_C8", "label": "expression", "type": "expression", "loc": [609, 609], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L608_C4", "vector": [8, 2, 0.8263, 0.0014, 2, 0.69, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the X coordinates in a list.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L610_C8", "label": "return", "type": "return", "loc": [610, 610], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L608_C4", "vector": [13, 2, 0.8277, 0.0014, 2, 0.69, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._listarr(capi.getx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L613_C4", "label": "y", "type": "function", "loc": [613, 615], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L568_C0", "vector": [2, 1, 0.8331, 0.0041, 1, 0.23, 0.875, 304, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "y", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def y(self):\n \"Returns the Y coordinates in a list.\"\n return self._listarr(capi.gety)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L614_C8", "label": "expression", "type": "expression", "loc": [614, 614], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L613_C4", "vector": [8, 2, 0.8331, 0.0014, 2, 0.06, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the Y coordinates in a list.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L615_C8", "label": "return", "type": "return", "loc": [615, 615], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L613_C4", "vector": [13, 2, 0.8345, 0.0014, 2, 0.06, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._listarr(capi.gety)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L618_C4", "label": "z", "type": "function", "loc": [618, 621], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L568_C0", "vector": [2, 1, 0.8406, 0.0054, 1, 0.23, 1.0, 859, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "z", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def z(self):\n \"Returns the Z coordinates in a list.\"\n if self.coord_dim == 3:\n return self._listarr(capi.getz)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L619_C8", "label": "expression", "type": "expression", "loc": [619, 619], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L618_C4", "vector": [8, 2, 0.8399, 0.0014, 2, 0.36, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the Z coordinates in a list.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L620_C8", "label": "if", "type": "if", "loc": [620, 621], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L618_C4", "vector": [4, 2, 0.8419, 0.0027, 2, 0.36, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.coord_dim == 3:\n return self._listarr(capi.getz)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L621_C12", "label": "return", "type": "return", "loc": [621, 621], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L620_C8", "vector": [13, 3, 0.8426, 0.0014, 3, 0.38, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._listarr(capi.getz)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L624_C0", "label": "LinearRing", "type": "class", "loc": [624, 624], "level": 0, "parent": null, "vector": [3, 0, 0.8467, 0.0014, 0, 0.66, 0.7143, 441, 0, 0, 0, 0, 440, 0, 0], "semantic": {"name": "LinearRing", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class LinearRing(LineString): pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L626_C0", "label": "Polygon", "type": "class", "loc": [626, 669], "level": 0, "parent": null, "vector": [3, 0, 0.8786, 0.0597, 0, 0.66, 0.7619, 818, 0, 7, 0, 0, 488, 0, 12], "semantic": {"name": "Polygon", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Polygon(OGRGeometry):\n\n def __len__(self):\n \"The number of interior rings in this Polygon.\"\n return self.geom_count\n\n def __iter__(self):\n \"Iterates through each ring in the Polygon.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L628_C4", "label": "__len__", "type": "function", "loc": [628, 630], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L626_C0", "vector": [2, 1, 0.8535, 0.0041, 1, 0.1, 0.0, 76, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__len__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __len__(self):\n \"The number of interior rings in this Polygon.\"\n return self.geom_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L629_C8", "label": "expression", "type": "expression", "loc": [629, 629], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L628_C4", "vector": [8, 2, 0.8535, 0.0014, 2, 0.08, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"The number of interior rings in this Polygon.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L630_C8", "label": "return", "type": "return", "loc": [630, 630], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L628_C4", "vector": [13, 2, 0.8548, 0.0014, 2, 0.08, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.geom_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L632_C4", "label": "__iter__", "type": "function", "loc": [632, 635], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L626_C0", "vector": [2, 1, 0.8596, 0.0054, 1, 0.1, 0.125, 891, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n \"Iterates through each ring in the Polygon.\"\n for i in xrange(self.geom_count):\n yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L633_C8", "label": "expression", "type": "expression", "loc": [633, 633], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L632_C4", "vector": [8, 2, 0.8589, 0.0014, 2, 0.55, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Iterates through each ring in the Polygon.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:For_L634_C8", "label": "for i", "type": "for", "loc": [634, 635], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L632_C4", "vector": [6, 2, 0.8609, 0.0027, 2, 0.55, 1.0, 826, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange(self.geom_count):\n yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L635_C12", "label": "expression", "type": "expression", "loc": [635, 635], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:For_L634_C8", "vector": [8, 3, 0.8616, 0.0014, 3, 0.49, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L637_C4", "label": "__getitem__", "type": "function", "loc": [637, 642], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L626_C0", "vector": [2, 1, 0.8677, 0.0081, 1, 0.1, 0.25, 698, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "__getitem__", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getitem__(self, index):\n \"Gets the ring at the specified index.\"\n if index < 0 or index >= self.geom_count:\n raise OGRIndexError('index out of range: %s' % index)\n else:\n return OGRGeometry(capi.clone_geom(capi.get_geom_ref(self.ptr, index)), self.srs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L638_C8", "label": "expression", "type": "expression", "loc": [638, 638], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L637_C4", "vector": [8, 2, 0.8657, 0.0014, 2, 0.95, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Gets the ring at the specified index.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L639_C8", "label": "if", "type": "if", "loc": [639, 642], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L637_C4", "vector": [4, 2, 0.8691, 0.0054, 2, 0.95, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if index < 0 or index >= self.geom_count:\n raise OGRIndexError('index out of range: %s' % index)\n else:\n return OGRGeometry(capi.clone_geom(capi.get_geom_ref(self.ptr, index)), self.srs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L642_C12", "label": "return", "type": "return", "loc": [642, 642], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L639_C8", "vector": [13, 3, 0.8711, 0.0014, 3, 0.5, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return OGRGeometry(capi.clone_geom(capi.get_geom_ref(self.ptr, index)), self.srs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L646_C4", "label": "shell", "type": "function", "loc": [646, 648], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L626_C0", "vector": [2, 1, 0.8779, 0.0041, 1, 0.1, 0.375, 192, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "shell", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def shell(self):\n \"Returns the shell of this Polygon.\"\n return self[0] # First ring is the shell"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L647_C8", "label": "expression", "type": "expression", "loc": [647, 647], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L646_C4", "vector": [8, 2, 0.8779, 0.0014, 2, 0.02, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the shell of this Polygon.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L648_C8", "label": "return", "type": "return", "loc": [648, 648], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L646_C4", "vector": [13, 2, 0.8792, 0.0014, 2, 0.02, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self[0] # First ring is the shell"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L649_C4", "label": "exterior_ring =", "type": "assigned_variable", "loc": [649, 649], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L626_C0", "vector": [14, 1, 0.8806, 0.0014, 1, 0.1, 0.5, 988, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "exterior_ring", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " exterior_ring = shell"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L652_C4", "label": "tuple", "type": "function", "loc": [652, 654], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L626_C0", "vector": [2, 1, 0.886, 0.0041, 1, 0.1, 0.625, 259, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "tuple", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def tuple(self):\n \"Returns a tuple of LinearRing coordinate tuples.\"\n return tuple([self[i].tuple for i in xrange(self.geom_count)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L653_C8", "label": "expression", "type": "expression", "loc": [653, 653], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L652_C4", "vector": [8, 2, 0.886, 0.0014, 2, 0.63, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a tuple of LinearRing coordinate tuples.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L654_C8", "label": "return", "type": "return", "loc": [654, 654], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L652_C4", "vector": [13, 2, 0.8874, 0.0014, 2, 0.63, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return tuple([self[i].tuple for i in xrange(self.geom_count)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L655_C4", "label": "coords =", "type": "assigned_variable", "loc": [655, 655], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L626_C0", "vector": [14, 1, 0.8887, 0.0014, 1, 0.1, 0.75, 216, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "coords", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " coords = tuple"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L658_C4", "label": "point_count", "type": "function", "loc": [658, 661], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L626_C0", "vector": [2, 1, 0.8948, 0.0054, 1, 0.1, 0.875, 963, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "point_count", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def point_count(self):\n \"The number of Points in this Polygon.\"\n # Summing up the number of points in each ring of the Polygon.\n return sum([self[i].point_count for i in xrange(self.geom_count)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L659_C8", "label": "expression", "type": "expression", "loc": [659, 659], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L658_C4", "vector": [8, 2, 0.8942, 0.0014, 2, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"The number of Points in this Polygon.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L661_C8", "label": "return", "type": "return", "loc": [661, 661], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L658_C4", "vector": [13, 2, 0.8969, 0.0014, 2, 0.49, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sum([self[i].point_count for i in xrange(self.geom_count)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L664_C4", "label": "centroid", "type": "function", "loc": [664, 669], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L626_C0", "vector": [2, 1, 0.9043, 0.0081, 1, 0.1, 1.0, 439, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "centroid", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def centroid(self):\n \"Returns the centroid (a Point) of this Polygon.\"\n # The centroid is a Point, create a geometry for this.\n p = OGRGeometry(OGRGeomType('Point'))\n capi.get_centroid(self.ptr, p.ptr)\n return p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L665_C8", "label": "expression", "type": "expression", "loc": [665, 665], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L664_C4", "vector": [8, 2, 0.9023, 0.0014, 2, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the centroid (a Point) of this Polygon.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L667_C8", "label": "p = OGRGeometry()", "type": "assigned_variable", "loc": [667, 667], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L664_C4", "vector": [14, 2, 0.905, 0.0014, 2, 0.05, 0.3333, 491, 3, 1, 0, 0, 488, 10, 2], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "OGRGeometry", "annotation": ""}, "snippet": " p = OGRGeometry(OGRGeomType('Point'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L668_C8", "label": "get_centroid()", "type": "expression", "loc": [668, 668], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L664_C4", "vector": [8, 2, 0.9064, 0.0014, 2, 0.05, 0.6667, 212, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "get_centroid", "arg_names": [], "import_names": [], "rhs_call_name": "get_centroid", "annotation": ""}, "snippet": " capi.get_centroid(self.ptr, p.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L669_C8", "label": "return", "type": "return", "loc": [669, 669], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L664_C4", "vector": [13, 2, 0.9077, 0.0014, 2, 0.05, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L672_C0", "label": "GeometryCollection", "type": "class", "loc": [672, 714], "level": 0, "parent": null, "vector": [3, 0, 0.9403, 0.0583, 0, 0.66, 0.8095, 918, 0, 6, 0, 0, 488, 0, 17], "semantic": {"name": "GeometryCollection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GeometryCollection(OGRGeometry):\n \"The Geometry Collection class.\"\n\n def __getitem__(self, index):\n \"Gets the Geometry at the specified index.\"\n if index < 0 or index >= self.geom_count:\n raise OGRIndexError('index out of range: %s' % index)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L673_C4", "label": "expression", "type": "expression", "loc": [673, 673], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L672_C0", "vector": [8, 1, 0.9132, 0.0014, 1, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"The Geometry Collection class.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L675_C4", "label": "__getitem__", "type": "function", "loc": [675, 680], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L672_C0", "vector": [2, 1, 0.9193, 0.0081, 1, 0.43, 0.1429, 698, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "__getitem__", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getitem__(self, index):\n \"Gets the Geometry at the specified index.\"\n if index < 0 or index >= self.geom_count:\n raise OGRIndexError('index out of range: %s' % index)\n else:\n return OGRGeometry(capi.clone_geom(capi.get_geom_ref(self.ptr, index)), self.srs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L676_C8", "label": "expression", "type": "expression", "loc": [676, 676], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L675_C4", "vector": [8, 2, 0.9172, 0.0014, 2, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Gets the Geometry at the specified index.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L677_C8", "label": "if", "type": "if", "loc": [677, 680], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L675_C4", "vector": [4, 2, 0.9206, 0.0054, 2, 0.45, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if index < 0 or index >= self.geom_count:\n raise OGRIndexError('index out of range: %s' % index)\n else:\n return OGRGeometry(capi.clone_geom(capi.get_geom_ref(self.ptr, index)), self.srs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L680_C12", "label": "return", "type": "return", "loc": [680, 680], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L677_C8", "vector": [13, 3, 0.9227, 0.0014, 3, 0.24, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return OGRGeometry(capi.clone_geom(capi.get_geom_ref(self.ptr, index)), self.srs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L682_C4", "label": "__iter__", "type": "function", "loc": [682, 685], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L672_C0", "vector": [2, 1, 0.9274, 0.0054, 1, 0.43, 0.2857, 891, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n \"Iterates over each Geometry.\"\n for i in xrange(self.geom_count):\n yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L683_C8", "label": "expression", "type": "expression", "loc": [683, 683], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L682_C4", "vector": [8, 2, 0.9267, 0.0014, 2, 0.97, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Iterates over each Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:For_L684_C8", "label": "for i", "type": "for", "loc": [684, 685], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L682_C4", "vector": [6, 2, 0.9288, 0.0027, 2, 0.97, 1.0, 826, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange(self.geom_count):\n yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L685_C12", "label": "expression", "type": "expression", "loc": [685, 685], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:For_L684_C8", "vector": [8, 3, 0.9294, 0.0014, 3, 0.74, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L687_C4", "label": "__len__", "type": "function", "loc": [687, 689], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L672_C0", "vector": [2, 1, 0.9335, 0.0041, 1, 0.43, 0.4286, 76, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__len__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __len__(self):\n \"The number of geometries in this Geometry Collection.\"\n return self.geom_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L688_C8", "label": "expression", "type": "expression", "loc": [688, 688], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L687_C4", "vector": [8, 2, 0.9335, 0.0014, 2, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"The number of geometries in this Geometry Collection.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L689_C8", "label": "return", "type": "return", "loc": [689, 689], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L687_C4", "vector": [13, 2, 0.9349, 0.0014, 2, 0.05, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.geom_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L691_C4", "label": "add", "type": "function", "loc": [691, 702], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L672_C0", "vector": [2, 1, 0.945, 0.0163, 1, 0.43, 0.5714, 241, 0, 2, 0, 0, 0, 0, 8], "semantic": {"name": "add", "arg_names": ["self", "geom"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add(self, geom):\n \"Add the geometry to this Geometry Collection.\"\n if isinstance(geom, OGRGeometry):\n if isinstance(geom, self.__class__):\n for g in geom: capi.add_geom(self.ptr, g.ptr)\n else:\n capi.add_geom(self.ptr, geom.ptr)\n elif isinstance(geom, basestring):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L692_C8", "label": "expression", "type": "expression", "loc": [692, 692], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L691_C4", "vector": [8, 2, 0.9389, 0.0014, 2, 0.89, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Add the geometry to this Geometry Collection.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L693_C8", "label": "if", "type": "if", "loc": [693, 702], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L691_C4", "vector": [4, 2, 0.9464, 0.0136, 2, 0.89, 1.0, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(geom, OGRGeometry):\n if isinstance(geom, self.__class__):\n for g in geom: capi.add_geom(self.ptr, g.ptr)\n else:\n capi.add_geom(self.ptr, geom.ptr)\n elif isinstance(geom, basestring):\n tmp = OGRGeometry(geom)\n capi.add_geom(self.ptr, tmp.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L694_C12", "label": "if", "type": "if", "loc": [694, 697], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L693_C8", "vector": [4, 3, 0.9437, 0.0054, 3, 0.68, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(geom, self.__class__):\n for g in geom: capi.add_geom(self.ptr, g.ptr)\n else:\n capi.add_geom(self.ptr, geom.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:For_L695_C16", "label": "for g", "type": "for", "loc": [695, 695], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L694_C12", "vector": [6, 4, 0.943, 0.0014, 4, 0.15, 0.0, 384, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "g", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for g in geom: capi.add_geom(self.ptr, g.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L695_C31", "label": "add_geom()", "type": "expression", "loc": [695, 695], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:For_L695_C16", "vector": [8, 5, 0.943, 0.0014, 5, 0.56, 0.0, 959, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "add_geom", "arg_names": [], "import_names": [], "rhs_call_name": "add_geom", "annotation": ""}, "snippet": " for g in geom: capi.add_geom(self.ptr, g.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L697_C16", "label": "add_geom()", "type": "expression", "loc": [697, 697], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L694_C12", "vector": [8, 4, 0.9457, 0.0014, 4, 0.15, 1.0, 959, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "add_geom", "arg_names": [], "import_names": [], "rhs_call_name": "add_geom", "annotation": ""}, "snippet": " capi.add_geom(self.ptr, geom.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L698_C8", "label": "if", "type": "if", "loc": [698, 702], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L693_C8", "vector": [4, 3, 0.9498, 0.0068, 3, 0.68, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(geom, basestring):\n tmp = OGRGeometry(geom)\n capi.add_geom(self.ptr, tmp.ptr)\n else:\n raise OGRException('Must add an OGRGeometry.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L699_C12", "label": "tmp = OGRGeometry()", "type": "assigned_variable", "loc": [699, 699], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L698_C8", "vector": [14, 4, 0.9484, 0.0014, 4, 0.79, 0.0, 517, 3, 1, 0, 0, 488, 10, 1], "semantic": {"name": "tmp", "arg_names": [], "import_names": [], "rhs_call_name": "OGRGeometry", "annotation": ""}, "snippet": " tmp = OGRGeometry(geom)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L700_C12", "label": "add_geom()", "type": "expression", "loc": [700, 700], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L698_C8", "vector": [8, 4, 0.9498, 0.0014, 4, 0.79, 1.0, 959, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "add_geom", "arg_names": [], "import_names": [], "rhs_call_name": "add_geom", "annotation": ""}, "snippet": " capi.add_geom(self.ptr, tmp.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L705_C4", "label": "point_count", "type": "function", "loc": [705, 708], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L672_C0", "vector": [2, 1, 0.9586, 0.0054, 1, 0.43, 0.7143, 963, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "point_count", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def point_count(self):\n \"The number of Points in this Geometry Collection.\"\n # Summing up the number of points in each geometry in this collection\n return sum([self[i].point_count for i in xrange(self.geom_count)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L706_C8", "label": "expression", "type": "expression", "loc": [706, 706], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L705_C4", "vector": [8, 2, 0.9579, 0.0014, 2, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"The number of Points in this Geometry Collection.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L708_C8", "label": "return", "type": "return", "loc": [708, 708], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L705_C4", "vector": [13, 2, 0.9607, 0.0014, 2, 0.05, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sum([self[i].point_count for i in xrange(self.geom_count)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L711_C4", "label": "tuple", "type": "function", "loc": [711, 713], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L672_C0", "vector": [2, 1, 0.9661, 0.0041, 1, 0.43, 0.8571, 259, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "tuple", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def tuple(self):\n \"Returns a tuple representation of this Geometry Collection.\"\n return tuple([self[i].tuple for i in xrange(self.geom_count)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L712_C8", "label": "expression", "type": "expression", "loc": [712, 712], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L711_C4", "vector": [8, 2, 0.9661, 0.0014, 2, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a tuple representation of this Geometry Collection.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L713_C8", "label": "return", "type": "return", "loc": [713, 713], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L711_C4", "vector": [13, 2, 0.9674, 0.0014, 2, 0.38, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return tuple([self[i].tuple for i in xrange(self.geom_count)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L714_C4", "label": "coords =", "type": "assigned_variable", "loc": [714, 714], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L672_C0", "vector": [14, 1, 0.9688, 0.0014, 1, 0.43, 1.0, 216, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "coords", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " coords = tuple"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L717_C0", "label": "MultiPoint", "type": "class", "loc": [717, 717], "level": 0, "parent": null, "vector": [3, 0, 0.9729, 0.0014, 0, 0.66, 0.8571, 493, 0, 0, 0, 0, 918, 0, 0], "semantic": {"name": "MultiPoint", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MultiPoint(GeometryCollection): pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L718_C0", "label": "MultiLineString", "type": "class", "loc": [718, 718], "level": 0, "parent": null, "vector": [3, 0, 0.9742, 0.0014, 0, 0.66, 0.9048, 278, 0, 0, 0, 0, 918, 0, 0], "semantic": {"name": "MultiLineString", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MultiLineString(GeometryCollection): pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L719_C0", "label": "MultiPolygon", "type": "class", "loc": [719, 719], "level": 0, "parent": null, "vector": [3, 0, 0.9756, 0.0014, 0, 0.66, 0.9524, 911, 0, 0, 0, 0, 918, 0, 0], "semantic": {"name": "MultiPolygon", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MultiPolygon(GeometryCollection): pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L722_C0", "label": "GEO_CLASSES =", "type": "assigned_variable", "loc": [722, 737], "level": 0, "parent": null, "vector": [14, 0, 0.9898, 0.0217, 0, 0.66, 1.0, 80, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "GEO_CLASSES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "GEO_CLASSES = {1 : Point,\n 2 : LineString,\n 3 : Polygon,\n 4 : MultiPoint,\n 5 : MultiLineString,\n 6 : MultiPolygon,\n 7 : GeometryCollection,\n 101: LinearRing,"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L75_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L76_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L75_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L77_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L80_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L82_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L82_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L84_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L80_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L86_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L80_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L87_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L80_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L88_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L88_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L89_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L89_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L91_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L88_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L92_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L92_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L95_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L92_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L96_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L92_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L98_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L88_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L99_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L99_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L100_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L100_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L101_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L99_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L107_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L99_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L108_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L80_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L109_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L111_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L109_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L112_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L114_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L112_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L115_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L117_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L128_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L128_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L135_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L135_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L138_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L140_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L141_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L140_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L143_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L167_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L172_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L173_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L172_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L174_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L177_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L177_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L178_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L177_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L181_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L182_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L181_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L183_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L184_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L183_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L186_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L192_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L194_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L199_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L203_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L204_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L204_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L210_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L210_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L211_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L212_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L214_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L214_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L215_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L214_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L216_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L214_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L218_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L220_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L223_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L223_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L224_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L223_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L225_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L228_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L228_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L229_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L228_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L230_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L233_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L233_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L234_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L233_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L235_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L238_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L238_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L239_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L238_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L243_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L244_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L243_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L245_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L248_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L248_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L249_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L248_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L250_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L253_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L254_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L255_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L258_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L258_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L259_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L258_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L261_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L264_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L264_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L265_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L264_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L266_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L271_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L271_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L272_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L271_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Try_L273_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:Try_L273_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L274_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:Try_L273_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L275_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:Try_L273_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L277_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L279_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L280_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L285_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L285_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L286_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L285_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L287_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L287_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L288_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L287_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L289_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L292_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L294_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L297_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L297_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L298_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L297_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L299_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L299_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L299_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L297_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L300_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L302_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L303_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L303_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L304_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L308_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L312_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L312_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L313_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L312_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:ImportFrom_L314_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L312_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L315_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L318_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L318_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L319_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L318_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L320_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L323_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L323_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L324_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L323_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L325_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L329_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L329_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L330_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L329_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L334_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L334_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L335_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L338_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L341_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L341_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L342_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L341_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L343_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L343_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L344_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L349_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L349_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L350_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L349_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L351_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L354_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L354_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L355_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L354_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L356_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L356_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L357_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L356_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L359_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L354_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L360_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L354_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L362_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L354_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L363_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L354_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L365_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L368_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L368_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L369_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L368_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L370_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L373_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L373_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L374_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L373_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L375_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L373_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L376_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L376_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L377_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L376_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L379_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L382_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L382_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L383_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L382_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L384_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L386_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L386_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L387_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L386_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L393_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L395_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L395_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L396_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L395_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L404_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L404_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L405_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L404_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L406_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L404_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L407_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L395_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L414_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L414_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L415_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L395_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L419_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L420_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L421_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L421_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L422_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L421_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L423_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L423_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L424_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L423_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L425_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L395_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L431_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L431_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L432_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L432_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:For_L436_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:For_L436_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L437_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:For_L436_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L438_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L438_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L439_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L432_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L441_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L441_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L442_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L444_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L444_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L445_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L444_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L446_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L449_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L449_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L450_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L449_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L452_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L449_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L457_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L459_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L459_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L460_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L459_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L461_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L463_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L463_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L464_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L463_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L465_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L467_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L467_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L468_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L467_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L469_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L471_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L471_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L472_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L471_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L473_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L475_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L475_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L476_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L475_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L477_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L479_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L479_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L480_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L479_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L481_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L483_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L483_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L484_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L483_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L485_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L487_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L487_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L488_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L487_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L489_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L492_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L493_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L494_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L494_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L495_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L494_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L497_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L500_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L500_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L501_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L500_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L502_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L505_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L505_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L506_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L505_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L510_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L512_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L512_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L513_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L512_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L517_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L519_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L519_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L520_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L519_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L524_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L526_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L526_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L527_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L526_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L531_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L533_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L533_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L534_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L533_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L538_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L541_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L544_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L544_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L545_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L544_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L546_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L541_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L549_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L549_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L550_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L549_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L551_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L541_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L554_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L554_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L555_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L554_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L556_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L556_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L557_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L541_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L560_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L560_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L561_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L560_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L562_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L562_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L563_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L562_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L564_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L564_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L565_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L541_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L566_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L568_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L570_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L570_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L571_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L570_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L572_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L572_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L573_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L572_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L574_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L572_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L575_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L572_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L576_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L576_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L577_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L576_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L578_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L578_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L579_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L578_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L580_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L580_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L581_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L568_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L585_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L585_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L586_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L585_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:For_L587_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:For_L587_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L588_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L568_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L590_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L590_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L591_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L590_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L592_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L568_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L595_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L595_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L596_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L595_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L597_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L568_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L598_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L568_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L600_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L600_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L601_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L600_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L605_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L568_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L608_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L608_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L609_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L608_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L610_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L568_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L613_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L613_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L614_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L613_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L615_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L568_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L618_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L618_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L619_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L618_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L620_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L620_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L621_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L626_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L628_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L628_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L629_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L628_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L630_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L626_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L632_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L632_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L633_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L632_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:For_L634_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:For_L634_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L635_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L626_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L637_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L637_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L638_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L637_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L639_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L639_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L642_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L626_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L646_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L646_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L647_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L646_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L648_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L626_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L649_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L626_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L652_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L652_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L653_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L652_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L654_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L626_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L655_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L626_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L658_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L658_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L659_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L658_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L661_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L626_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L664_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L664_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L665_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L664_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L667_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L664_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L668_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L664_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L669_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L672_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L673_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L672_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L675_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L675_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L676_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L675_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L677_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L677_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L680_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L672_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L682_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L682_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L683_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L682_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:For_L684_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:For_L684_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L685_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L672_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L687_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L687_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L688_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L687_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L689_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L672_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L691_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L691_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L692_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L691_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L693_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L693_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L694_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L694_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:For_L695_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:For_L695_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L695_C31"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L694_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L697_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L693_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L698_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L698_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L699_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:If_L698_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L700_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L672_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L705_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L705_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L706_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L705_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L708_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L672_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L711_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L711_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L712_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:FunctionDef_L711_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Return_L713_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L672_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Assign_L714_C4"}] |
import os, re, sys
from ctypes import c_char_p, CDLL
from ctypes.util import find_library
from django.contrib.gis.gdal.error import OGRException
# Custom library path set?
try:
from django.conf import settings
lib_path = settings.GDAL_LIBRARY_PATH
except (AttributeError, EnvironmentError, ImportError):
lib_path = None
if lib_path:
lib_names = None
elif os.name == 'nt':
# Windows NT shared library
lib_names = ['gdal17', 'gdal16', 'gdal15']
elif os.name == 'posix':
# *NIX library names.
lib_names = ['gdal', 'GDAL', 'gdal1.7.0', 'gdal1.6.0', 'gdal1.5.0', 'gdal1.4.0']
else:
raise OGRException('Unsupported OS "%s"' % os.name)
# Using the ctypes `find_library` utility to find the
# path to the GDAL library from the list of library names.
if lib_names:
for lib_name in lib_names:
lib_path = find_library(lib_name)
if not lib_path is None: break
if lib_path is None:
raise OGRException('Could not find the GDAL library (tried "%s"). '
'Try setting GDAL_LIBRARY_PATH in your settings.' %
'", "'.join(lib_names))
# This loads the GDAL/OGR C library
lgdal = CDLL(lib_path)
# On Windows, the GDAL binaries have some OSR routines exported with
# STDCALL, while others are not. Thus, the library will also need to
# be loaded up as WinDLL for said OSR functions that require the
# different calling convention.
if os.name == 'nt':
from ctypes import WinDLL
lwingdal = WinDLL(lib_path)
def std_call(func):
"""
Returns the correct STDCALL function for certain OSR routines on Win32
platforms.
"""
if os.name == 'nt':
return lwingdal[func]
else:
return lgdal[func]
#### Version-information functions. ####
# Returns GDAL library version information with the given key.
_version_info = std_call('GDALVersionInfo')
_version_info.argtypes = [c_char_p]
_version_info.restype = c_char_p
def gdal_version():
"Returns only the GDAL version number information."
return _version_info('RELEASE_NAME')
def gdal_full_version():
"Returns the full GDAL version information."
return _version_info('')
def gdal_release_date(date=False):
"""
Returns the release date in a string format, e.g, "2007/06/27".
If the date keyword argument is set to True, a Python datetime object
will be returned instead.
"""
from datetime import date as date_type
rel = _version_info('RELEASE_DATE')
yy, mm, dd = map(int, (rel[0:4], rel[4:6], rel[6:8]))
d = date_type(yy, mm, dd)
if date: return d
else: return d.strftime('%Y/%m/%d')
version_regex = re.compile(r'^(?P<major>\d+)\.(?P<minor>\d+)(\.(?P<subminor>\d+))?')
def gdal_version_info():
ver = gdal_version()
m = version_regex.match(ver)
if not m: raise OGRException('Could not parse GDAL version string "%s"' % ver)
return dict([(key, m.group(key)) for key in ('major', 'minor', 'subminor')])
_verinfo = gdal_version_info()
GDAL_MAJOR_VERSION = int(_verinfo['major'])
GDAL_MINOR_VERSION = int(_verinfo['minor'])
GDAL_SUBMINOR_VERSION = _verinfo['subminor'] and int(_verinfo['subminor'])
GDAL_VERSION = (GDAL_MAJOR_VERSION, GDAL_MINOR_VERSION, GDAL_SUBMINOR_VERSION)
del _verinfo
# GeoJSON support is available only in GDAL 1.5+.
if GDAL_VERSION >= (1, 5):
GEOJSON = True
else:
GEOJSON = False
| ajibawa-2023/Python-Code-Large/train/row_98710 | 60 | 104 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Import_L1_C0", "label": "os import os, re, sys", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0096, 0.0096, 0, 0.66, 0.0, 688, 0, 3, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "re", "sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os, re, sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:ImportFrom_L2_C0", "label": "from ctypes import c_char_p, CDLL", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0192, 0.0096, 0, 0.66, 0.0417, 182, 0, 2, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_char_p", "CDLL"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import c_char_p, CDLL"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:ImportFrom_L3_C0", "label": "from ctypes.util import find_library", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0288, 0.0096, 0, 0.66, 0.0833, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "ctypes.util", "arg_names": [], "import_names": ["find_library"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes.util import find_library"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:ImportFrom_L4_C0", "label": "from django.contrib.gis.gdal.error import OGRException", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0385, 0.0096, 0, 0.66, 0.125, 76, 0, 1, 0, 0, 76, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.error", "arg_names": [], "import_names": ["OGRException"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.error import OGRException"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Try_L7_C0", "label": "try", "type": "try", "loc": [7, 11], "level": 0, "parent": null, "vector": [7, 0, 0.0865, 0.0481, 0, 0.66, 0.1667, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from django.conf import settings\n lib_path = settings.GDAL_LIBRARY_PATH\nexcept (AttributeError, EnvironmentError, ImportError):\n lib_path = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:ImportFrom_L8_C4", "label": "from django.conf import settings", "type": "import", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:Try_L7_C0", "vector": [1, 1, 0.0769, 0.0096, 1, 0.63, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L9_C4", "label": "lib_path =", "type": "assigned_variable", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:Try_L7_C0", "vector": [14, 1, 0.0865, 0.0096, 1, 0.63, 1.0, 563, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "lib_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lib_path = settings.GDAL_LIBRARY_PATH"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L11_C4", "label": "lib_path =", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:Try_L7_C0", "vector": [14, 1, 0.1058, 0.0096, 1, 0.63, 0.0, 563, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "lib_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lib_path = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L13_C0", "label": "if", "type": "if", "loc": [13, 22], "level": 0, "parent": null, "vector": [4, 0, 0.1683, 0.0962, 0, 0.66, 0.2083, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if lib_path:\n lib_names = None\nelif os.name == 'nt':\n # Windows NT shared library\n lib_names = ['gdal17', 'gdal16', 'gdal15']\nelif os.name == 'posix':\n # *NIX library names.\n lib_names = ['gdal', 'GDAL', 'gdal1.7.0', 'gdal1.6.0', 'gdal1.5.0', 'gdal1.4.0']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L14_C4", "label": "lib_names =", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L13_C0", "vector": [14, 1, 0.1346, 0.0096, 1, 0.75, 0.0, 652, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "lib_names", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lib_names = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L15_C0", "label": "if", "type": "if", "loc": [15, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L13_C0", "vector": [4, 1, 0.1779, 0.0769, 1, 0.75, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "elif os.name == 'nt':\n # Windows NT shared library\n lib_names = ['gdal17', 'gdal16', 'gdal15']\nelif os.name == 'posix':\n # *NIX library names.\n lib_names = ['gdal', 'GDAL', 'gdal1.7.0', 'gdal1.6.0', 'gdal1.5.0', 'gdal1.4.0']\nelse:\n raise OGRException('Unsupported OS \"%s\"' % os.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L17_C4", "label": "lib_names =", "type": "assigned_variable", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L15_C0", "vector": [14, 2, 0.1635, 0.0096, 2, 0.75, 0.0, 652, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "lib_names", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lib_names = ['gdal17', 'gdal16', 'gdal15']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L18_C0", "label": "if", "type": "if", "loc": [18, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L15_C0", "vector": [4, 2, 0.1923, 0.0481, 2, 0.75, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "elif os.name == 'posix':\n # *NIX library names.\n lib_names = ['gdal', 'GDAL', 'gdal1.7.0', 'gdal1.6.0', 'gdal1.5.0', 'gdal1.4.0']\nelse:\n raise OGRException('Unsupported OS \"%s\"' % os.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L20_C4", "label": "lib_names =", "type": "assigned_variable", "loc": [20, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L18_C0", "vector": [14, 3, 0.1923, 0.0096, 3, 0.2, 0.0, 652, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "lib_names", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lib_names = ['gdal', 'GDAL', 'gdal1.7.0', 'gdal1.6.0', 'gdal1.5.0', 'gdal1.4.0']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L26_C0", "label": "if", "type": "if", "loc": [26, 29], "level": 0, "parent": null, "vector": [4, 0, 0.2644, 0.0385, 0, 0.66, 0.25, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if lib_names:\n for lib_name in lib_names:\n lib_path = find_library(lib_name)\n if not lib_path is None: break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:For_L27_C4", "label": "for lib_name", "type": "for", "loc": [27, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L26_C0", "vector": [6, 1, 0.2692, 0.0288, 1, 0.18, 0.0, 613, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "lib_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for lib_name in lib_names:\n lib_path = find_library(lib_name)\n if not lib_path is None: break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L28_C8", "label": "lib_path = find_library()", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:For_L27_C4", "vector": [14, 2, 0.2692, 0.0096, 2, 0.55, 0.0, 563, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "lib_path", "arg_names": [], "import_names": [], "rhs_call_name": "find_library", "annotation": ""}, "snippet": " lib_path = find_library(lib_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L29_C8", "label": "if", "type": "if", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:For_L27_C4", "vector": [4, 2, 0.2788, 0.0096, 2, 0.55, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not lib_path is None: break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L31_C0", "label": "if", "type": "if", "loc": [31, 34], "level": 0, "parent": null, "vector": [4, 0, 0.3125, 0.0385, 0, 0.66, 0.2917, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if lib_path is None:\n raise OGRException('Could not find the GDAL library (tried \"%s\"). '\n 'Try setting GDAL_LIBRARY_PATH in your settings.' % \n '\", \"'.join(lib_names))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L37_C0", "label": "lgdal = CDLL()", "type": "assigned_variable", "loc": [37, 37], "level": 0, "parent": null, "vector": [14, 0, 0.3558, 0.0096, 0, 0.66, 0.3333, 93, 3, 1, 0, 0, 453, 10, 1], "semantic": {"name": "lgdal", "arg_names": [], "import_names": [], "rhs_call_name": "CDLL", "annotation": ""}, "snippet": "lgdal = CDLL(lib_path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L43_C0", "label": "if", "type": "if", "loc": [43, 45], "level": 0, "parent": null, "vector": [4, 0, 0.4231, 0.0288, 0, 0.66, 0.375, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if os.name == 'nt':\n from ctypes import WinDLL\n lwingdal = WinDLL(lib_path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:ImportFrom_L44_C4", "label": "from ctypes import WinDLL", "type": "import", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L43_C0", "vector": [1, 1, 0.4231, 0.0096, 1, 0.94, 0.0, 182, 0, 1, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["WinDLL"], "rhs_call_name": "", "annotation": ""}, "snippet": " from ctypes import WinDLL"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L45_C4", "label": "lwingdal = WinDLL()", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L43_C0", "vector": [14, 1, 0.4327, 0.0096, 1, 0.94, 1.0, 304, 3, 1, 0, 0, 746, 10, 1], "semantic": {"name": "lwingdal", "arg_names": [], "import_names": [], "rhs_call_name": "WinDLL", "annotation": ""}, "snippet": " lwingdal = WinDLL(lib_path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L47_C0", "label": "std_call", "type": "function", "loc": [47, 55], "level": 0, "parent": null, "vector": [2, 0, 0.4904, 0.0865, 0, 0.66, 0.4167, 325, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "std_call", "arg_names": ["func"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def std_call(func):\n \"\"\"\n Returns the correct STDCALL function for certain OSR routines on Win32\n platforms.\n \"\"\"\n if os.name == 'nt':\n return lwingdal[func]\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Expr_L48_C4", "label": "expression", "type": "expression", "loc": [48, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L47_C0", "vector": [8, 1, 0.476, 0.0385, 1, 0.06, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the correct STDCALL function for certain OSR routines on Win32\n platforms.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L52_C4", "label": "if", "type": "if", "loc": [52, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L47_C0", "vector": [4, 1, 0.5144, 0.0385, 1, 0.06, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.name == 'nt':\n return lwingdal[func]\n else:\n return lgdal[func]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Return_L53_C8", "label": "return", "type": "return", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L52_C4", "vector": [13, 2, 0.5096, 0.0096, 2, 0.32, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return lwingdal[func]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Return_L55_C8", "label": "return", "type": "return", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L52_C4", "vector": [13, 2, 0.5288, 0.0096, 2, 0.32, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return lgdal[func]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L60_C0", "label": "_version_info = std_call()", "type": "assigned_variable", "loc": [60, 60], "level": 0, "parent": null, "vector": [14, 0, 0.5769, 0.0096, 0, 0.66, 0.4583, 749, 3, 1, 0, 0, 325, 10, 1], "semantic": {"name": "_version_info", "arg_names": [], "import_names": [], "rhs_call_name": "std_call", "annotation": ""}, "snippet": "_version_info = std_call('GDALVersionInfo')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L61_C0", "label": "_version_info.argtypes =", "type": "assigned_variable", "loc": [61, 61], "level": 0, "parent": null, "vector": [14, 0, 0.5865, 0.0096, 0, 0.66, 0.5, 251, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "_version_info.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_version_info.argtypes = [c_char_p]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L62_C0", "label": "_version_info.restype =", "type": "assigned_variable", "loc": [62, 62], "level": 0, "parent": null, "vector": [14, 0, 0.5962, 0.0096, 0, 0.66, 0.5417, 379, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_version_info.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_version_info.restype = c_char_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L64_C0", "label": "gdal_version", "type": "function", "loc": [64, 66], "level": 0, "parent": null, "vector": [2, 0, 0.625, 0.0288, 0, 0.66, 0.5833, 73, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "gdal_version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def gdal_version():\n \"Returns only the GDAL version number information.\"\n return _version_info('RELEASE_NAME')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Expr_L65_C4", "label": "expression", "type": "expression", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L64_C0", "vector": [8, 1, 0.625, 0.0096, 1, 0.31, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns only the GDAL version number information.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Return_L66_C4", "label": "return", "type": "return", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L64_C0", "vector": [13, 1, 0.6346, 0.0096, 1, 0.31, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _version_info('RELEASE_NAME')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L68_C0", "label": "gdal_full_version", "type": "function", "loc": [68, 70], "level": 0, "parent": null, "vector": [2, 0, 0.6635, 0.0288, 0, 0.66, 0.625, 870, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "gdal_full_version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def gdal_full_version(): \n \"Returns the full GDAL version information.\"\n return _version_info('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Expr_L69_C4", "label": "expression", "type": "expression", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L68_C0", "vector": [8, 1, 0.6635, 0.0096, 1, 0.36, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the full GDAL version information.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Return_L70_C4", "label": "return", "type": "return", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L68_C0", "vector": [13, 1, 0.6731, 0.0096, 1, 0.36, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _version_info('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L72_C0", "label": "gdal_release_date", "type": "function", "loc": [72, 83], "level": 0, "parent": null, "vector": [2, 0, 0.7452, 0.1154, 0, 0.66, 0.6667, 212, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "gdal_release_date", "arg_names": ["date"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def gdal_release_date(date=False): \n \"\"\"\n Returns the release date in a string format, e.g, \"2007/06/27\".\n If the date keyword argument is set to True, a Python datetime object\n will be returned instead.\n \"\"\"\n from datetime import date as date_type\n rel = _version_info('RELEASE_DATE')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Expr_L73_C4", "label": "expression", "type": "expression", "loc": [73, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L72_C0", "vector": [8, 1, 0.7212, 0.0481, 1, 0.77, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the release date in a string format, e.g, \"2007/06/27\".\n If the date keyword argument is set to True, a Python datetime object\n will be returned instead.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:ImportFrom_L78_C4", "label": "from datetime import date_type", "type": "import", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L72_C0", "vector": [1, 1, 0.75, 0.0096, 1, 0.77, 0.2, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["date_type"], "rhs_call_name": "", "annotation": ""}, "snippet": " from datetime import date as date_type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L79_C4", "label": "rel = _version_info()", "type": "assigned_variable", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L72_C0", "vector": [14, 1, 0.7596, 0.0096, 1, 0.77, 0.4, 773, 3, 1, 0, 0, 749, 10, 1], "semantic": {"name": "rel", "arg_names": [], "import_names": [], "rhs_call_name": "_version_info", "annotation": ""}, "snippet": " rel = _version_info('RELEASE_DATE')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L80_C4", "label": "yy, mm, dd = map()", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L72_C0", "vector": [14, 1, 0.7692, 0.0096, 1, 0.77, 0.6, 324, 3, 2, 0, 0, 53, 10, 1], "semantic": {"name": "yy, mm, dd", "arg_names": [], "import_names": [], "rhs_call_name": "map", "annotation": ""}, "snippet": " yy, mm, dd = map(int, (rel[0:4], rel[4:6], rel[6:8]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L81_C4", "label": "d = date_type()", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L72_C0", "vector": [14, 1, 0.7788, 0.0096, 1, 0.77, 0.8, 355, 3, 3, 0, 0, 101, 10, 1], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "date_type", "annotation": ""}, "snippet": " d = date_type(yy, mm, dd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L82_C4", "label": "if", "type": "if", "loc": [82, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L72_C0", "vector": [4, 1, 0.7933, 0.0192, 1, 0.77, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if date: return d\n else: return d.strftime('%Y/%m/%d')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Return_L82_C13", "label": "return", "type": "return", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L82_C4", "vector": [13, 2, 0.7885, 0.0096, 2, 0.84, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if date: return d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Return_L83_C10", "label": "return", "type": "return", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L82_C4", "vector": [13, 2, 0.7981, 0.0096, 2, 0.84, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " else: return d.strftime('%Y/%m/%d')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L85_C0", "label": "version_regex = compile()", "type": "assigned_variable", "loc": [85, 85], "level": 0, "parent": null, "vector": [14, 0, 0.8173, 0.0096, 0, 0.66, 0.7083, 866, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "version_regex", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "version_regex = re.compile(r'^(?P<major>\\d+)\\.(?P<minor>\\d+)(\\.(?P<subminor>\\d+))?')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L86_C0", "label": "gdal_version_info", "type": "function", "loc": [86, 90], "level": 0, "parent": null, "vector": [2, 0, 0.8462, 0.0481, 0, 0.66, 0.75, 550, 0, 0, 1, 0, 0, 0, 5], "semantic": {"name": "gdal_version_info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def gdal_version_info():\n ver = gdal_version()\n m = version_regex.match(ver)\n if not m: raise OGRException('Could not parse GDAL version string \"%s\"' % ver)\n return dict([(key, m.group(key)) for key in ('major', 'minor', 'subminor')])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L87_C4", "label": "ver = gdal_version()", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L86_C0", "vector": [14, 1, 0.8365, 0.0096, 1, 0.04, 0.0, 648, 3, 0, 0, 0, 73, 10, 1], "semantic": {"name": "ver", "arg_names": [], "import_names": [], "rhs_call_name": "gdal_version", "annotation": ""}, "snippet": " ver = gdal_version()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L88_C4", "label": "m = match()", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L86_C0", "vector": [14, 1, 0.8462, 0.0096, 1, 0.04, 0.3333, 711, 3, 1, 0, 0, 36, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " m = version_regex.match(ver)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L89_C4", "label": "if", "type": "if", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L86_C0", "vector": [4, 1, 0.8558, 0.0096, 1, 0.04, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not m: raise OGRException('Could not parse GDAL version string \"%s\"' % ver)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Return_L90_C4", "label": "return", "type": "return", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L86_C0", "vector": [13, 1, 0.8654, 0.0096, 1, 0.04, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict([(key, m.group(key)) for key in ('major', 'minor', 'subminor')])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L92_C0", "label": "_verinfo = gdal_version_info()", "type": "assigned_variable", "loc": [92, 92], "level": 0, "parent": null, "vector": [14, 0, 0.8846, 0.0096, 0, 0.66, 0.7917, 826, 3, 0, 0, 0, 550, 10, 1], "semantic": {"name": "_verinfo", "arg_names": [], "import_names": [], "rhs_call_name": "gdal_version_info", "annotation": ""}, "snippet": "_verinfo = gdal_version_info()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L93_C0", "label": "GDAL_MAJOR_VERSION = int()", "type": "assigned_variable", "loc": [93, 93], "level": 0, "parent": null, "vector": [14, 0, 0.8942, 0.0096, 0, 0.66, 0.8333, 85, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "GDAL_MAJOR_VERSION", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": "GDAL_MAJOR_VERSION = int(_verinfo['major'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L94_C0", "label": "GDAL_MINOR_VERSION = int()", "type": "assigned_variable", "loc": [94, 94], "level": 0, "parent": null, "vector": [14, 0, 0.9038, 0.0096, 0, 0.66, 0.875, 681, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "GDAL_MINOR_VERSION", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": "GDAL_MINOR_VERSION = int(_verinfo['minor'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L95_C0", "label": "GDAL_SUBMINOR_VERSION =", "type": "assigned_variable", "loc": [95, 95], "level": 0, "parent": null, "vector": [14, 0, 0.9135, 0.0096, 0, 0.66, 0.9167, 695, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "GDAL_SUBMINOR_VERSION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "GDAL_SUBMINOR_VERSION = _verinfo['subminor'] and int(_verinfo['subminor'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L96_C0", "label": "GDAL_VERSION =", "type": "assigned_variable", "loc": [96, 96], "level": 0, "parent": null, "vector": [14, 0, 0.9231, 0.0096, 0, 0.66, 0.9583, 115, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "GDAL_VERSION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "GDAL_VERSION = (GDAL_MAJOR_VERSION, GDAL_MINOR_VERSION, GDAL_SUBMINOR_VERSION)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L100_C0", "label": "if", "type": "if", "loc": [100, 103], "level": 0, "parent": null, "vector": [4, 0, 0.976, 0.0385, 0, 0.66, 1.0417, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if GDAL_VERSION >= (1, 5):\n GEOJSON = True\nelse:\n GEOJSON = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L101_C4", "label": "GEOJSON =", "type": "assigned_variable", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L100_C0", "vector": [14, 1, 0.9712, 0.0096, 1, 0.22, 0.0, 805, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "GEOJSON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " GEOJSON = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L103_C4", "label": "GEOJSON =", "type": "assigned_variable", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L100_C0", "vector": [14, 1, 0.9904, 0.0096, 1, 0.22, 1.0, 805, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "GEOJSON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " GEOJSON = False"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98710:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:ImportFrom_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L15_C0"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L18_C0"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:For_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:For_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:For_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:ImportFrom_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:Return_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:Return_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:Expr_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:Return_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:Return_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:Expr_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:ImportFrom_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:Return_L82_C13"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:Return_L83_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:FunctionDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:Return_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:If_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:Assign_L103_C4"}] |
# prerequisites imports
from ctypes import c_void_p
from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.error import OGRException
from django.contrib.gis.gdal.prototypes import ds as capi
# For more information, see the OGR C API source code:
# http://www.gdal.org/ogr/ogr__api_8h.html
#
# The OGR_Dr_* routines are relevant here.
class Driver(GDALBase):
"Wraps an OGR Data Source Driver."
# Case-insensitive aliases for OGR Drivers.
_alias = {'esri' : 'ESRI Shapefile',
'shp' : 'ESRI Shapefile',
'shape' : 'ESRI Shapefile',
'tiger' : 'TIGER',
'tiger/line' : 'TIGER',
}
def __init__(self, dr_input):
"Initializes an OGR driver on either a string or integer input."
if isinstance(dr_input, basestring):
# If a string name of the driver was passed in
self._register()
# Checking the alias dictionary (case-insensitive) to see if an alias
# exists for the given driver.
if dr_input.lower() in self._alias:
name = self._alias[dr_input.lower()]
else:
name = dr_input
# Attempting to get the OGR driver by the string name.
dr = capi.get_driver_by_name(name)
elif isinstance(dr_input, int):
self._register()
dr = capi.get_driver(dr_input)
elif isinstance(dr_input, c_void_p):
dr = dr_input
else:
raise OGRException('Unrecognized input type for OGR Driver: %s' % str(type(dr_input)))
# Making sure we get a valid pointer to the OGR Driver
if not dr:
raise OGRException('Could not initialize OGR Driver on input: %s' % str(dr_input))
self.ptr = dr
def __str__(self):
"Returns the string name of the OGR Driver."
return capi.get_driver_name(self.ptr)
def _register(self):
"Attempts to register all the data source drivers."
# Only register all if the driver count is 0 (or else all drivers
# will be registered over and over again)
if not self.driver_count: capi.register_all()
# Driver properties
@property
def driver_count(self):
"Returns the number of OGR data source drivers registered."
return capi.get_driver_count()
| ajibawa-2023/Python-Code-Large/train/row_98711 | 32 | 65 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98711:ImportFrom_L2_C0", "label": "from ctypes import c_void_p", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0308, 0.0154, 0, 0.66, 0.0, 182, 0, 1, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_void_p"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import c_void_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:ImportFrom_L3_C0", "label": "from django.contrib.gis.gdal.base import GDALBase", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0462, 0.0154, 0, 0.66, 0.25, 771, 0, 1, 0, 0, 771, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.base", "arg_names": [], "import_names": ["GDALBase"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.base import GDALBase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:ImportFrom_L4_C0", "label": "from django.contrib.gis.gdal.error import OGRException", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0615, 0.0154, 0, 0.66, 0.5, 76, 0, 1, 0, 0, 76, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.error", "arg_names": [], "import_names": ["OGRException"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.error import OGRException"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:ImportFrom_L5_C0", "label": "from django.contrib.gis.gdal.prototypes import capi", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0154, 0, 0.66, 0.75, 730, 0, 1, 0, 0, 730, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.prototypes", "arg_names": [], "import_names": ["capi"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.prototypes import ds as capi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:ClassDef_L11_C0", "label": "Driver", "type": "class", "loc": [11, 65], "level": 0, "parent": null, "vector": [3, 0, 0.5846, 0.8462, 0, 0.66, 1.0, 85, 0, 4, 0, 0, 436, 0, 17], "semantic": {"name": "Driver", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Driver(GDALBase):\n \"Wraps an OGR Data Source Driver.\"\n\n # Case-insensitive aliases for OGR Drivers.\n _alias = {'esri' : 'ESRI Shapefile',\n 'shp' : 'ESRI Shapefile',\n 'shape' : 'ESRI Shapefile',\n 'tiger' : 'TIGER',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:Expr_L12_C4", "label": "expression", "type": "expression", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:ClassDef_L11_C0", "vector": [8, 1, 0.1846, 0.0154, 1, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Wraps an OGR Data Source Driver.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:Assign_L15_C4", "label": "_alias =", "type": "assigned_variable", "loc": [15, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:ClassDef_L11_C0", "vector": [14, 1, 0.2692, 0.0923, 1, 0.73, 0.2, 813, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_alias", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _alias = {'esri' : 'ESRI Shapefile',\n 'shp' : 'ESRI Shapefile',\n 'shape' : 'ESRI Shapefile',\n 'tiger' : 'TIGER',\n 'tiger/line' : 'TIGER',\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L22_C4", "label": "__init__", "type": "function", "loc": [22, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:ClassDef_L11_C0", "vector": [2, 1, 0.5462, 0.4308, 1, 0.73, 0.4, 555, 0, 2, 0, 0, 0, 0, 14], "semantic": {"name": "__init__", "arg_names": ["self", "dr_input"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, dr_input):\n \"Initializes an OGR driver on either a string or integer input.\"\n\n if isinstance(dr_input, basestring):\n # If a string name of the driver was passed in\n self._register()\n\n # Checking the alias dictionary (case-insensitive) to see if an alias"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:Expr_L23_C8", "label": "expression", "type": "expression", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L22_C4", "vector": [8, 2, 0.3538, 0.0154, 2, 0.2, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Initializes an OGR driver on either a string or integer input.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L25_C8", "label": "if", "type": "if", "loc": [25, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L22_C4", "vector": [4, 2, 0.5308, 0.3077, 2, 0.2, 0.3333, 0, 3, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(dr_input, basestring):\n # If a string name of the driver was passed in\n self._register()\n\n # Checking the alias dictionary (case-insensitive) to see if an alias\n # exists for the given driver.\n if dr_input.lower() in self._alias:\n name = self._alias[dr_input.lower()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:Expr_L27_C12", "label": "_register()", "type": "expression", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L25_C8", "vector": [8, 3, 0.4154, 0.0154, 3, 0.24, 0.0, 711, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_register", "arg_names": [], "import_names": [], "rhs_call_name": "_register", "annotation": ""}, "snippet": " self._register()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L31_C12", "label": "if", "type": "if", "loc": [31, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L25_C8", "vector": [4, 3, 0.5, 0.0615, 3, 0.24, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if dr_input.lower() in self._alias:\n name = self._alias[dr_input.lower()]\n else:\n name = dr_input"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:Assign_L32_C16", "label": "name =", "type": "assigned_variable", "loc": [32, 32], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L31_C12", "vector": [14, 4, 0.4923, 0.0154, 4, 0.79, 0.0, 57, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = self._alias[dr_input.lower()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:Assign_L34_C16", "label": "name =", "type": "assigned_variable", "loc": [34, 34], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L31_C12", "vector": [14, 4, 0.5231, 0.0154, 4, 0.79, 1.0, 57, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = dr_input"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:Assign_L37_C12", "label": "dr = get_driver_by_name()", "type": "assigned_variable", "loc": [37, 37], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L25_C8", "vector": [14, 3, 0.5692, 0.0154, 3, 0.24, 0.6667, 537, 3, 1, 0, 0, 280, 10, 1], "semantic": {"name": "dr", "arg_names": [], "import_names": [], "rhs_call_name": "get_driver_by_name", "annotation": ""}, "snippet": " dr = capi.get_driver_by_name(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L38_C8", "label": "if", "type": "if", "loc": [38, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L25_C8", "vector": [4, 3, 0.6308, 0.1077, 3, 0.24, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(dr_input, int):\n self._register()\n dr = capi.get_driver(dr_input)\n elif isinstance(dr_input, c_void_p):\n dr = dr_input\n else:\n raise OGRException('Unrecognized input type for OGR Driver: %s' % str(type(dr_input)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:Expr_L39_C12", "label": "_register()", "type": "expression", "loc": [39, 39], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L38_C8", "vector": [8, 4, 0.6, 0.0154, 4, 0.89, 0.0, 711, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_register", "arg_names": [], "import_names": [], "rhs_call_name": "_register", "annotation": ""}, "snippet": " self._register()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:Assign_L40_C12", "label": "dr = get_driver()", "type": "assigned_variable", "loc": [40, 40], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L38_C8", "vector": [14, 4, 0.6154, 0.0154, 4, 0.89, 0.5, 537, 3, 1, 0, 0, 958, 10, 1], "semantic": {"name": "dr", "arg_names": [], "import_names": [], "rhs_call_name": "get_driver", "annotation": ""}, "snippet": " dr = capi.get_driver(dr_input)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L41_C8", "label": "if", "type": "if", "loc": [41, 44], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L38_C8", "vector": [4, 4, 0.6538, 0.0615, 4, 0.89, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(dr_input, c_void_p):\n dr = dr_input\n else:\n raise OGRException('Unrecognized input type for OGR Driver: %s' % str(type(dr_input)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:Assign_L42_C12", "label": "dr =", "type": "assigned_variable", "loc": [42, 42], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L41_C8", "vector": [14, 5, 0.6462, 0.0154, 5, 0.25, 0.0, 537, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dr = dr_input"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L47_C8", "label": "if", "type": "if", "loc": [47, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L22_C4", "vector": [4, 2, 0.7308, 0.0308, 2, 0.2, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not dr:\n raise OGRException('Could not initialize OGR Driver on input: %s' % str(dr_input))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:Assign_L49_C8", "label": "self.ptr =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L22_C4", "vector": [14, 2, 0.7538, 0.0154, 2, 0.2, 1.0, 386, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.ptr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ptr = dr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L51_C4", "label": "__str__", "type": "function", "loc": [51, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:ClassDef_L11_C0", "vector": [2, 1, 0.8, 0.0462, 1, 0.73, 0.6, 527, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n \"Returns the string name of the OGR Driver.\"\n return capi.get_driver_name(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:Expr_L52_C8", "label": "expression", "type": "expression", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L51_C4", "vector": [8, 2, 0.8, 0.0154, 2, 0.03, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the string name of the OGR Driver.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:Return_L53_C8", "label": "return", "type": "return", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L51_C4", "vector": [13, 2, 0.8154, 0.0154, 2, 0.03, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_driver_name(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L55_C4", "label": "_register", "type": "function", "loc": [55, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:ClassDef_L11_C0", "vector": [2, 1, 0.8769, 0.0769, 1, 0.73, 0.8, 711, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_register", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _register(self):\n \"Attempts to register all the data source drivers.\"\n # Only register all if the driver count is 0 (or else all drivers\n # will be registered over and over again)\n if not self.driver_count: capi.register_all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:Expr_L56_C8", "label": "expression", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L55_C4", "vector": [8, 2, 0.8615, 0.0154, 2, 0.82, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Attempts to register all the data source drivers.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L59_C8", "label": "if", "type": "if", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L55_C4", "vector": [4, 2, 0.9077, 0.0154, 2, 0.82, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.driver_count: capi.register_all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:Expr_L59_C34", "label": "register_all()", "type": "expression", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L59_C8", "vector": [8, 3, 0.9077, 0.0154, 3, 0.58, 0.0, 55, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "register_all", "arg_names": [], "import_names": [], "rhs_call_name": "register_all", "annotation": ""}, "snippet": " if not self.driver_count: capi.register_all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L63_C4", "label": "driver_count", "type": "function", "loc": [63, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:ClassDef_L11_C0", "vector": [2, 1, 0.9846, 0.0462, 1, 0.73, 1.0, 967, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "driver_count", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def driver_count(self):\n \"Returns the number of OGR data source drivers registered.\"\n return capi.get_driver_count()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:Expr_L64_C8", "label": "expression", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L63_C4", "vector": [8, 2, 0.9846, 0.0154, 2, 0.5, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the number of OGR data source drivers registered.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98711:Return_L65_C8", "label": "return", "type": "return", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L63_C4", "vector": [13, 2, 1.0, 0.0154, 2, 0.5, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_driver_count()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98711:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:Expr_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L25_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:Expr_L27_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L25_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L31_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L31_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:Assign_L32_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L31_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:Assign_L34_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L25_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:Assign_L37_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L25_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:Expr_L39_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:Assign_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:Assign_L42_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:Expr_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:Return_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:Expr_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:If_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:Expr_L59_C34"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:Expr_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:Return_L65_C8"}] |
"""
The GDAL/OGR library uses an Envelope structure to hold the bounding
box information for a geometry. The envelope (bounding box) contains
two pairs of coordinates, one for the lower left coordinate and one
for the upper right coordinate:
+----------o Upper right; (max_x, max_y)
| |
| |
| |
Lower left (min_x, min_y) o----------+
"""
from ctypes import Structure, c_double
from django.contrib.gis.gdal.error import OGRException
# The OGR definition of an Envelope is a C structure containing four doubles.
# See the 'ogr_core.h' source file for more information:
# http://www.gdal.org/ogr/ogr__core_8h-source.html
class OGREnvelope(Structure):
"Represents the OGREnvelope C Structure."
_fields_ = [("MinX", c_double),
("MaxX", c_double),
("MinY", c_double),
("MaxY", c_double),
]
class Envelope(object):
"""
The Envelope object is a C structure that contains the minimum and
maximum X, Y coordinates for a rectangle bounding box. The naming
of the variables is compatible with the OGR Envelope structure.
"""
def __init__(self, *args):
"""
The initialization function may take an OGREnvelope structure, 4-element
tuple or list, or 4 individual arguments.
"""
if len(args) == 1:
if isinstance(args[0], OGREnvelope):
# OGREnvelope (a ctypes Structure) was passed in.
self._envelope = args[0]
elif isinstance(args[0], (tuple, list)):
# A tuple was passed in.
if len(args[0]) != 4:
raise OGRException('Incorrect number of tuple elements (%d).' % len(args[0]))
else:
self._from_sequence(args[0])
else:
raise TypeError('Incorrect type of argument: %s' % str(type(args[0])))
elif len(args) == 4:
# Individiual parameters passed in.
# Thanks to ww for the help
self._from_sequence(map(float, args))
else:
raise OGRException('Incorrect number (%d) of arguments.' % len(args))
# Checking the x,y coordinates
if self.min_x > self.max_x:
raise OGRException('Envelope minimum X > maximum X.')
if self.min_y > self.max_y:
raise OGRException('Envelope minimum Y > maximum Y.')
def __eq__(self, other):
"""
Returns True if the envelopes are equivalent; can compare against
other Envelopes and 4-tuples.
"""
if isinstance(other, Envelope):
return (self.min_x == other.min_x) and (self.min_y == other.min_y) and \
(self.max_x == other.max_x) and (self.max_y == other.max_y)
elif isinstance(other, tuple) and len(other) == 4:
return (self.min_x == other[0]) and (self.min_y == other[1]) and \
(self.max_x == other[2]) and (self.max_y == other[3])
else:
raise OGRException('Equivalence testing only works with other Envelopes.')
def __str__(self):
"Returns a string representation of the tuple."
return str(self.tuple)
def _from_sequence(self, seq):
"Initializes the C OGR Envelope structure from the given sequence."
self._envelope = OGREnvelope()
self._envelope.MinX = seq[0]
self._envelope.MinY = seq[1]
self._envelope.MaxX = seq[2]
self._envelope.MaxY = seq[3]
def expand_to_include(self, *args):
"""
Modifies the envelope to expand to include the boundaries of
the passed-in 2-tuple (a point), 4-tuple (an extent) or
envelope.
"""
# We provide a number of different signatures for this method,
# and the logic here is all about converting them into a
# 4-tuple single parameter which does the actual work of
# expanding the envelope.
if len(args) == 1:
if isinstance(args[0], Envelope):
return self.expand_to_include(args[0].tuple)
elif hasattr(args[0], 'x') and hasattr(args[0], 'y'):
return self.expand_to_include(args[0].x, args[0].y, args[0].x, args[0].y)
elif isinstance(args[0], (tuple, list)):
# A tuple was passed in.
if len(args[0]) == 2:
return self.expand_to_include((args[0][0], args[0][1], args[0][0], args[0][1]))
elif len(args[0]) == 4:
(minx, miny, maxx, maxy) = args[0]
if minx < self._envelope.MinX:
self._envelope.MinX = minx
if miny < self._envelope.MinY:
self._envelope.MinY = miny
if maxx > self._envelope.MaxX:
self._envelope.MaxX = maxx
if maxy > self._envelope.MaxY:
self._envelope.MaxY = maxy
else:
raise OGRException('Incorrect number of tuple elements (%d).' % len(args[0]))
else:
raise TypeError('Incorrect type of argument: %s' % str(type(args[0])))
elif len(args) == 2:
# An x and an y parameter were passed in
return self.expand_to_include((args[0], args[1], args[0], args[1]))
elif len(args) == 4:
# Individiual parameters passed in.
return self.expand_to_include(args)
else:
raise OGRException('Incorrect number (%d) of arguments.' % len(args[0]))
@property
def min_x(self):
"Returns the value of the minimum X coordinate."
return self._envelope.MinX
@property
def min_y(self):
"Returns the value of the minimum Y coordinate."
return self._envelope.MinY
@property
def max_x(self):
"Returns the value of the maximum X coordinate."
return self._envelope.MaxX
@property
def max_y(self):
"Returns the value of the maximum Y coordinate."
return self._envelope.MaxY
@property
def ur(self):
"Returns the upper-right coordinate."
return (self.max_x, self.max_y)
@property
def ll(self):
"Returns the lower-left coordinate."
return (self.min_x, self.min_y)
@property
def tuple(self):
"Returns a tuple representing the envelope."
return (self.min_x, self.min_y, self.max_x, self.max_y)
@property
def wkt(self):
"Returns WKT representing a Polygon for this envelope."
# TODO: Fix significant figures.
return 'POLYGON((%s %s,%s %s,%s %s,%s %s,%s %s))' % \
(self.min_x, self.min_y, self.min_x, self.max_y,
self.max_x, self.max_y, self.max_x, self.min_y,
self.min_x, self.min_y)
| ajibawa-2023/Python-Code-Large/train/row_98712 | 84 | 175 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 12], "level": 0, "parent": null, "vector": [8, 0, 0.0371, 0.0686, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n The GDAL/OGR library uses an Envelope structure to hold the bounding\n box information for a geometry. The envelope (bounding box) contains\n two pairs of coordinates, one for the lower left coordinate and one\n for the upper right coordinate:\n\n +----------o Upper right; (max_x, max_y)\n | |"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:ImportFrom_L13_C0", "label": "from ctypes import Structure, c_double", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0743, 0.0057, 0, 0.66, 0.25, 182, 0, 2, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["Structure", "c_double"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import Structure, c_double"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:ImportFrom_L14_C0", "label": "from django.contrib.gis.gdal.error import OGRException", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.08, 0.0057, 0, 0.66, 0.5, 76, 0, 1, 0, 0, 76, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.error", "arg_names": [], "import_names": ["OGRException"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.error import OGRException"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L19_C0", "label": "OGREnvelope", "type": "class", "loc": [19, 25], "level": 0, "parent": null, "vector": [3, 0, 0.1257, 0.04, 0, 0.66, 0.75, 171, 0, 0, 0, 0, 183, 0, 0], "semantic": {"name": "OGREnvelope", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OGREnvelope(Structure):\n \"Represents the OGREnvelope C Structure.\"\n _fields_ = [(\"MinX\", c_double),\n (\"MaxX\", c_double),\n (\"MinY\", c_double),\n (\"MaxY\", c_double),\n ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L20_C4", "label": "expression", "type": "expression", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L19_C0", "vector": [8, 1, 0.1143, 0.0057, 1, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Represents the OGREnvelope C Structure.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Assign_L21_C4", "label": "_fields_ =", "type": "assigned_variable", "loc": [21, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L19_C0", "vector": [14, 1, 0.1314, 0.0286, 1, 0.94, 1.0, 283, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "_fields_", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _fields_ = [(\"MinX\", c_double),\n (\"MaxX\", c_double),\n (\"MinY\", c_double),\n (\"MaxY\", c_double),\n ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "label": "Envelope", "type": "class", "loc": [27, 175], "level": 0, "parent": null, "vector": [3, 0, 0.5771, 0.8514, 0, 0.66, 1.0, 374, 0, 13, 0, 0, 186, 0, 44], "semantic": {"name": "Envelope", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Envelope(object):\n \"\"\"\n The Envelope object is a C structure that contains the minimum and\n maximum X, Y coordinates for a rectangle bounding box. The naming\n of the variables is compatible with the OGR Envelope structure.\n \"\"\"\n\n def __init__(self, *args):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L28_C4", "label": "expression", "type": "expression", "loc": [28, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "vector": [8, 1, 0.1714, 0.0286, 1, 0.01, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n The Envelope object is a C structure that contains the minimum and\n maximum X, Y coordinates for a rectangle bounding box. The naming\n of the variables is compatible with the OGR Envelope structure.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L34_C4", "label": "__init__", "type": "function", "loc": [34, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "vector": [2, 1, 0.2771, 0.1714, 1, 0.01, 0.0769, 555, 0, 2, 0, 0, 0, 0, 17], "semantic": {"name": "__init__", "arg_names": ["self", "args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, *args):\n \"\"\"\n The initialization function may take an OGREnvelope structure, 4-element\n tuple or list, or 4 individual arguments.\n \"\"\"\n \n if len(args) == 1:\n if isinstance(args[0], OGREnvelope):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L35_C8", "label": "expression", "type": "expression", "loc": [35, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L34_C4", "vector": [8, 2, 0.2086, 0.0229, 2, 0.77, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n The initialization function may take an OGREnvelope structure, 4-element\n tuple or list, or 4 individual arguments.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L40_C8", "label": "if", "type": "if", "loc": [40, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L34_C4", "vector": [4, 2, 0.2771, 0.1029, 2, 0.77, 0.3333, 0, 0, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(args) == 1:\n if isinstance(args[0], OGREnvelope):\n # OGREnvelope (a ctypes Structure) was passed in.\n self._envelope = args[0]\n elif isinstance(args[0], (tuple, list)):\n # A tuple was passed in.\n if len(args[0]) != 4:\n raise OGRException('Incorrect number of tuple elements (%d).' % len(args[0]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L41_C12", "label": "if", "type": "if", "loc": [41, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L40_C8", "vector": [4, 3, 0.2629, 0.0629, 3, 0.66, 0.0, 0, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(args[0], OGREnvelope):\n # OGREnvelope (a ctypes Structure) was passed in.\n self._envelope = args[0]\n elif isinstance(args[0], (tuple, list)):\n # A tuple was passed in.\n if len(args[0]) != 4:\n raise OGRException('Incorrect number of tuple elements (%d).' % len(args[0]))\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Assign_L43_C16", "label": "self._envelope =", "type": "assigned_variable", "loc": [43, 43], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L41_C12", "vector": [14, 4, 0.2457, 0.0057, 4, 0.3, 0.0, 957, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._envelope", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._envelope = args[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L44_C12", "label": "if", "type": "if", "loc": [44, 51], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L41_C12", "vector": [4, 4, 0.2714, 0.0457, 4, 0.3, 1.0, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(args[0], (tuple, list)):\n # A tuple was passed in.\n if len(args[0]) != 4:\n raise OGRException('Incorrect number of tuple elements (%d).' % len(args[0]))\n else:\n self._from_sequence(args[0])\n else:\n raise TypeError('Incorrect type of argument: %s' % str(type(args[0])))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L46_C16", "label": "if", "type": "if", "loc": [46, 49], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L44_C12", "vector": [4, 5, 0.2714, 0.0229, 5, 0.05, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(args[0]) != 4:\n raise OGRException('Incorrect number of tuple elements (%d).' % len(args[0]))\n else:\n self._from_sequence(args[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L49_C20", "label": "_from_sequence()", "type": "expression", "loc": [49, 49], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L46_C16", "vector": [8, 6, 0.28, 0.0057, 6, 0.72, 0.0, 756, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_from_sequence", "arg_names": [], "import_names": [], "rhs_call_name": "_from_sequence", "annotation": ""}, "snippet": " self._from_sequence(args[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L52_C8", "label": "if", "type": "if", "loc": [52, 57], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L40_C8", "vector": [4, 3, 0.3114, 0.0343, 3, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif len(args) == 4:\n # Individiual parameters passed in.\n # Thanks to ww for the help\n self._from_sequence(map(float, args))\n else:\n raise OGRException('Incorrect number (%d) of arguments.' % len(args))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L55_C12", "label": "_from_sequence()", "type": "expression", "loc": [55, 55], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L52_C8", "vector": [8, 4, 0.3143, 0.0057, 4, 0.9, 0.0, 756, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "_from_sequence", "arg_names": [], "import_names": [], "rhs_call_name": "_from_sequence", "annotation": ""}, "snippet": " self._from_sequence(map(float, args))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L60_C8", "label": "if", "type": "if", "loc": [60, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L34_C4", "vector": [4, 2, 0.3457, 0.0114, 2, 0.77, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.min_x > self.max_x:\n raise OGRException('Envelope minimum X > maximum X.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L62_C8", "label": "if", "type": "if", "loc": [62, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L34_C4", "vector": [4, 2, 0.3571, 0.0114, 2, 0.77, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.min_y > self.max_y:\n raise OGRException('Envelope minimum Y > maximum Y.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L65_C4", "label": "__eq__", "type": "function", "loc": [65, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "vector": [2, 1, 0.4057, 0.0743, 1, 0.01, 0.1538, 763, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "__eq__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __eq__(self, other):\n \"\"\"\n Returns True if the envelopes are equivalent; can compare against\n other Envelopes and 4-tuples.\n \"\"\"\n if isinstance(other, Envelope):\n return (self.min_x == other.min_x) and (self.min_y == other.min_y) and \\\n (self.max_x == other.max_x) and (self.max_y == other.max_y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L66_C8", "label": "expression", "type": "expression", "loc": [66, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L65_C4", "vector": [8, 2, 0.3857, 0.0229, 2, 0.71, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns True if the envelopes are equivalent; can compare against\n other Envelopes and 4-tuples.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L70_C8", "label": "if", "type": "if", "loc": [70, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L65_C4", "vector": [4, 2, 0.42, 0.0457, 2, 0.71, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, Envelope):\n return (self.min_x == other.min_x) and (self.min_y == other.min_y) and \\\n (self.max_x == other.max_x) and (self.max_y == other.max_y)\n elif isinstance(other, tuple) and len(other) == 4:\n return (self.min_x == other[0]) and (self.min_y == other[1]) and \\\n (self.max_x == other[2]) and (self.max_y == other[3])\n else:\n raise OGRException('Equivalence testing only works with other Envelopes.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L71_C12", "label": "return", "type": "return", "loc": [71, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L70_C8", "vector": [13, 3, 0.4086, 0.0114, 3, 0.62, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (self.min_x == other.min_x) and (self.min_y == other.min_y) and \\\n (self.max_x == other.max_x) and (self.max_y == other.max_y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L73_C8", "label": "if", "type": "if", "loc": [73, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L70_C8", "vector": [4, 3, 0.4286, 0.0286, 3, 0.62, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(other, tuple) and len(other) == 4:\n return (self.min_x == other[0]) and (self.min_y == other[1]) and \\\n (self.max_x == other[2]) and (self.max_y == other[3])\n else:\n raise OGRException('Equivalence testing only works with other Envelopes.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L74_C12", "label": "return", "type": "return", "loc": [74, 75], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L73_C8", "vector": [13, 4, 0.4257, 0.0114, 4, 0.09, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (self.min_x == other[0]) and (self.min_y == other[1]) and \\\n (self.max_x == other[2]) and (self.max_y == other[3])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L79_C4", "label": "__str__", "type": "function", "loc": [79, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "vector": [2, 1, 0.4571, 0.0171, 1, 0.01, 0.2308, 527, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n \"Returns a string representation of the tuple.\"\n return str(self.tuple)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L80_C8", "label": "expression", "type": "expression", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L79_C4", "vector": [8, 2, 0.4571, 0.0057, 2, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a string representation of the tuple.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L81_C8", "label": "return", "type": "return", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L79_C4", "vector": [13, 2, 0.4629, 0.0057, 2, 0.43, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str(self.tuple)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L83_C4", "label": "_from_sequence", "type": "function", "loc": [83, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "vector": [2, 1, 0.4914, 0.04, 1, 0.01, 0.3077, 756, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_from_sequence", "arg_names": ["self", "seq"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _from_sequence(self, seq):\n \"Initializes the C OGR Envelope structure from the given sequence.\"\n self._envelope = OGREnvelope()\n self._envelope.MinX = seq[0]\n self._envelope.MinY = seq[1]\n self._envelope.MaxX = seq[2]\n self._envelope.MaxY = seq[3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L84_C8", "label": "expression", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L83_C4", "vector": [8, 2, 0.48, 0.0057, 2, 0.95, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Initializes the C OGR Envelope structure from the given sequence.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Assign_L85_C8", "label": "self._envelope = OGREnvelope()", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L83_C4", "vector": [14, 2, 0.4857, 0.0057, 2, 0.95, 0.2, 957, 3, 0, 0, 0, 171, 10, 1], "semantic": {"name": "self._envelope", "arg_names": [], "import_names": [], "rhs_call_name": "OGREnvelope", "annotation": ""}, "snippet": " self._envelope = OGREnvelope()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Assign_L86_C8", "label": "self._envelope.MinX =", "type": "assigned_variable", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L83_C4", "vector": [14, 2, 0.4914, 0.0057, 2, 0.95, 0.4, 648, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._envelope.MinX", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._envelope.MinX = seq[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Assign_L87_C8", "label": "self._envelope.MinY =", "type": "assigned_variable", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L83_C4", "vector": [14, 2, 0.4971, 0.0057, 2, 0.95, 0.6, 510, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._envelope.MinY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._envelope.MinY = seq[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Assign_L88_C8", "label": "self._envelope.MaxX =", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L83_C4", "vector": [14, 2, 0.5029, 0.0057, 2, 0.95, 0.8, 797, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._envelope.MaxX", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._envelope.MaxX = seq[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Assign_L89_C8", "label": "self._envelope.MaxY =", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L83_C4", "vector": [14, 2, 0.5086, 0.0057, 2, 0.95, 1.0, 543, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._envelope.MaxY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._envelope.MaxY = seq[3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L91_C4", "label": "expand_to_include", "type": "function", "loc": [91, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "vector": [2, 1, 0.6343, 0.2343, 1, 0.01, 0.3846, 480, 0, 2, 1, 0, 0, 0, 21], "semantic": {"name": "expand_to_include", "arg_names": ["self", "args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def expand_to_include(self, *args): \n \"\"\" \n Modifies the envelope to expand to include the boundaries of \n the passed-in 2-tuple (a point), 4-tuple (an extent) or \n envelope. \n \"\"\" \n # We provide a number of different signatures for this method, \n # and the logic here is all about converting them into a "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L92_C8", "label": "expression", "type": "expression", "loc": [92, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L91_C4", "vector": [8, 2, 0.5371, 0.0286, 2, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" \n Modifies the envelope to expand to include the boundaries of \n the passed-in 2-tuple (a point), 4-tuple (an extent) or \n envelope. \n \"\"\" "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L101_C8", "label": "if", "type": "if", "loc": [101, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L91_C4", "vector": [4, 2, 0.6629, 0.1771, 2, 0.88, 1.0, 0, 0, 0, 0, 0, 0, 0, 21], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(args) == 1: \n if isinstance(args[0], Envelope): \n return self.expand_to_include(args[0].tuple) \n elif hasattr(args[0], 'x') and hasattr(args[0], 'y'):\n return self.expand_to_include(args[0].x, args[0].y, args[0].x, args[0].y) \n elif isinstance(args[0], (tuple, list)): \n # A tuple was passed in. \n if len(args[0]) == 2: "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L102_C12", "label": "if", "type": "if", "loc": [102, 123], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L101_C8", "vector": [4, 3, 0.6429, 0.1257, 3, 0.16, 0.0, 0, 3, 0, 0, 0, 0, 0, 14], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(args[0], Envelope): \n return self.expand_to_include(args[0].tuple) \n elif hasattr(args[0], 'x') and hasattr(args[0], 'y'):\n return self.expand_to_include(args[0].x, args[0].y, args[0].x, args[0].y) \n elif isinstance(args[0], (tuple, list)): \n # A tuple was passed in. \n if len(args[0]) == 2: \n return self.expand_to_include((args[0][0], args[0][1], args[0][0], args[0][1])) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L103_C16", "label": "return", "type": "return", "loc": [103, 103], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L102_C12", "vector": [13, 4, 0.5886, 0.0057, 4, 0.26, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.expand_to_include(args[0].tuple) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L104_C12", "label": "if", "type": "if", "loc": [104, 123], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L102_C12", "vector": [4, 4, 0.6486, 0.1143, 4, 0.26, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif hasattr(args[0], 'x') and hasattr(args[0], 'y'):\n return self.expand_to_include(args[0].x, args[0].y, args[0].x, args[0].y) \n elif isinstance(args[0], (tuple, list)): \n # A tuple was passed in. \n if len(args[0]) == 2: \n return self.expand_to_include((args[0][0], args[0][1], args[0][0], args[0][1])) \n elif len(args[0]) == 4: \n (minx, miny, maxx, maxy) = args[0] "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L105_C16", "label": "return", "type": "return", "loc": [105, 105], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L104_C12", "vector": [13, 5, 0.6, 0.0057, 5, 0.59, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.expand_to_include(args[0].x, args[0].y, args[0].x, args[0].y) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L106_C12", "label": "if", "type": "if", "loc": [106, 123], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L104_C12", "vector": [4, 5, 0.6543, 0.1029, 5, 0.59, 1.0, 0, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(args[0], (tuple, list)): \n # A tuple was passed in. \n if len(args[0]) == 2: \n return self.expand_to_include((args[0][0], args[0][1], args[0][0], args[0][1])) \n elif len(args[0]) == 4: \n (minx, miny, maxx, maxy) = args[0] \n if minx < self._envelope.MinX: \n self._envelope.MinX = minx "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L108_C16", "label": "if", "type": "if", "loc": [108, 121], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L106_C12", "vector": [4, 6, 0.6543, 0.08, 6, 0.86, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(args[0]) == 2: \n return self.expand_to_include((args[0][0], args[0][1], args[0][0], args[0][1])) \n elif len(args[0]) == 4: \n (minx, miny, maxx, maxy) = args[0] \n if minx < self._envelope.MinX: \n self._envelope.MinX = minx \n if miny < self._envelope.MinY: \n self._envelope.MinY = miny "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L109_C20", "label": "return", "type": "return", "loc": [109, 109], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L108_C16", "vector": [13, 7, 0.6229, 0.0057, 7, 0.24, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.expand_to_include((args[0][0], args[0][1], args[0][0], args[0][1])) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L110_C16", "label": "if", "type": "if", "loc": [110, 121], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L108_C16", "vector": [4, 7, 0.66, 0.0686, 7, 0.24, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif len(args[0]) == 4: \n (minx, miny, maxx, maxy) = args[0] \n if minx < self._envelope.MinX: \n self._envelope.MinX = minx \n if miny < self._envelope.MinY: \n self._envelope.MinY = miny \n if maxx > self._envelope.MaxX: \n self._envelope.MaxX = maxx "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Assign_L111_C20", "label": "minx, miny, maxx, maxy =", "type": "assigned_variable", "loc": [111, 111], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L110_C16", "vector": [14, 8, 0.6343, 0.0057, 8, 0.36, 0.0, 286, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "minx, miny, maxx, maxy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " (minx, miny, maxx, maxy) = args[0] "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L112_C20", "label": "if", "type": "if", "loc": [112, 113], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L110_C16", "vector": [4, 8, 0.6429, 0.0114, 8, 0.36, 0.25, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if minx < self._envelope.MinX: \n self._envelope.MinX = minx "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Assign_L113_C24", "label": "self._envelope.MinX =", "type": "assigned_variable", "loc": [113, 113], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L112_C20", "vector": [14, 9, 0.6457, 0.0057, 9, 0.27, 0.0, 648, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._envelope.MinX", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._envelope.MinX = minx "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L114_C20", "label": "if", "type": "if", "loc": [114, 115], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L110_C16", "vector": [4, 8, 0.6543, 0.0114, 8, 0.36, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if miny < self._envelope.MinY: \n self._envelope.MinY = miny "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Assign_L115_C24", "label": "self._envelope.MinY =", "type": "assigned_variable", "loc": [115, 115], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L114_C20", "vector": [14, 9, 0.6571, 0.0057, 9, 0.86, 0.0, 510, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._envelope.MinY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._envelope.MinY = miny "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L116_C20", "label": "if", "type": "if", "loc": [116, 117], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L110_C16", "vector": [4, 8, 0.6657, 0.0114, 8, 0.36, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if maxx > self._envelope.MaxX: \n self._envelope.MaxX = maxx "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Assign_L117_C24", "label": "self._envelope.MaxX =", "type": "assigned_variable", "loc": [117, 117], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L116_C20", "vector": [14, 9, 0.6686, 0.0057, 9, 0.96, 0.0, 797, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._envelope.MaxX", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._envelope.MaxX = maxx "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L118_C20", "label": "if", "type": "if", "loc": [118, 119], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L110_C16", "vector": [4, 8, 0.6771, 0.0114, 8, 0.36, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if maxy > self._envelope.MaxY: \n self._envelope.MaxY = maxy "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Assign_L119_C24", "label": "self._envelope.MaxY =", "type": "assigned_variable", "loc": [119, 119], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L118_C20", "vector": [14, 9, 0.68, 0.0057, 9, 0.78, 0.0, 543, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._envelope.MaxY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._envelope.MaxY = maxy "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L124_C8", "label": "if", "type": "if", "loc": [124, 131], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L101_C8", "vector": [4, 3, 0.7286, 0.0457, 3, 0.16, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif len(args) == 2: \n # An x and an y parameter were passed in \n return self.expand_to_include((args[0], args[1], args[0], args[1])) \n elif len(args) == 4: \n # Individiual parameters passed in. \n return self.expand_to_include(args) \n else: \n raise OGRException('Incorrect number (%d) of arguments.' % len(args[0])) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L126_C16", "label": "return", "type": "return", "loc": [126, 126], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L124_C8", "vector": [13, 4, 0.72, 0.0057, 4, 0.74, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.expand_to_include((args[0], args[1], args[0], args[1])) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L127_C8", "label": "if", "type": "if", "loc": [127, 131], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L124_C8", "vector": [4, 4, 0.7371, 0.0286, 4, 0.74, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif len(args) == 4: \n # Individiual parameters passed in. \n return self.expand_to_include(args) \n else: \n raise OGRException('Incorrect number (%d) of arguments.' % len(args[0])) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L129_C12", "label": "return", "type": "return", "loc": [129, 129], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L127_C8", "vector": [13, 5, 0.7371, 0.0057, 5, 0.36, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.expand_to_include(args) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L134_C4", "label": "min_x", "type": "function", "loc": [134, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "vector": [2, 1, 0.7714, 0.0171, 1, 0.01, 0.4615, 971, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "min_x", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def min_x(self):\n \"Returns the value of the minimum X coordinate.\"\n return self._envelope.MinX"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L135_C8", "label": "expression", "type": "expression", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L134_C4", "vector": [8, 2, 0.7714, 0.0057, 2, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the value of the minimum X coordinate.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L136_C8", "label": "return", "type": "return", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L134_C4", "vector": [13, 2, 0.7771, 0.0057, 2, 0.37, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._envelope.MinX"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L139_C4", "label": "min_y", "type": "function", "loc": [139, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "vector": [2, 1, 0.8, 0.0171, 1, 0.01, 0.5385, 8, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "min_y", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def min_y(self):\n \"Returns the value of the minimum Y coordinate.\"\n return self._envelope.MinY"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L140_C8", "label": "expression", "type": "expression", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L139_C4", "vector": [8, 2, 0.8, 0.0057, 2, 0.48, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the value of the minimum Y coordinate.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L141_C8", "label": "return", "type": "return", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L139_C4", "vector": [13, 2, 0.8057, 0.0057, 2, 0.48, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._envelope.MinY"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L144_C4", "label": "max_x", "type": "function", "loc": [144, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "vector": [2, 1, 0.8286, 0.0171, 1, 0.01, 0.6154, 64, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "max_x", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def max_x(self):\n \"Returns the value of the maximum X coordinate.\"\n return self._envelope.MaxX"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L145_C8", "label": "expression", "type": "expression", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L144_C4", "vector": [8, 2, 0.8286, 0.0057, 2, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the value of the maximum X coordinate.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L146_C8", "label": "return", "type": "return", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L144_C4", "vector": [13, 2, 0.8343, 0.0057, 2, 0.66, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._envelope.MaxX"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L149_C4", "label": "max_y", "type": "function", "loc": [149, 151], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "vector": [2, 1, 0.8571, 0.0171, 1, 0.01, 0.6923, 742, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "max_y", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def max_y(self):\n \"Returns the value of the maximum Y coordinate.\"\n return self._envelope.MaxY"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L150_C8", "label": "expression", "type": "expression", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L149_C4", "vector": [8, 2, 0.8571, 0.0057, 2, 0.06, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the value of the maximum Y coordinate.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L151_C8", "label": "return", "type": "return", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L149_C4", "vector": [13, 2, 0.8629, 0.0057, 2, 0.06, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._envelope.MaxY"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L154_C4", "label": "ur", "type": "function", "loc": [154, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "vector": [2, 1, 0.8857, 0.0171, 1, 0.01, 0.7692, 611, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "ur", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def ur(self):\n \"Returns the upper-right coordinate.\"\n return (self.max_x, self.max_y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L155_C8", "label": "expression", "type": "expression", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L154_C4", "vector": [8, 2, 0.8857, 0.0057, 2, 0.0, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the upper-right coordinate.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L156_C8", "label": "return", "type": "return", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L154_C4", "vector": [13, 2, 0.8914, 0.0057, 2, 0.0, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (self.max_x, self.max_y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L159_C4", "label": "ll", "type": "function", "loc": [159, 161], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "vector": [2, 1, 0.9143, 0.0171, 1, 0.01, 0.8462, 929, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "ll", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def ll(self):\n \"Returns the lower-left coordinate.\"\n return (self.min_x, self.min_y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L160_C8", "label": "expression", "type": "expression", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L159_C4", "vector": [8, 2, 0.9143, 0.0057, 2, 0.21, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the lower-left coordinate.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L161_C8", "label": "return", "type": "return", "loc": [161, 161], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L159_C4", "vector": [13, 2, 0.92, 0.0057, 2, 0.21, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (self.min_x, self.min_y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L164_C4", "label": "tuple", "type": "function", "loc": [164, 166], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "vector": [2, 1, 0.9429, 0.0171, 1, 0.01, 0.9231, 259, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "tuple", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def tuple(self):\n \"Returns a tuple representing the envelope.\"\n return (self.min_x, self.min_y, self.max_x, self.max_y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L165_C8", "label": "expression", "type": "expression", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L164_C4", "vector": [8, 2, 0.9429, 0.0057, 2, 0.2, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a tuple representing the envelope.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L166_C8", "label": "return", "type": "return", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L164_C4", "vector": [13, 2, 0.9486, 0.0057, 2, 0.2, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (self.min_x, self.min_y, self.max_x, self.max_y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L169_C4", "label": "wkt", "type": "function", "loc": [169, 175], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "vector": [2, 1, 0.9829, 0.04, 1, 0.01, 1.0, 836, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "wkt", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wkt(self):\n \"Returns WKT representing a Polygon for this envelope.\"\n # TODO: Fix significant figures.\n return 'POLYGON((%s %s,%s %s,%s %s,%s %s,%s %s))' % \\\n (self.min_x, self.min_y, self.min_x, self.max_y,\n self.max_x, self.max_y, self.max_x, self.min_y,\n self.min_x, self.min_y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L170_C8", "label": "expression", "type": "expression", "loc": [170, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L169_C4", "vector": [8, 2, 0.9714, 0.0057, 2, 0.39, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns WKT representing a Polygon for this envelope.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L172_C8", "label": "return", "type": "return", "loc": [172, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L169_C4", "vector": [13, 2, 0.9914, 0.0229, 2, 0.39, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'POLYGON((%s %s,%s %s,%s %s,%s %s,%s %s))' % \\\n (self.min_x, self.min_y, self.min_x, self.max_y,\n self.max_x, self.max_y, self.max_x, self.min_y,\n self.min_x, self.min_y)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L40_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L41_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L41_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Assign_L43_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L41_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L44_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L44_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L46_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L46_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L49_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L40_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L52_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L65_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L65_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L71_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L73_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L74_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Assign_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Assign_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Assign_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Assign_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Assign_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L102_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L102_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L103_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L102_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L104_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L104_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L105_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L104_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L106_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L106_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L108_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L108_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L109_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L108_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L110_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L110_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Assign_L111_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L110_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L112_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L112_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Assign_L113_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L110_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L114_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L114_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Assign_L115_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L110_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L116_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L116_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Assign_L117_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L110_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L118_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L118_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Assign_L119_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L126_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:If_L127_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L129_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L139_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L159_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L159_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L169_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L169_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:FunctionDef_L169_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Return_L172_C8"}] |
from ctypes import c_void_p
from types import NoneType
from django.contrib.gis.gdal.error import GDALException
class GDALBase(object):
"""
Base object for GDAL objects that has a pointer access property
that controls access to the underlying C pointer.
"""
# Initially the pointer is NULL.
_ptr = None
# Default allowed pointer type.
ptr_type = c_void_p
# Pointer access property.
def _get_ptr(self):
# Raise an exception if the pointer isn't valid don't
# want to be passing NULL pointers to routines --
# that's very bad.
if self._ptr: return self._ptr
else: raise GDALException('GDAL %s pointer no longer valid.' % self.__class__.__name__)
def _set_ptr(self, ptr):
# Only allow the pointer to be set with pointers of the
# compatible type or None (NULL).
if isinstance(ptr, (int, long)):
self._ptr = self.ptr_type(ptr)
elif isinstance(ptr, (self.ptr_type, NoneType)):
self._ptr = ptr
else:
raise TypeError('Incompatible pointer type')
ptr = property(_get_ptr, _set_ptr)
| ajibawa-2023/Python-Code-Large/train/row_98713 | 16 | 35 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98713:ImportFrom_L1_C0", "label": "from ctypes import c_void_p", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0286, 0.0286, 0, 0.66, 0.0, 182, 0, 1, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_void_p"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import c_void_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98713:ImportFrom_L2_C0", "label": "from types import NoneType", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0571, 0.0286, 0, 0.66, 0.3333, 209, 0, 1, 0, 0, 209, 0, 0], "semantic": {"name": "types", "arg_names": [], "import_names": ["NoneType"], "rhs_call_name": "", "annotation": ""}, "snippet": "from types import NoneType"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98713:ImportFrom_L3_C0", "label": "from django.contrib.gis.gdal.error import GDALException", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0857, 0.0286, 0, 0.66, 0.6667, 76, 0, 1, 0, 0, 76, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.error", "arg_names": [], "import_names": ["GDALException"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.error import GDALException"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98713:ClassDef_L5_C0", "label": "GDALBase", "type": "class", "loc": [5, 34], "level": 0, "parent": null, "vector": [3, 0, 0.5571, 0.8571, 0, 0.66, 1.0, 436, 0, 2, 0, 0, 186, 0, 6], "semantic": {"name": "GDALBase", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GDALBase(object):\n \"\"\"\n Base object for GDAL objects that has a pointer access property\n that controls access to the underlying C pointer.\n \"\"\"\n # Initially the pointer is NULL.\n _ptr = None\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98713:Expr_L6_C4", "label": "expression", "type": "expression", "loc": [6, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98713:ClassDef_L5_C0", "vector": [8, 1, 0.2143, 0.1143, 1, 0.92, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Base object for GDAL objects that has a pointer access property\n that controls access to the underlying C pointer.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98713:Assign_L11_C4", "label": "_ptr =", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98713:ClassDef_L5_C0", "vector": [14, 1, 0.3143, 0.0286, 1, 0.92, 0.2, 676, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "_ptr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _ptr = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98713:Assign_L14_C4", "label": "ptr_type =", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98713:ClassDef_L5_C0", "vector": [14, 1, 0.4, 0.0286, 1, 0.92, 0.4, 247, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ptr_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ptr_type = c_void_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98713:FunctionDef_L17_C4", "label": "_get_ptr", "type": "function", "loc": [17, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98713:ClassDef_L5_C0", "vector": [2, 1, 0.5571, 0.1714, 1, 0.92, 0.6, 58, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "_get_ptr", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_ptr(self):\n # Raise an exception if the pointer isn't valid don't\n # want to be passing NULL pointers to routines --\n # that's very bad.\n if self._ptr: return self._ptr\n else: raise GDALException('GDAL %s pointer no longer valid.' % self.__class__.__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98713:If_L21_C8", "label": "if", "type": "if", "loc": [21, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98713:FunctionDef_L17_C4", "vector": [4, 2, 0.6143, 0.0571, 2, 0.59, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._ptr: return self._ptr\n else: raise GDALException('GDAL %s pointer no longer valid.' % self.__class__.__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98713:Return_L21_C22", "label": "return", "type": "return", "loc": [21, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98713:If_L21_C8", "vector": [13, 3, 0.6, 0.0286, 3, 0.5, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._ptr: return self._ptr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98713:FunctionDef_L24_C4", "label": "_set_ptr", "type": "function", "loc": [24, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98713:ClassDef_L5_C0", "vector": [2, 1, 0.8, 0.2571, 1, 0.92, 0.8, 489, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "_set_ptr", "arg_names": ["self", "ptr"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_ptr(self, ptr):\n # Only allow the pointer to be set with pointers of the\n # compatible type or None (NULL).\n if isinstance(ptr, (int, long)):\n self._ptr = self.ptr_type(ptr)\n elif isinstance(ptr, (self.ptr_type, NoneType)):\n self._ptr = ptr\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98713:If_L27_C8", "label": "if", "type": "if", "loc": [27, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98713:FunctionDef_L24_C4", "vector": [4, 2, 0.8429, 0.1714, 2, 0.35, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(ptr, (int, long)):\n self._ptr = self.ptr_type(ptr)\n elif isinstance(ptr, (self.ptr_type, NoneType)):\n self._ptr = ptr\n else:\n raise TypeError('Incompatible pointer type')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98713:Assign_L28_C12", "label": "self._ptr = ptr_type()", "type": "assigned_variable", "loc": [28, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98713:If_L27_C8", "vector": [14, 3, 0.8, 0.0286, 3, 0.4, 0.0, 479, 3, 1, 0, 0, 247, 10, 1], "semantic": {"name": "self._ptr", "arg_names": [], "import_names": [], "rhs_call_name": "ptr_type", "annotation": ""}, "snippet": " self._ptr = self.ptr_type(ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98713:If_L29_C8", "label": "if", "type": "if", "loc": [29, 32], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98713:If_L27_C8", "vector": [4, 3, 0.8714, 0.1143, 3, 0.4, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(ptr, (self.ptr_type, NoneType)):\n self._ptr = ptr\n else:\n raise TypeError('Incompatible pointer type')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98713:Assign_L30_C12", "label": "self._ptr =", "type": "assigned_variable", "loc": [30, 30], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98713:If_L29_C8", "vector": [14, 4, 0.8571, 0.0286, 4, 0.41, 0.0, 479, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._ptr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._ptr = ptr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98713:Assign_L34_C4", "label": "ptr = property()", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98713:ClassDef_L5_C0", "vector": [14, 1, 0.9714, 0.0286, 1, 0.92, 1.0, 676, 3, 2, 0, 0, 244, 10, 1], "semantic": {"name": "ptr", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " ptr = property(_get_ptr, _set_ptr)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98713:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98713:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98713:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98713:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98713:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98713:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98713:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98713:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98713:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98713:If_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98713:If_L21_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98713:Return_L21_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98713:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98713:FunctionDef_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98713:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98713:If_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98713:If_L27_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98713:Assign_L28_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98713:If_L27_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98713:If_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98713:If_L29_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98713:Assign_L30_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98713:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98713:Assign_L34_C4"}] |
"""
This module houses ctypes interfaces for GDAL objects. The following GDAL
objects are supported:
CoordTransform: Used for coordinate transformations from one spatial
reference system to another.
Driver: Wraps an OGR data source driver.
DataSource: Wrapper for the OGR data source object, supports
OGR-supported data sources.
Envelope: A ctypes structure for bounding boxes (GDAL library
not required).
OGRGeometry: Object for accessing OGR Geometry functionality.
OGRGeomType: A class for representing the different OGR Geometry
types (GDAL library not required).
SpatialReference: Represents OSR Spatial Reference objects.
The GDAL library will be imported from the system path using the default
library name for the current OS. The default library path may be overridden
by setting `GDAL_LIBRARY_PATH` in your settings with the path to the GDAL C
library on your system.
GDAL links to a large number of external libraries that consume RAM when
loaded. Thus, it may desirable to disable GDAL on systems with limited
RAM resources -- this may be accomplished by setting `GDAL_LIBRARY_PATH`
to a non-existant file location (e.g., `GDAL_LIBRARY_PATH='/null/path'`;
setting to None/False/'' will not work as a string must be given).
"""
# Attempting to import objects that depend on the GDAL library. The
# HAS_GDAL flag will be set to True if the library is present on
# the system.
try:
from django.contrib.gis.gdal.driver import Driver
from django.contrib.gis.gdal.datasource import DataSource
from django.contrib.gis.gdal.libgdal import gdal_version, gdal_full_version, gdal_release_date, GEOJSON, GDAL_VERSION
from django.contrib.gis.gdal.srs import SpatialReference, CoordTransform
from django.contrib.gis.gdal.geometries import OGRGeometry
HAS_GDAL = True
except:
HAS_GDAL, GEOJSON = False, False
try:
from django.contrib.gis.gdal.envelope import Envelope
except ImportError:
# No ctypes, but don't raise an exception.
pass
from django.contrib.gis.gdal.error import check_err, OGRException, OGRIndexError, SRSException
from django.contrib.gis.gdal.geomtype import OGRGeomType
| ajibawa-2023/Python-Code-Large/train/row_98714 | 13 | 54 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98714:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 33], "level": 0, "parent": null, "vector": [8, 0, 0.3148, 0.6111, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n This module houses ctypes interfaces for GDAL objects. The following GDAL\n objects are supported:\n\n CoordTransform: Used for coordinate transformations from one spatial\n reference system to another.\n\n Driver: Wraps an OGR data source driver."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98714:Try_L37_C0", "label": "try", "type": "try", "loc": [37, 45], "level": 0, "parent": null, "vector": [7, 0, 0.7593, 0.1667, 0, 0.66, 0.25, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from django.contrib.gis.gdal.driver import Driver\n from django.contrib.gis.gdal.datasource import DataSource\n from django.contrib.gis.gdal.libgdal import gdal_version, gdal_full_version, gdal_release_date, GEOJSON, GDAL_VERSION\n from django.contrib.gis.gdal.srs import SpatialReference, CoordTransform\n from django.contrib.gis.gdal.geometries import OGRGeometry\n HAS_GDAL = True\nexcept:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98714:ImportFrom_L38_C4", "label": "from django.contrib.gis.gdal.driver import Driver", "type": "import", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98714:Try_L37_C0", "vector": [1, 1, 0.7037, 0.0185, 1, 0.81, 0.0, 489, 0, 1, 0, 0, 489, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.driver", "arg_names": [], "import_names": ["Driver"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.gdal.driver import Driver"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98714:ImportFrom_L39_C4", "label": "from django.contrib.gis.gdal.datasource import DataSource", "type": "import", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98714:Try_L37_C0", "vector": [1, 1, 0.7222, 0.0185, 1, 0.81, 0.2, 959, 0, 1, 0, 0, 959, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.datasource", "arg_names": [], "import_names": ["DataSource"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.gdal.datasource import DataSource"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98714:ImportFrom_L40_C4", "label": "from django.contrib.gis.gdal.libgdal import gdal_version, gdal_full_version, gdal_release_date\u2026", "type": "import", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98714:Try_L37_C0", "vector": [1, 1, 0.7407, 0.0185, 1, 0.81, 0.4, 460, 0, 5, 0, 0, 460, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.libgdal", "arg_names": [], "import_names": ["gdal_version", "gdal_full_version", "gdal_release_date", "GEOJSON", "GDAL_VERSION"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.gdal.libgdal import gdal_version, gdal_full_version, gdal_release_date, GEOJSON, GDAL_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98714:ImportFrom_L41_C4", "label": "from django.contrib.gis.gdal.srs import SpatialReference, CoordTransform", "type": "import", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98714:Try_L37_C0", "vector": [1, 1, 0.7593, 0.0185, 1, 0.81, 0.6, 912, 0, 2, 0, 0, 912, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.srs", "arg_names": [], "import_names": ["SpatialReference", "CoordTransform"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.gdal.srs import SpatialReference, CoordTransform"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98714:ImportFrom_L42_C4", "label": "from django.contrib.gis.gdal.geometries import OGRGeometry", "type": "import", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98714:Try_L37_C0", "vector": [1, 1, 0.7778, 0.0185, 1, 0.81, 0.8, 671, 0, 1, 0, 0, 671, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.geometries", "arg_names": [], "import_names": ["OGRGeometry"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.gdal.geometries import OGRGeometry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98714:Assign_L43_C4", "label": "HAS_GDAL =", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98714:Try_L37_C0", "vector": [14, 1, 0.7963, 0.0185, 1, 0.81, 1.0, 654, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "HAS_GDAL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " HAS_GDAL = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98714:Assign_L45_C4", "label": "HAS_GDAL, GEOJSON =", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98714:Try_L37_C0", "vector": [14, 1, 0.8333, 0.0185, 1, 0.81, 0.0, 345, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "HAS_GDAL, GEOJSON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " HAS_GDAL, GEOJSON = False, False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98714:Try_L47_C0", "label": "try", "type": "try", "loc": [47, 51], "level": 0, "parent": null, "vector": [7, 0, 0.9074, 0.0926, 0, 0.66, 0.5, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from django.contrib.gis.gdal.envelope import Envelope\nexcept ImportError:\n # No ctypes, but don't raise an exception.\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98714:ImportFrom_L48_C4", "label": "from django.contrib.gis.gdal.envelope import Envelope", "type": "import", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98714:Try_L47_C0", "vector": [1, 1, 0.8889, 0.0185, 1, 0.79, 0.0, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.envelope", "arg_names": [], "import_names": ["Envelope"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.gdal.envelope import Envelope"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98714:ImportFrom_L53_C0", "label": "from django.contrib.gis.gdal.error import check_err, OGRException, OGRIndexError\u2026", "type": "import", "loc": [53, 53], "level": 0, "parent": null, "vector": [1, 0, 0.9815, 0.0185, 0, 0.66, 0.75, 76, 0, 4, 0, 0, 76, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.error", "arg_names": [], "import_names": ["check_err", "OGRException", "OGRIndexError", "SRSException"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.error import check_err, OGRException, OGRIndexError, SRSException"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98714:ImportFrom_L54_C0", "label": "from django.contrib.gis.gdal.geomtype import OGRGeomType", "type": "import", "loc": [54, 54], "level": 0, "parent": null, "vector": [1, 0, 1.0, 0.0185, 0, 0.66, 1.0, 621, 0, 1, 0, 0, 621, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.geomtype", "arg_names": [], "import_names": ["OGRGeomType"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.geomtype import OGRGeomType"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98714:Try_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98714:ImportFrom_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98714:Try_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98714:ImportFrom_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98714:Try_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98714:ImportFrom_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98714:Try_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98714:ImportFrom_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98714:Try_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98714:ImportFrom_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98714:Try_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98714:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98714:Try_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98714:Assign_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98714:Try_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98714:ImportFrom_L48_C4"}] |
"""
The Spatial Reference class, represensents OGR Spatial Reference objects.
Example:
>>> from django.contrib.gis.gdal import SpatialReference
>>> srs = SpatialReference('WGS84')
>>> print srs
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
TOWGS84[0,0,0,0,0,0,0],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.01745329251994328,
AUTHORITY["EPSG","9122"]],
AUTHORITY["EPSG","4326"]]
>>> print srs.proj
+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
>>> print srs.ellipsoid
(6378137.0, 6356752.3142451793, 298.25722356300003)
>>> print srs.projected, srs.geographic
False True
>>> srs.import_epsg(32140)
>>> print srs.name
NAD83 / Texas South Central
"""
import re
from ctypes import byref, c_char_p, c_int, c_void_p
# Getting the error checking routine and exceptions
from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.error import OGRException, SRSException
from django.contrib.gis.gdal.prototypes import srs as capi
#### Spatial Reference class. ####
class SpatialReference(GDALBase):
"""
A wrapper for the OGRSpatialReference object. According to the GDAL Web site,
the SpatialReference object "provide[s] services to represent coordinate
systems (projections and datums) and to transform between them."
"""
#### Python 'magic' routines ####
def __init__(self, srs_input=''):
"""
Creates a GDAL OSR Spatial Reference object from the given input.
The input may be string of OGC Well Known Text (WKT), an integer
EPSG code, a PROJ.4 string, and/or a projection "well known" shorthand
string (one of 'WGS84', 'WGS72', 'NAD27', 'NAD83').
"""
buf = c_char_p('')
srs_type = 'user'
if isinstance(srs_input, basestring):
# Encoding to ASCII if unicode passed in.
if isinstance(srs_input, unicode):
srs_input = srs_input.encode('ascii')
try:
# If SRID is a string, e.g., '4326', then make acceptable
# as user input.
srid = int(srs_input)
srs_input = 'EPSG:%d' % srid
except ValueError:
pass
elif isinstance(srs_input, (int, long)):
# EPSG integer code was input.
srs_type = 'epsg'
elif isinstance(srs_input, self.ptr_type):
srs = srs_input
srs_type = 'ogr'
else:
raise TypeError('Invalid SRS type "%s"' % srs_type)
if srs_type == 'ogr':
# Input is already an SRS pointer.
srs = srs_input
else:
# Creating a new SRS pointer, using the string buffer.
srs = capi.new_srs(buf)
# If the pointer is NULL, throw an exception.
if not srs:
raise SRSException('Could not create spatial reference from: %s' % srs_input)
else:
self.ptr = srs
# Importing from either the user input string or an integer SRID.
if srs_type == 'user':
self.import_user_input(srs_input)
elif srs_type == 'epsg':
self.import_epsg(srs_input)
def __del__(self):
"Destroys this spatial reference."
if self._ptr: capi.release_srs(self._ptr)
def __getitem__(self, target):
"""
Returns the value of the given string attribute node, None if the node
doesn't exist. Can also take a tuple as a parameter, (target, child),
where child is the index of the attribute in the WKT. For example:
>>> wkt = 'GEOGCS["WGS 84", DATUM["WGS_1984, ... AUTHORITY["EPSG","4326"]]')
>>> srs = SpatialReference(wkt) # could also use 'WGS84', or 4326
>>> print srs['GEOGCS']
WGS 84
>>> print srs['DATUM']
WGS_1984
>>> print srs['AUTHORITY']
EPSG
>>> print srs['AUTHORITY', 1] # The authority value
4326
>>> print srs['TOWGS84', 4] # the fourth value in this wkt
0
>>> print srs['UNIT|AUTHORITY'] # For the units authority, have to use the pipe symbole.
EPSG
>>> print srs['UNIT|AUTHORITY', 1] # The authority value for the untis
9122
"""
if isinstance(target, tuple):
return self.attr_value(*target)
else:
return self.attr_value(target)
def __str__(self):
"The string representation uses 'pretty' WKT."
return self.pretty_wkt
#### SpatialReference Methods ####
def attr_value(self, target, index=0):
"""
The attribute value for the given target node (e.g. 'PROJCS'). The index
keyword specifies an index of the child node to return.
"""
if not isinstance(target, basestring) or not isinstance(index, int):
raise TypeError
return capi.get_attr_value(self.ptr, target, index)
def auth_name(self, target):
"Returns the authority name for the given string target node."
return capi.get_auth_name(self.ptr, target)
def auth_code(self, target):
"Returns the authority code for the given string target node."
return capi.get_auth_code(self.ptr, target)
def clone(self):
"Returns a clone of this SpatialReference object."
return SpatialReference(capi.clone_srs(self.ptr))
def from_esri(self):
"Morphs this SpatialReference from ESRI's format to EPSG."
capi.morph_from_esri(self.ptr)
def identify_epsg(self):
"""
This method inspects the WKT of this SpatialReference, and will
add EPSG authority nodes where an EPSG identifier is applicable.
"""
capi.identify_epsg(self.ptr)
def to_esri(self):
"Morphs this SpatialReference to ESRI's format."
capi.morph_to_esri(self.ptr)
def validate(self):
"Checks to see if the given spatial reference is valid."
capi.srs_validate(self.ptr)
#### Name & SRID properties ####
@property
def name(self):
"Returns the name of this Spatial Reference."
if self.projected: return self.attr_value('PROJCS')
elif self.geographic: return self.attr_value('GEOGCS')
elif self.local: return self.attr_value('LOCAL_CS')
else: return None
@property
def srid(self):
"Returns the SRID of top-level authority, or None if undefined."
try:
return int(self.attr_value('AUTHORITY', 1))
except (TypeError, ValueError):
return None
#### Unit Properties ####
@property
def linear_name(self):
"Returns the name of the linear units."
units, name = capi.linear_units(self.ptr, byref(c_char_p()))
return name
@property
def linear_units(self):
"Returns the value of the linear units."
units, name = capi.linear_units(self.ptr, byref(c_char_p()))
return units
@property
def angular_name(self):
"Returns the name of the angular units."
units, name = capi.angular_units(self.ptr, byref(c_char_p()))
return name
@property
def angular_units(self):
"Returns the value of the angular units."
units, name = capi.angular_units(self.ptr, byref(c_char_p()))
return units
@property
def units(self):
"""
Returns a 2-tuple of the units value and the units name,
and will automatically determines whether to return the linear
or angular units.
"""
if self.projected or self.local:
return capi.linear_units(self.ptr, byref(c_char_p()))
elif self.geographic:
return capi.angular_units(self.ptr, byref(c_char_p()))
else:
return (None, None)
#### Spheroid/Ellipsoid Properties ####
@property
def ellipsoid(self):
"""
Returns a tuple of the ellipsoid parameters:
(semimajor axis, semiminor axis, and inverse flattening)
"""
return (self.semi_major, self.semi_minor, self.inverse_flattening)
@property
def semi_major(self):
"Returns the Semi Major Axis for this Spatial Reference."
return capi.semi_major(self.ptr, byref(c_int()))
@property
def semi_minor(self):
"Returns the Semi Minor Axis for this Spatial Reference."
return capi.semi_minor(self.ptr, byref(c_int()))
@property
def inverse_flattening(self):
"Returns the Inverse Flattening for this Spatial Reference."
return capi.invflattening(self.ptr, byref(c_int()))
#### Boolean Properties ####
@property
def geographic(self):
"""
Returns True if this SpatialReference is geographic
(root node is GEOGCS).
"""
return bool(capi.isgeographic(self.ptr))
@property
def local(self):
"Returns True if this SpatialReference is local (root node is LOCAL_CS)."
return bool(capi.islocal(self.ptr))
@property
def projected(self):
"""
Returns True if this SpatialReference is a projected coordinate system
(root node is PROJCS).
"""
return bool(capi.isprojected(self.ptr))
#### Import Routines #####
def import_epsg(self, epsg):
"Imports the Spatial Reference from the EPSG code (an integer)."
capi.from_epsg(self.ptr, epsg)
def import_proj(self, proj):
"Imports the Spatial Reference from a PROJ.4 string."
capi.from_proj(self.ptr, proj)
def import_user_input(self, user_input):
"Imports the Spatial Reference from the given user input string."
capi.from_user_input(self.ptr, user_input)
def import_wkt(self, wkt):
"Imports the Spatial Reference from OGC WKT (string)"
capi.from_wkt(self.ptr, byref(c_char_p(wkt)))
def import_xml(self, xml):
"Imports the Spatial Reference from an XML string."
capi.from_xml(self.ptr, xml)
#### Export Properties ####
@property
def wkt(self):
"Returns the WKT representation of this Spatial Reference."
return capi.to_wkt(self.ptr, byref(c_char_p()))
@property
def pretty_wkt(self, simplify=0):
"Returns the 'pretty' representation of the WKT."
return capi.to_pretty_wkt(self.ptr, byref(c_char_p()), simplify)
@property
def proj(self):
"Returns the PROJ.4 representation for this Spatial Reference."
return capi.to_proj(self.ptr, byref(c_char_p()))
@property
def proj4(self):
"Alias for proj()."
return self.proj
@property
def xml(self, dialect=''):
"Returns the XML representation of this Spatial Reference."
return capi.to_xml(self.ptr, byref(c_char_p()), dialect)
class CoordTransform(GDALBase):
"The coordinate system transformation object."
def __init__(self, source, target):
"Initializes on a source and target SpatialReference objects."
if not isinstance(source, SpatialReference) or not isinstance(target, SpatialReference):
raise TypeError('source and target must be of type SpatialReference')
self.ptr = capi.new_ct(source._ptr, target._ptr)
self._srs1_name = source.name
self._srs2_name = target.name
def __del__(self):
"Deletes this Coordinate Transformation object."
if self._ptr: capi.destroy_ct(self._ptr)
def __str__(self):
return 'Transform from "%s" to "%s"' % (self._srs1_name, self._srs2_name)
| ajibawa-2023/Python-Code-Large/train/row_98715 | 171 | 337 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 28], "level": 0, "parent": null, "vector": [8, 0, 0.043, 0.0831, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n The Spatial Reference class, represensents OGR Spatial Reference objects.\n\n Example:\n >>> from django.contrib.gis.gdal import SpatialReference\n >>> srs = SpatialReference('WGS84')\n >>> print srs\n GEOGCS[\"WGS 84\","}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Import_L29_C0", "label": "re import re", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.0861, 0.003, 0, 0.66, 0.1429, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:ImportFrom_L30_C0", "label": "from ctypes import byref, c_char_p, c_int\u2026", "type": "import", "loc": [30, 30], "level": 0, "parent": null, "vector": [1, 0, 0.089, 0.003, 0, 0.66, 0.2857, 182, 0, 4, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["byref", "c_char_p", "c_int", "c_void_p"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import byref, c_char_p, c_int, c_void_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:ImportFrom_L33_C0", "label": "from django.contrib.gis.gdal.base import GDALBase", "type": "import", "loc": [33, 33], "level": 0, "parent": null, "vector": [1, 0, 0.0979, 0.003, 0, 0.66, 0.4286, 771, 0, 1, 0, 0, 771, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.base", "arg_names": [], "import_names": ["GDALBase"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.base import GDALBase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:ImportFrom_L34_C0", "label": "from django.contrib.gis.gdal.error import OGRException, SRSException", "type": "import", "loc": [34, 34], "level": 0, "parent": null, "vector": [1, 0, 0.1009, 0.003, 0, 0.66, 0.5714, 76, 0, 2, 0, 0, 76, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.error", "arg_names": [], "import_names": ["OGRException", "SRSException"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.error import OGRException, SRSException"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:ImportFrom_L35_C0", "label": "from django.contrib.gis.gdal.prototypes import capi", "type": "import", "loc": [35, 35], "level": 0, "parent": null, "vector": [1, 0, 0.1039, 0.003, 0, 0.66, 0.7143, 730, 0, 1, 0, 0, 730, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.prototypes", "arg_names": [], "import_names": ["capi"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal.prototypes import srs as capi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "label": "SpatialReference", "type": "class", "loc": [38, 319], "level": 0, "parent": null, "vector": [3, 0, 0.5297, 0.8368, 0, 0.66, 0.8571, 590, 0, 36, 0, 0, 436, 0, 84], "semantic": {"name": "SpatialReference", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SpatialReference(GDALBase):\n \"\"\"\n A wrapper for the OGRSpatialReference object. According to the GDAL Web site,\n the SpatialReference object \"provide[s] services to represent coordinate \n systems (projections and datums) and to transform between them.\"\n \"\"\"\n\n #### Python 'magic' routines ####"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L39_C4", "label": "expression", "type": "expression", "loc": [39, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [8, 1, 0.1217, 0.0148, 1, 0.79, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n A wrapper for the OGRSpatialReference object. According to the GDAL Web site,\n the SpatialReference object \"provide[s] services to represent coordinate \n systems (projections and datums) and to transform between them.\"\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L46_C4", "label": "__init__", "type": "function", "loc": [46, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.2062, 0.1424, 1, 0.79, 0.0278, 555, 0, 2, 0, 0, 0, 0, 12], "semantic": {"name": "__init__", "arg_names": ["self", "srs_input"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, srs_input=''):\n \"\"\"\n Creates a GDAL OSR Spatial Reference object from the given input.\n The input may be string of OGC Well Known Text (WKT), an integer \n EPSG code, a PROJ.4 string, and/or a projection \"well known\" shorthand \n string (one of 'WGS84', 'WGS72', 'NAD27', 'NAD83').\n \"\"\"\n buf = c_char_p('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L47_C8", "label": "expression", "type": "expression", "loc": [47, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L46_C4", "vector": [8, 2, 0.1469, 0.0178, 2, 0.22, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Creates a GDAL OSR Spatial Reference object from the given input.\n The input may be string of OGC Well Known Text (WKT), an integer \n EPSG code, a PROJ.4 string, and/or a projection \"well known\" shorthand \n string (one of 'WGS84', 'WGS72', 'NAD27', 'NAD83').\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L53_C8", "label": "buf = c_char_p()", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L46_C4", "vector": [14, 2, 0.1573, 0.003, 2, 0.22, 0.1667, 840, 3, 1, 0, 0, 288, 10, 1], "semantic": {"name": "buf", "arg_names": [], "import_names": [], "rhs_call_name": "c_char_p", "annotation": ""}, "snippet": " buf = c_char_p('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L54_C8", "label": "srs_type =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L46_C4", "vector": [14, 2, 0.1602, 0.003, 2, 0.22, 0.3333, 646, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "srs_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " srs_type = 'user'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L56_C8", "label": "if", "type": "if", "loc": [56, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L46_C4", "vector": [4, 2, 0.1929, 0.0564, 2, 0.22, 0.5, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(srs_input, basestring):\n # Encoding to ASCII if unicode passed in.\n if isinstance(srs_input, unicode):\n srs_input = srs_input.encode('ascii')\n try:\n # If SRID is a string, e.g., '4326', then make acceptable\n # as user input.\n srid = int(srs_input)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L58_C12", "label": "if", "type": "if", "loc": [58, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L56_C8", "vector": [4, 3, 0.1736, 0.0059, 3, 0.38, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(srs_input, unicode):\n srs_input = srs_input.encode('ascii')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L59_C16", "label": "srs_input = encode()", "type": "assigned_variable", "loc": [59, 59], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L58_C12", "vector": [14, 4, 0.1751, 0.003, 4, 0.59, 0.0, 220, 3, 1, 0, 0, 623, 10, 1], "semantic": {"name": "srs_input", "arg_names": [], "import_names": [], "rhs_call_name": "encode", "annotation": ""}, "snippet": " srs_input = srs_input.encode('ascii')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Try_L60_C12", "label": "try", "type": "try", "loc": [60, 66], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L56_C8", "vector": [7, 3, 0.1869, 0.0208, 3, 0.38, 0.5, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # If SRID is a string, e.g., '4326', then make acceptable\n # as user input.\n srid = int(srs_input)\n srs_input = 'EPSG:%d' % srid\n except ValueError:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L63_C16", "label": "srid = int()", "type": "assigned_variable", "loc": [63, 63], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:Try_L60_C12", "vector": [14, 4, 0.1869, 0.003, 4, 0.93, 0.0, 357, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "srid", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " srid = int(srs_input)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L64_C16", "label": "srs_input =", "type": "assigned_variable", "loc": [64, 64], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:Try_L60_C12", "vector": [14, 4, 0.1899, 0.003, 4, 0.93, 1.0, 220, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "srs_input", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " srs_input = 'EPSG:%d' % srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L67_C8", "label": "if", "type": "if", "loc": [67, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L56_C8", "vector": [4, 3, 0.2092, 0.0237, 3, 0.38, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(srs_input, (int, long)):\n # EPSG integer code was input.\n srs_type = 'epsg'\n elif isinstance(srs_input, self.ptr_type):\n srs = srs_input\n srs_type = 'ogr'\n else:\n raise TypeError('Invalid SRS type \"%s\"' % srs_type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L69_C12", "label": "srs_type =", "type": "assigned_variable", "loc": [69, 69], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L67_C8", "vector": [14, 4, 0.2047, 0.003, 4, 0.05, 0.0, 646, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "srs_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " srs_type = 'epsg'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L70_C8", "label": "if", "type": "if", "loc": [70, 74], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L67_C8", "vector": [4, 4, 0.2136, 0.0148, 4, 0.05, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(srs_input, self.ptr_type):\n srs = srs_input\n srs_type = 'ogr'\n else:\n raise TypeError('Invalid SRS type \"%s\"' % srs_type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L71_C12", "label": "srs =", "type": "assigned_variable", "loc": [71, 71], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L70_C8", "vector": [14, 5, 0.2107, 0.003, 5, 0.73, 0.0, 95, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "srs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " srs = srs_input"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L72_C12", "label": "srs_type =", "type": "assigned_variable", "loc": [72, 72], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L70_C8", "vector": [14, 5, 0.2136, 0.003, 5, 0.73, 1.0, 646, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "srs_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " srs_type = 'ogr'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L76_C8", "label": "if", "type": "if", "loc": [76, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L46_C4", "vector": [4, 2, 0.2329, 0.0178, 2, 0.22, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if srs_type == 'ogr':\n # Input is already an SRS pointer.\n srs = srs_input\n else:\n # Creating a new SRS pointer, using the string buffer.\n srs = capi.new_srs(buf)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L78_C12", "label": "srs =", "type": "assigned_variable", "loc": [78, 78], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L76_C8", "vector": [14, 3, 0.2315, 0.003, 3, 0.67, 0.0, 95, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "srs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " srs = srs_input"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L81_C12", "label": "srs = new_srs()", "type": "assigned_variable", "loc": [81, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L76_C8", "vector": [14, 3, 0.2404, 0.003, 3, 0.67, 1.0, 95, 3, 1, 0, 0, 252, 10, 1], "semantic": {"name": "srs", "arg_names": [], "import_names": [], "rhs_call_name": "new_srs", "annotation": ""}, "snippet": " srs = capi.new_srs(buf)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L84_C8", "label": "if", "type": "if", "loc": [84, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L46_C4", "vector": [4, 2, 0.2537, 0.0119, 2, 0.22, 0.8333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not srs:\n raise SRSException('Could not create spatial reference from: %s' % srs_input)\n else:\n self.ptr = srs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L87_C12", "label": "self.ptr =", "type": "assigned_variable", "loc": [87, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L84_C8", "vector": [14, 3, 0.2582, 0.003, 3, 0.74, 0.0, 386, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.ptr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ptr = srs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L90_C8", "label": "if", "type": "if", "loc": [90, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L46_C4", "vector": [4, 2, 0.2715, 0.0119, 2, 0.22, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if srs_type == 'user':\n self.import_user_input(srs_input)\n elif srs_type == 'epsg':\n self.import_epsg(srs_input)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L91_C12", "label": "import_user_input()", "type": "expression", "loc": [91, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L90_C8", "vector": [8, 3, 0.27, 0.003, 3, 0.81, 0.0, 199, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "import_user_input", "arg_names": [], "import_names": [], "rhs_call_name": "import_user_input", "annotation": ""}, "snippet": " self.import_user_input(srs_input)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L92_C8", "label": "if", "type": "if", "loc": [92, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L90_C8", "vector": [4, 3, 0.2745, 0.0059, 3, 0.81, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif srs_type == 'epsg':\n self.import_epsg(srs_input)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L93_C12", "label": "import_epsg()", "type": "expression", "loc": [93, 93], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L92_C8", "vector": [8, 4, 0.276, 0.003, 4, 0.72, 0.0, 728, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "import_epsg", "arg_names": [], "import_names": [], "rhs_call_name": "import_epsg", "annotation": ""}, "snippet": " self.import_epsg(srs_input)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L95_C4", "label": "__del__", "type": "function", "loc": [95, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.2849, 0.0089, 1, 0.79, 0.0556, 258, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__del__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __del__(self):\n \"Destroys this spatial reference.\"\n if self._ptr: capi.release_srs(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L96_C8", "label": "expression", "type": "expression", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L95_C4", "vector": [8, 2, 0.2849, 0.003, 2, 0.87, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Destroys this spatial reference.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L97_C8", "label": "if", "type": "if", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L95_C4", "vector": [4, 2, 0.2878, 0.003, 2, 0.87, 1.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._ptr: capi.release_srs(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L97_C22", "label": "release_srs()", "type": "expression", "loc": [97, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L97_C8", "vector": [8, 3, 0.2878, 0.003, 3, 0.09, 0.0, 538, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "release_srs", "arg_names": [], "import_names": [], "rhs_call_name": "release_srs", "annotation": ""}, "snippet": " if self._ptr: capi.release_srs(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L99_C4", "label": "__getitem__", "type": "function", "loc": [99, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.3323, 0.0801, 1, 0.79, 0.0833, 698, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "__getitem__", "arg_names": ["self", "target"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getitem__(self, target):\n \"\"\"\n Returns the value of the given string attribute node, None if the node \n doesn't exist. Can also take a tuple as a parameter, (target, child), \n where child is the index of the attribute in the WKT. For example:\n\n >>> wkt = 'GEOGCS[\"WGS 84\", DATUM[\"WGS_1984, ... AUTHORITY[\"EPSG\",\"4326\"]]')\n >>> srs = SpatialReference(wkt) # could also use 'WGS84', or 4326"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L100_C8", "label": "expression", "type": "expression", "loc": [100, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L99_C4", "vector": [8, 2, 0.3279, 0.0653, 2, 0.65, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the value of the given string attribute node, None if the node \n doesn't exist. Can also take a tuple as a parameter, (target, child), \n where child is the index of the attribute in the WKT. For example:\n\n >>> wkt = 'GEOGCS[\"WGS 84\", DATUM[\"WGS_1984, ... AUTHORITY[\"EPSG\",\"4326\"]]')\n >>> srs = SpatialReference(wkt) # could also use 'WGS84', or 4326\n >>> print srs['GEOGCS']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L122_C8", "label": "if", "type": "if", "loc": [122, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L99_C4", "vector": [4, 2, 0.3665, 0.0119, 2, 0.65, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(target, tuple):\n return self.attr_value(*target)\n else:\n return self.attr_value(target)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L123_C12", "label": "return", "type": "return", "loc": [123, 123], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L122_C8", "vector": [13, 3, 0.365, 0.003, 3, 0.34, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.attr_value(*target)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L125_C12", "label": "return", "type": "return", "loc": [125, 125], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L122_C8", "vector": [13, 3, 0.3709, 0.003, 3, 0.34, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.attr_value(target)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L127_C4", "label": "__str__", "type": "function", "loc": [127, 129], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.3798, 0.0089, 1, 0.79, 0.1111, 527, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n \"The string representation uses 'pretty' WKT.\"\n return self.pretty_wkt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L128_C8", "label": "expression", "type": "expression", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L127_C4", "vector": [8, 2, 0.3798, 0.003, 2, 0.3, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"The string representation uses 'pretty' WKT.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L129_C8", "label": "return", "type": "return", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L127_C4", "vector": [13, 2, 0.3828, 0.003, 2, 0.3, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.pretty_wkt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L132_C4", "label": "attr_value", "type": "function", "loc": [132, 139], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.4021, 0.0237, 1, 0.79, 0.1389, 810, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "attr_value", "arg_names": ["self", "target", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def attr_value(self, target, index=0):\n \"\"\"\n The attribute value for the given target node (e.g. 'PROJCS'). The index\n keyword specifies an index of the child node to return.\n \"\"\"\n if not isinstance(target, basestring) or not isinstance(index, int):\n raise TypeError\n return capi.get_attr_value(self.ptr, target, index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L133_C8", "label": "expression", "type": "expression", "loc": [133, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L132_C4", "vector": [8, 2, 0.3991, 0.0119, 2, 0.33, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n The attribute value for the given target node (e.g. 'PROJCS'). The index\n keyword specifies an index of the child node to return.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L137_C8", "label": "if", "type": "if", "loc": [137, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L132_C4", "vector": [4, 2, 0.408, 0.0059, 2, 0.33, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(target, basestring) or not isinstance(index, int):\n raise TypeError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L139_C8", "label": "return", "type": "return", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L132_C4", "vector": [13, 2, 0.4125, 0.003, 2, 0.33, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_attr_value(self.ptr, target, index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L141_C4", "label": "auth_name", "type": "function", "loc": [141, 143], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.4214, 0.0089, 1, 0.79, 0.1667, 454, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "auth_name", "arg_names": ["self", "target"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def auth_name(self, target):\n \"Returns the authority name for the given string target node.\"\n return capi.get_auth_name(self.ptr, target)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L142_C8", "label": "expression", "type": "expression", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L141_C4", "vector": [8, 2, 0.4214, 0.003, 2, 0.77, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the authority name for the given string target node.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L143_C8", "label": "return", "type": "return", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L141_C4", "vector": [13, 2, 0.4243, 0.003, 2, 0.77, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_auth_name(self.ptr, target)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L145_C4", "label": "auth_code", "type": "function", "loc": [145, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.4332, 0.0089, 1, 0.79, 0.1944, 134, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "auth_code", "arg_names": ["self", "target"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def auth_code(self, target):\n \"Returns the authority code for the given string target node.\"\n return capi.get_auth_code(self.ptr, target)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L146_C8", "label": "expression", "type": "expression", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L145_C4", "vector": [8, 2, 0.4332, 0.003, 2, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the authority code for the given string target node.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L147_C8", "label": "return", "type": "return", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L145_C4", "vector": [13, 2, 0.4362, 0.003, 2, 0.28, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_auth_code(self.ptr, target)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L149_C4", "label": "clone", "type": "function", "loc": [149, 151], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.4451, 0.0089, 1, 0.79, 0.2222, 911, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "clone", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clone(self):\n \"Returns a clone of this SpatialReference object.\"\n return SpatialReference(capi.clone_srs(self.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L150_C8", "label": "expression", "type": "expression", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L149_C4", "vector": [8, 2, 0.4451, 0.003, 2, 0.02, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a clone of this SpatialReference object.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L151_C8", "label": "return", "type": "return", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L149_C4", "vector": [13, 2, 0.4481, 0.003, 2, 0.02, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return SpatialReference(capi.clone_srs(self.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L153_C4", "label": "from_esri", "type": "function", "loc": [153, 155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.457, 0.0089, 1, 0.79, 0.25, 956, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "from_esri", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_esri(self):\n \"Morphs this SpatialReference from ESRI's format to EPSG.\"\n capi.morph_from_esri(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L154_C8", "label": "expression", "type": "expression", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L153_C4", "vector": [8, 2, 0.457, 0.003, 2, 0.8, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Morphs this SpatialReference from ESRI's format to EPSG.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L155_C8", "label": "morph_from_esri()", "type": "expression", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L153_C4", "vector": [8, 2, 0.4599, 0.003, 2, 0.8, 1.0, 391, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "morph_from_esri", "arg_names": [], "import_names": [], "rhs_call_name": "morph_from_esri", "annotation": ""}, "snippet": " capi.morph_from_esri(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L157_C4", "label": "identify_epsg", "type": "function", "loc": [157, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.4733, 0.0178, 1, 0.79, 0.2778, 475, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "identify_epsg", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def identify_epsg(self):\n \"\"\"\n This method inspects the WKT of this SpatialReference, and will\n add EPSG authority nodes where an EPSG identifier is applicable.\n \"\"\"\n capi.identify_epsg(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L158_C8", "label": "expression", "type": "expression", "loc": [158, 161], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L157_C4", "vector": [8, 2, 0.4733, 0.0119, 2, 0.04, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n This method inspects the WKT of this SpatialReference, and will\n add EPSG authority nodes where an EPSG identifier is applicable.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L162_C8", "label": "identify_epsg()", "type": "expression", "loc": [162, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L157_C4", "vector": [8, 2, 0.4807, 0.003, 2, 0.04, 1.0, 475, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "identify_epsg", "arg_names": [], "import_names": [], "rhs_call_name": "identify_epsg", "annotation": ""}, "snippet": " capi.identify_epsg(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L164_C4", "label": "to_esri", "type": "function", "loc": [164, 166], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.4896, 0.0089, 1, 0.79, 0.3056, 993, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "to_esri", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def to_esri(self):\n \"Morphs this SpatialReference to ESRI's format.\"\n capi.morph_to_esri(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L165_C8", "label": "expression", "type": "expression", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L164_C4", "vector": [8, 2, 0.4896, 0.003, 2, 0.16, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Morphs this SpatialReference to ESRI's format.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L166_C8", "label": "morph_to_esri()", "type": "expression", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L164_C4", "vector": [8, 2, 0.4926, 0.003, 2, 0.16, 1.0, 629, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "morph_to_esri", "arg_names": [], "import_names": [], "rhs_call_name": "morph_to_esri", "annotation": ""}, "snippet": " capi.morph_to_esri(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L168_C4", "label": "validate", "type": "function", "loc": [168, 170], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.5015, 0.0089, 1, 0.79, 0.3333, 628, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "validate", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def validate(self):\n \"Checks to see if the given spatial reference is valid.\"\n capi.srs_validate(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L169_C8", "label": "expression", "type": "expression", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L168_C4", "vector": [8, 2, 0.5015, 0.003, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Checks to see if the given spatial reference is valid.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L170_C8", "label": "srs_validate()", "type": "expression", "loc": [170, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L168_C4", "vector": [8, 2, 0.5045, 0.003, 2, 0.98, 1.0, 737, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "srs_validate", "arg_names": [], "import_names": [], "rhs_call_name": "srs_validate", "annotation": ""}, "snippet": " capi.srs_validate(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L174_C4", "label": "name", "type": "function", "loc": [174, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.5237, 0.0178, 1, 0.79, 0.3611, 57, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def name(self):\n \"Returns the name of this Spatial Reference.\"\n if self.projected: return self.attr_value('PROJCS')\n elif self.geographic: return self.attr_value('GEOGCS')\n elif self.local: return self.attr_value('LOCAL_CS')\n else: return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L175_C8", "label": "expression", "type": "expression", "loc": [175, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L174_C4", "vector": [8, 2, 0.5193, 0.003, 2, 0.63, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the name of this Spatial Reference.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L176_C8", "label": "if", "type": "if", "loc": [176, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L174_C4", "vector": [4, 2, 0.5267, 0.0119, 2, 0.63, 1.0, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.projected: return self.attr_value('PROJCS')\n elif self.geographic: return self.attr_value('GEOGCS')\n elif self.local: return self.attr_value('LOCAL_CS')\n else: return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L176_C27", "label": "return", "type": "return", "loc": [176, 176], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L176_C8", "vector": [13, 3, 0.5223, 0.003, 3, 0.74, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.projected: return self.attr_value('PROJCS')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L177_C8", "label": "if", "type": "if", "loc": [177, 179], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L176_C8", "vector": [4, 3, 0.5282, 0.0089, 3, 0.74, 1.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self.geographic: return self.attr_value('GEOGCS')\n elif self.local: return self.attr_value('LOCAL_CS')\n else: return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L177_C30", "label": "return", "type": "return", "loc": [177, 177], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L177_C8", "vector": [13, 4, 0.5252, 0.003, 4, 0.43, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self.geographic: return self.attr_value('GEOGCS')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L178_C8", "label": "if", "type": "if", "loc": [178, 179], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L177_C8", "vector": [4, 4, 0.5297, 0.0059, 4, 0.43, 1.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self.local: return self.attr_value('LOCAL_CS')\n else: return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L178_C25", "label": "return", "type": "return", "loc": [178, 178], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L178_C8", "vector": [13, 5, 0.5282, 0.003, 5, 0.35, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self.local: return self.attr_value('LOCAL_CS')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L179_C14", "label": "return", "type": "return", "loc": [179, 179], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L178_C8", "vector": [13, 5, 0.5312, 0.003, 5, 0.35, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " else: return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L182_C4", "label": "srid", "type": "function", "loc": [182, 187], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.5475, 0.0178, 1, 0.79, 0.3889, 357, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "srid", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def srid(self):\n \"Returns the SRID of top-level authority, or None if undefined.\"\n try:\n return int(self.attr_value('AUTHORITY', 1))\n except (TypeError, ValueError):\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L183_C8", "label": "expression", "type": "expression", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L182_C4", "vector": [8, 2, 0.543, 0.003, 2, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the SRID of top-level authority, or None if undefined.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Try_L184_C8", "label": "try", "type": "try", "loc": [184, 187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L182_C4", "vector": [7, 2, 0.5504, 0.0119, 2, 0.28, 1.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return int(self.attr_value('AUTHORITY', 1))\n except (TypeError, ValueError):\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L185_C12", "label": "return", "type": "return", "loc": [185, 185], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:Try_L184_C8", "vector": [13, 3, 0.549, 0.003, 3, 0.25, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return int(self.attr_value('AUTHORITY', 1))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L187_C12", "label": "return", "type": "return", "loc": [187, 187], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:Try_L184_C8", "vector": [13, 3, 0.5549, 0.003, 3, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L191_C4", "label": "linear_name", "type": "function", "loc": [191, 194], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.5712, 0.0119, 1, 0.79, 0.4167, 118, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "linear_name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def linear_name(self):\n \"Returns the name of the linear units.\"\n units, name = capi.linear_units(self.ptr, byref(c_char_p()))\n return name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L192_C8", "label": "expression", "type": "expression", "loc": [192, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L191_C4", "vector": [8, 2, 0.5697, 0.003, 2, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the name of the linear units.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L193_C8", "label": "units, name = linear_units()", "type": "assigned_variable", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L191_C4", "vector": [14, 2, 0.5727, 0.003, 2, 0.72, 0.5, 275, 3, 2, 0, 0, 200, 10, 3], "semantic": {"name": "units, name", "arg_names": [], "import_names": [], "rhs_call_name": "linear_units", "annotation": ""}, "snippet": " units, name = capi.linear_units(self.ptr, byref(c_char_p()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L194_C8", "label": "return", "type": "return", "loc": [194, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L191_C4", "vector": [13, 2, 0.5757, 0.003, 2, 0.72, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L197_C4", "label": "linear_units", "type": "function", "loc": [197, 200], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.589, 0.0119, 1, 0.79, 0.4444, 200, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "linear_units", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def linear_units(self):\n \"Returns the value of the linear units.\"\n units, name = capi.linear_units(self.ptr, byref(c_char_p()))\n return units"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L198_C8", "label": "expression", "type": "expression", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L197_C4", "vector": [8, 2, 0.5875, 0.003, 2, 0.42, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the value of the linear units.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L199_C8", "label": "units, name = linear_units()", "type": "assigned_variable", "loc": [199, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L197_C4", "vector": [14, 2, 0.5905, 0.003, 2, 0.42, 0.5, 275, 3, 2, 0, 0, 200, 10, 3], "semantic": {"name": "units, name", "arg_names": [], "import_names": [], "rhs_call_name": "linear_units", "annotation": ""}, "snippet": " units, name = capi.linear_units(self.ptr, byref(c_char_p()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L200_C8", "label": "return", "type": "return", "loc": [200, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L197_C4", "vector": [13, 2, 0.5935, 0.003, 2, 0.42, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return units"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L203_C4", "label": "angular_name", "type": "function", "loc": [203, 206], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.6068, 0.0119, 1, 0.79, 0.4722, 991, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "angular_name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def angular_name(self):\n \"Returns the name of the angular units.\"\n units, name = capi.angular_units(self.ptr, byref(c_char_p()))\n return name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L204_C8", "label": "expression", "type": "expression", "loc": [204, 204], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L203_C4", "vector": [8, 2, 0.6053, 0.003, 2, 0.12, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the name of the angular units.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L205_C8", "label": "units, name = angular_units()", "type": "assigned_variable", "loc": [205, 205], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L203_C4", "vector": [14, 2, 0.6083, 0.003, 2, 0.12, 0.5, 275, 3, 2, 0, 0, 279, 10, 3], "semantic": {"name": "units, name", "arg_names": [], "import_names": [], "rhs_call_name": "angular_units", "annotation": ""}, "snippet": " units, name = capi.angular_units(self.ptr, byref(c_char_p()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L206_C8", "label": "return", "type": "return", "loc": [206, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L203_C4", "vector": [13, 2, 0.6113, 0.003, 2, 0.12, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L209_C4", "label": "angular_units", "type": "function", "loc": [209, 212], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.6246, 0.0119, 1, 0.79, 0.5, 279, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "angular_units", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def angular_units(self):\n \"Returns the value of the angular units.\"\n units, name = capi.angular_units(self.ptr, byref(c_char_p()))\n return units"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L210_C8", "label": "expression", "type": "expression", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L209_C4", "vector": [8, 2, 0.6231, 0.003, 2, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the value of the angular units.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L211_C8", "label": "units, name = angular_units()", "type": "assigned_variable", "loc": [211, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L209_C4", "vector": [14, 2, 0.6261, 0.003, 2, 0.83, 0.5, 275, 3, 2, 0, 0, 279, 10, 3], "semantic": {"name": "units, name", "arg_names": [], "import_names": [], "rhs_call_name": "angular_units", "annotation": ""}, "snippet": " units, name = capi.angular_units(self.ptr, byref(c_char_p()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L212_C8", "label": "return", "type": "return", "loc": [212, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L209_C4", "vector": [13, 2, 0.6291, 0.003, 2, 0.83, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return units"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L215_C4", "label": "units", "type": "function", "loc": [215, 226], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.6543, 0.0356, 1, 0.79, 0.5278, 805, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "units", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def units(self):\n \"\"\"\n Returns a 2-tuple of the units value and the units name, \n and will automatically determines whether to return the linear\n or angular units.\n \"\"\"\n if self.projected or self.local:\n return capi.linear_units(self.ptr, byref(c_char_p()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L216_C8", "label": "expression", "type": "expression", "loc": [216, 220], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L215_C4", "vector": [8, 2, 0.6469, 0.0148, 2, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a 2-tuple of the units value and the units name, \n and will automatically determines whether to return the linear\n or angular units.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L221_C8", "label": "if", "type": "if", "loc": [221, 226], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L215_C4", "vector": [4, 2, 0.6632, 0.0178, 2, 0.91, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.projected or self.local:\n return capi.linear_units(self.ptr, byref(c_char_p()))\n elif self.geographic:\n return capi.angular_units(self.ptr, byref(c_char_p()))\n else:\n return (None, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L222_C12", "label": "return", "type": "return", "loc": [222, 222], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L221_C8", "vector": [13, 3, 0.6588, 0.003, 3, 0.53, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.linear_units(self.ptr, byref(c_char_p()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L223_C8", "label": "if", "type": "if", "loc": [223, 226], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L221_C8", "vector": [4, 3, 0.6662, 0.0119, 3, 0.53, 1.0, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self.geographic:\n return capi.angular_units(self.ptr, byref(c_char_p()))\n else:\n return (None, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L224_C12", "label": "return", "type": "return", "loc": [224, 224], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L223_C8", "vector": [13, 4, 0.6647, 0.003, 4, 0.66, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.angular_units(self.ptr, byref(c_char_p()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L226_C12", "label": "return", "type": "return", "loc": [226, 226], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L223_C8", "vector": [13, 4, 0.6706, 0.003, 4, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (None, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L230_C4", "label": "ellipsoid", "type": "function", "loc": [230, 235], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.6899, 0.0178, 1, 0.79, 0.5556, 372, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "ellipsoid", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def ellipsoid(self):\n \"\"\"\n Returns a tuple of the ellipsoid parameters:\n (semimajor axis, semiminor axis, and inverse flattening)\n \"\"\"\n return (self.semi_major, self.semi_minor, self.inverse_flattening)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L231_C8", "label": "expression", "type": "expression", "loc": [231, 234], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L230_C4", "vector": [8, 2, 0.6899, 0.0119, 2, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a tuple of the ellipsoid parameters:\n (semimajor axis, semiminor axis, and inverse flattening)\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L235_C8", "label": "return", "type": "return", "loc": [235, 235], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L230_C4", "vector": [13, 2, 0.6973, 0.003, 2, 0.37, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (self.semi_major, self.semi_minor, self.inverse_flattening)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L238_C4", "label": "semi_major", "type": "function", "loc": [238, 240], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.7092, 0.0089, 1, 0.79, 0.5833, 727, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "semi_major", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def semi_major(self):\n \"Returns the Semi Major Axis for this Spatial Reference.\"\n return capi.semi_major(self.ptr, byref(c_int()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L239_C8", "label": "expression", "type": "expression", "loc": [239, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L238_C4", "vector": [8, 2, 0.7092, 0.003, 2, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the Semi Major Axis for this Spatial Reference.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L240_C8", "label": "return", "type": "return", "loc": [240, 240], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L238_C4", "vector": [13, 2, 0.7122, 0.003, 2, 0.13, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.semi_major(self.ptr, byref(c_int()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L243_C4", "label": "semi_minor", "type": "function", "loc": [243, 245], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.724, 0.0089, 1, 0.79, 0.6111, 958, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "semi_minor", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def semi_minor(self):\n \"Returns the Semi Minor Axis for this Spatial Reference.\"\n return capi.semi_minor(self.ptr, byref(c_int()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L244_C8", "label": "expression", "type": "expression", "loc": [244, 244], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L243_C4", "vector": [8, 2, 0.724, 0.003, 2, 0.3, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the Semi Minor Axis for this Spatial Reference.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L245_C8", "label": "return", "type": "return", "loc": [245, 245], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L243_C4", "vector": [13, 2, 0.727, 0.003, 2, 0.3, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.semi_minor(self.ptr, byref(c_int()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L248_C4", "label": "inverse_flattening", "type": "function", "loc": [248, 250], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.7389, 0.0089, 1, 0.79, 0.6389, 908, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "inverse_flattening", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def inverse_flattening(self):\n \"Returns the Inverse Flattening for this Spatial Reference.\"\n return capi.invflattening(self.ptr, byref(c_int()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L249_C8", "label": "expression", "type": "expression", "loc": [249, 249], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L248_C4", "vector": [8, 2, 0.7389, 0.003, 2, 0.2, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the Inverse Flattening for this Spatial Reference.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L250_C8", "label": "return", "type": "return", "loc": [250, 250], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L248_C4", "vector": [13, 2, 0.7418, 0.003, 2, 0.2, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.invflattening(self.ptr, byref(c_int()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L254_C4", "label": "geographic", "type": "function", "loc": [254, 259], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.7611, 0.0178, 1, 0.79, 0.6667, 883, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "geographic", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geographic(self):\n \"\"\"\n Returns True if this SpatialReference is geographic \n (root node is GEOGCS).\n \"\"\"\n return bool(capi.isgeographic(self.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L255_C8", "label": "expression", "type": "expression", "loc": [255, 258], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L254_C4", "vector": [8, 2, 0.7611, 0.0119, 2, 0.71, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns True if this SpatialReference is geographic \n (root node is GEOGCS).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L259_C8", "label": "return", "type": "return", "loc": [259, 259], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L254_C4", "vector": [13, 2, 0.7685, 0.003, 2, 0.71, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bool(capi.isgeographic(self.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L262_C4", "label": "local", "type": "function", "loc": [262, 264], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.7804, 0.0089, 1, 0.79, 0.6944, 605, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "local", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def local(self):\n \"Returns True if this SpatialReference is local (root node is LOCAL_CS).\"\n return bool(capi.islocal(self.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L263_C8", "label": "expression", "type": "expression", "loc": [263, 263], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L262_C4", "vector": [8, 2, 0.7804, 0.003, 2, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns True if this SpatialReference is local (root node is LOCAL_CS).\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L264_C8", "label": "return", "type": "return", "loc": [264, 264], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L262_C4", "vector": [13, 2, 0.7834, 0.003, 2, 0.25, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bool(capi.islocal(self.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L267_C4", "label": "projected", "type": "function", "loc": [267, 272], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.7997, 0.0178, 1, 0.79, 0.7222, 797, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "projected", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def projected(self):\n \"\"\"\n Returns True if this SpatialReference is a projected coordinate system \n (root node is PROJCS).\n \"\"\"\n return bool(capi.isprojected(self.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L268_C8", "label": "expression", "type": "expression", "loc": [268, 271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L267_C4", "vector": [8, 2, 0.7997, 0.0119, 2, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns True if this SpatialReference is a projected coordinate system \n (root node is PROJCS).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L272_C8", "label": "return", "type": "return", "loc": [272, 272], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L267_C4", "vector": [13, 2, 0.8071, 0.003, 2, 0.67, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bool(capi.isprojected(self.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L275_C4", "label": "import_epsg", "type": "function", "loc": [275, 277], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.819, 0.0089, 1, 0.79, 0.75, 728, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "import_epsg", "arg_names": ["self", "epsg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def import_epsg(self, epsg):\n \"Imports the Spatial Reference from the EPSG code (an integer).\"\n capi.from_epsg(self.ptr, epsg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L276_C8", "label": "expression", "type": "expression", "loc": [276, 276], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L275_C4", "vector": [8, 2, 0.819, 0.003, 2, 0.19, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Imports the Spatial Reference from the EPSG code (an integer).\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L277_C8", "label": "from_epsg()", "type": "expression", "loc": [277, 277], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L275_C4", "vector": [8, 2, 0.822, 0.003, 2, 0.19, 1.0, 268, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "from_epsg", "arg_names": [], "import_names": [], "rhs_call_name": "from_epsg", "annotation": ""}, "snippet": " capi.from_epsg(self.ptr, epsg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L279_C4", "label": "import_proj", "type": "function", "loc": [279, 281], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.8309, 0.0089, 1, 0.79, 0.7778, 763, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "import_proj", "arg_names": ["self", "proj"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def import_proj(self, proj):\n \"Imports the Spatial Reference from a PROJ.4 string.\"\n capi.from_proj(self.ptr, proj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L280_C8", "label": "expression", "type": "expression", "loc": [280, 280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L279_C4", "vector": [8, 2, 0.8309, 0.003, 2, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Imports the Spatial Reference from a PROJ.4 string.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L281_C8", "label": "from_proj()", "type": "expression", "loc": [281, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L279_C4", "vector": [8, 2, 0.8338, 0.003, 2, 0.54, 1.0, 571, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "from_proj", "arg_names": [], "import_names": [], "rhs_call_name": "from_proj", "annotation": ""}, "snippet": " capi.from_proj(self.ptr, proj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L283_C4", "label": "import_user_input", "type": "function", "loc": [283, 285], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.8427, 0.0089, 1, 0.79, 0.8056, 199, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "import_user_input", "arg_names": ["self", "user_input"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def import_user_input(self, user_input):\n \"Imports the Spatial Reference from the given user input string.\"\n capi.from_user_input(self.ptr, user_input)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L284_C8", "label": "expression", "type": "expression", "loc": [284, 284], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L283_C4", "vector": [8, 2, 0.8427, 0.003, 2, 0.14, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Imports the Spatial Reference from the given user input string.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L285_C8", "label": "from_user_input()", "type": "expression", "loc": [285, 285], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L283_C4", "vector": [8, 2, 0.8457, 0.003, 2, 0.14, 1.0, 542, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "from_user_input", "arg_names": [], "import_names": [], "rhs_call_name": "from_user_input", "annotation": ""}, "snippet": " capi.from_user_input(self.ptr, user_input)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L287_C4", "label": "import_wkt", "type": "function", "loc": [287, 289], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.8546, 0.0089, 1, 0.79, 0.8333, 796, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "import_wkt", "arg_names": ["self", "wkt"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def import_wkt(self, wkt):\n \"Imports the Spatial Reference from OGC WKT (string)\"\n capi.from_wkt(self.ptr, byref(c_char_p(wkt)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L288_C8", "label": "expression", "type": "expression", "loc": [288, 288], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L287_C4", "vector": [8, 2, 0.8546, 0.003, 2, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Imports the Spatial Reference from OGC WKT (string)\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L289_C8", "label": "from_wkt()", "type": "expression", "loc": [289, 289], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L287_C4", "vector": [8, 2, 0.8576, 0.003, 2, 0.38, 1.0, 252, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "from_wkt", "arg_names": [], "import_names": [], "rhs_call_name": "from_wkt", "annotation": ""}, "snippet": " capi.from_wkt(self.ptr, byref(c_char_p(wkt)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L291_C4", "label": "import_xml", "type": "function", "loc": [291, 293], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.8665, 0.0089, 1, 0.79, 0.8611, 597, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "import_xml", "arg_names": ["self", "xml"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def import_xml(self, xml):\n \"Imports the Spatial Reference from an XML string.\"\n capi.from_xml(self.ptr, xml)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L292_C8", "label": "expression", "type": "expression", "loc": [292, 292], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L291_C4", "vector": [8, 2, 0.8665, 0.003, 2, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Imports the Spatial Reference from an XML string.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L293_C8", "label": "from_xml()", "type": "expression", "loc": [293, 293], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L291_C4", "vector": [8, 2, 0.8694, 0.003, 2, 0.85, 1.0, 125, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "from_xml", "arg_names": [], "import_names": [], "rhs_call_name": "from_xml", "annotation": ""}, "snippet": " capi.from_xml(self.ptr, xml)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L297_C4", "label": "wkt", "type": "function", "loc": [297, 299], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.8843, 0.0089, 1, 0.79, 0.8889, 836, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "wkt", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wkt(self):\n \"Returns the WKT representation of this Spatial Reference.\"\n return capi.to_wkt(self.ptr, byref(c_char_p()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L298_C8", "label": "expression", "type": "expression", "loc": [298, 298], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L297_C4", "vector": [8, 2, 0.8843, 0.003, 2, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the WKT representation of this Spatial Reference.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L299_C8", "label": "return", "type": "return", "loc": [299, 299], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L297_C4", "vector": [13, 2, 0.8872, 0.003, 2, 0.41, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.to_wkt(self.ptr, byref(c_char_p()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L302_C4", "label": "pretty_wkt", "type": "function", "loc": [302, 304], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.8991, 0.0089, 1, 0.79, 0.9167, 692, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "pretty_wkt", "arg_names": ["self", "simplify"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def pretty_wkt(self, simplify=0):\n \"Returns the 'pretty' representation of the WKT.\"\n return capi.to_pretty_wkt(self.ptr, byref(c_char_p()), simplify)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L303_C8", "label": "expression", "type": "expression", "loc": [303, 303], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L302_C4", "vector": [8, 2, 0.8991, 0.003, 2, 0.6, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the 'pretty' representation of the WKT.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L304_C8", "label": "return", "type": "return", "loc": [304, 304], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L302_C4", "vector": [13, 2, 0.9021, 0.003, 2, 0.6, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.to_pretty_wkt(self.ptr, byref(c_char_p()), simplify)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L307_C4", "label": "proj", "type": "function", "loc": [307, 309], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.9139, 0.0089, 1, 0.79, 0.9444, 88, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "proj", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def proj(self):\n \"Returns the PROJ.4 representation for this Spatial Reference.\"\n return capi.to_proj(self.ptr, byref(c_char_p()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L308_C8", "label": "expression", "type": "expression", "loc": [308, 308], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L307_C4", "vector": [8, 2, 0.9139, 0.003, 2, 0.04, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the PROJ.4 representation for this Spatial Reference.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L309_C8", "label": "return", "type": "return", "loc": [309, 309], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L307_C4", "vector": [13, 2, 0.9169, 0.003, 2, 0.04, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.to_proj(self.ptr, byref(c_char_p()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L312_C4", "label": "proj4", "type": "function", "loc": [312, 314], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.9288, 0.0089, 1, 0.79, 0.9722, 452, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "proj4", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def proj4(self):\n \"Alias for proj().\"\n return self.proj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L313_C8", "label": "expression", "type": "expression", "loc": [313, 313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L312_C4", "vector": [8, 2, 0.9288, 0.003, 2, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Alias for proj().\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L314_C8", "label": "return", "type": "return", "loc": [314, 314], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L312_C4", "vector": [13, 2, 0.9318, 0.003, 2, 0.07, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.proj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L317_C4", "label": "xml", "type": "function", "loc": [317, 319], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "vector": [2, 1, 0.9436, 0.0089, 1, 0.79, 1.0, 324, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "xml", "arg_names": ["self", "dialect"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def xml(self, dialect=''):\n \"Returns the XML representation of this Spatial Reference.\"\n return capi.to_xml(self.ptr, byref(c_char_p()), dialect)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L318_C8", "label": "expression", "type": "expression", "loc": [318, 318], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L317_C4", "vector": [8, 2, 0.9436, 0.003, 2, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the XML representation of this Spatial Reference.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L319_C8", "label": "return", "type": "return", "loc": [319, 319], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L317_C4", "vector": [13, 2, 0.9466, 0.003, 2, 0.83, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.to_xml(self.ptr, byref(c_char_p()), dialect)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L321_C0", "label": "CoordTransform", "type": "class", "loc": [321, 337], "level": 0, "parent": null, "vector": [3, 0, 0.9763, 0.0504, 0, 0.66, 1.0, 453, 0, 3, 0, 0, 436, 0, 5], "semantic": {"name": "CoordTransform", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CoordTransform(GDALBase):\n \"The coordinate system transformation object.\"\n\n def __init__(self, source, target):\n \"Initializes on a source and target SpatialReference objects.\"\n if not isinstance(source, SpatialReference) or not isinstance(target, SpatialReference):\n raise TypeError('source and target must be of type SpatialReference')\n self.ptr = capi.new_ct(source._ptr, target._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L322_C4", "label": "expression", "type": "expression", "loc": [322, 322], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L321_C0", "vector": [8, 1, 0.9555, 0.003, 1, 0.58, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"The coordinate system transformation object.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L324_C4", "label": "__init__", "type": "function", "loc": [324, 330], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L321_C0", "vector": [2, 1, 0.9703, 0.0208, 1, 0.58, 0.3333, 555, 0, 3, 0, 0, 0, 0, 4], "semantic": {"name": "__init__", "arg_names": ["self", "source", "target"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, source, target):\n \"Initializes on a source and target SpatialReference objects.\"\n if not isinstance(source, SpatialReference) or not isinstance(target, SpatialReference):\n raise TypeError('source and target must be of type SpatialReference')\n self.ptr = capi.new_ct(source._ptr, target._ptr)\n self._srs1_name = source.name\n self._srs2_name = target.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L325_C8", "label": "expression", "type": "expression", "loc": [325, 325], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L324_C4", "vector": [8, 2, 0.9644, 0.003, 2, 0.3, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Initializes on a source and target SpatialReference objects.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L326_C8", "label": "if", "type": "if", "loc": [326, 327], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L324_C4", "vector": [4, 2, 0.9688, 0.0059, 2, 0.3, 0.25, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(source, SpatialReference) or not isinstance(target, SpatialReference):\n raise TypeError('source and target must be of type SpatialReference')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L328_C8", "label": "self.ptr = new_ct()", "type": "assigned_variable", "loc": [328, 328], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L324_C4", "vector": [14, 2, 0.9733, 0.003, 2, 0.3, 0.5, 386, 3, 2, 0, 0, 404, 10, 1], "semantic": {"name": "self.ptr", "arg_names": [], "import_names": [], "rhs_call_name": "new_ct", "annotation": ""}, "snippet": " self.ptr = capi.new_ct(source._ptr, target._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L329_C8", "label": "self._srs1_name =", "type": "assigned_variable", "loc": [329, 329], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L324_C4", "vector": [14, 2, 0.9763, 0.003, 2, 0.3, 0.75, 671, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._srs1_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._srs1_name = source.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L330_C8", "label": "self._srs2_name =", "type": "assigned_variable", "loc": [330, 330], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L324_C4", "vector": [14, 2, 0.9792, 0.003, 2, 0.3, 1.0, 87, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._srs2_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._srs2_name = target.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L332_C4", "label": "__del__", "type": "function", "loc": [332, 334], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L321_C0", "vector": [2, 1, 0.9881, 0.0089, 1, 0.58, 0.6667, 258, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__del__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __del__(self):\n \"Deletes this Coordinate Transformation object.\"\n if self._ptr: capi.destroy_ct(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L333_C8", "label": "expression", "type": "expression", "loc": [333, 333], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L332_C4", "vector": [8, 2, 0.9881, 0.003, 2, 0.95, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Deletes this Coordinate Transformation object.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L334_C8", "label": "if", "type": "if", "loc": [334, 334], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L332_C4", "vector": [4, 2, 0.9911, 0.003, 2, 0.95, 1.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._ptr: capi.destroy_ct(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L334_C22", "label": "destroy_ct()", "type": "expression", "loc": [334, 334], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L334_C8", "vector": [8, 3, 0.9911, 0.003, 3, 0.67, 0.0, 575, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "destroy_ct", "arg_names": [], "import_names": [], "rhs_call_name": "destroy_ct", "annotation": ""}, "snippet": " if self._ptr: capi.destroy_ct(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L336_C4", "label": "__str__", "type": "function", "loc": [336, 337], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L321_C0", "vector": [2, 1, 0.9985, 0.0059, 1, 0.58, 1.0, 527, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n return 'Transform from \"%s\" to \"%s\"' % (self._srs1_name, self._srs2_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L337_C8", "label": "return", "type": "return", "loc": [337, 337], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L336_C4", "vector": [13, 2, 1.0, 0.003, 2, 0.22, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'Transform from \"%s\" to \"%s\"' % (self._srs1_name, self._srs2_name)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L58_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L58_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L59_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Try_L60_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:Try_L60_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L63_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:Try_L60_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L64_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L67_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L67_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L71_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L72_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L76_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L76_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L81_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L84_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L87_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L90_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L91_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L90_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L92_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L93_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L95_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L95_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L97_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L97_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L123_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L125_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L127_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L127_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L141_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L141_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L174_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L174_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L175_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L174_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L176_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L176_C27"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L176_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L177_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L177_C30"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L177_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L178_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L178_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L178_C25"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L178_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L179_C14"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Try_L184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:Try_L184_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L185_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:Try_L184_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L187_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L191_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L191_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L192_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L191_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L191_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L194_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L197_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L197_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L197_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L199_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L197_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L203_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L203_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L204_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L203_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L205_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L203_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L206_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L209_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L209_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L210_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L209_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L211_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L209_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L212_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L215_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L215_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L216_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L215_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L221_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L221_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L222_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L221_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L223_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L223_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L224_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L223_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L226_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L230_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L230_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L231_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L230_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L235_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L238_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L238_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L239_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L238_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L243_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L244_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L243_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L245_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L248_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L248_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L249_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L248_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L250_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L254_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L254_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L255_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L254_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L259_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L262_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L262_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L263_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L262_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L264_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L267_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L267_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L268_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L267_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L272_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L275_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L275_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L276_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L275_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L279_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L280_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L281_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L283_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L283_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L284_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L283_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L285_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L287_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L287_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L288_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L287_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L289_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L291_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L291_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L292_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L291_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L293_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L297_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L297_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L298_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L297_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L299_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L302_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L303_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L304_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L307_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L307_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L308_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L307_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L309_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L312_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L312_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L313_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L312_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L314_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L317_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L317_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L318_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L317_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L319_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L321_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L322_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L321_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L324_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L324_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L325_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L324_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L326_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L324_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L328_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L324_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L329_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L324_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Assign_L330_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L321_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L332_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L332_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L333_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L332_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L334_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:If_L334_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L334_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L321_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L336_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:FunctionDef_L336_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Return_L337_C8"}] |
from django.conf import settings
from django.contrib.admin import ModelAdmin
from django.contrib.gis.admin.widgets import OpenLayersWidget
from django.contrib.gis.gdal import OGRGeomType
from django.contrib.gis.db import models
class GeoModelAdmin(ModelAdmin):
"""
The administration options class for Geographic models. Map settings
may be overloaded from their defaults to create custom maps.
"""
# The default map settings that may be overloaded -- still subject
# to API changes.
default_lon = 0
default_lat = 0
default_zoom = 4
display_wkt = False
display_srid = False
extra_js = []
num_zoom = 18
max_zoom = False
min_zoom = False
units = False
max_resolution = False
max_extent = False
modifiable = True
mouse_position = True
scale_text = True
layerswitcher = True
scrollable = True
map_width = 600
map_height = 400
map_srid = 4326
map_template = 'gis/admin/openlayers.html'
openlayers_url = 'http://openlayers.org/api/2.10/OpenLayers.js'
point_zoom = num_zoom - 6
wms_url = 'http://labs.metacarta.com/wms/vmap0'
wms_layer = 'basic'
wms_name = 'OpenLayers WMS'
debug = False
widget = OpenLayersWidget
def _media(self):
"Injects OpenLayers JavaScript into the admin."
media = super(GeoModelAdmin, self)._media()
media.add_js([self.openlayers_url])
media.add_js(self.extra_js)
return media
media = property(_media)
def formfield_for_dbfield(self, db_field, **kwargs):
"""
Overloaded from ModelAdmin so that an OpenLayersWidget is used
for viewing/editing GeometryFields.
"""
if isinstance(db_field, models.GeometryField):
request = kwargs.pop('request', None)
# Setting the widget with the newly defined widget.
kwargs['widget'] = self.get_map_widget(db_field)
return db_field.formfield(**kwargs)
else:
return super(GeoModelAdmin, self).formfield_for_dbfield(db_field, **kwargs)
def get_map_widget(self, db_field):
"""
Returns a subclass of the OpenLayersWidget (or whatever was specified
in the `widget` attribute) using the settings from the attributes set
in this class.
"""
is_collection = db_field.geom_type in ('MULTIPOINT', 'MULTILINESTRING', 'MULTIPOLYGON', 'GEOMETRYCOLLECTION')
if is_collection:
if db_field.geom_type == 'GEOMETRYCOLLECTION': collection_type = 'Any'
else: collection_type = OGRGeomType(db_field.geom_type.replace('MULTI', ''))
else:
collection_type = 'None'
class OLMap(self.widget):
template = self.map_template
geom_type = db_field.geom_type
params = {'default_lon' : self.default_lon,
'default_lat' : self.default_lat,
'default_zoom' : self.default_zoom,
'display_wkt' : self.debug or self.display_wkt,
'geom_type' : OGRGeomType(db_field.geom_type),
'field_name' : db_field.name,
'is_collection' : is_collection,
'scrollable' : self.scrollable,
'layerswitcher' : self.layerswitcher,
'collection_type' : collection_type,
'is_linestring' : db_field.geom_type in ('LINESTRING', 'MULTILINESTRING'),
'is_polygon' : db_field.geom_type in ('POLYGON', 'MULTIPOLYGON'),
'is_point' : db_field.geom_type in ('POINT', 'MULTIPOINT'),
'num_zoom' : self.num_zoom,
'max_zoom' : self.max_zoom,
'min_zoom' : self.min_zoom,
'units' : self.units, #likely shoud get from object
'max_resolution' : self.max_resolution,
'max_extent' : self.max_extent,
'modifiable' : self.modifiable,
'mouse_position' : self.mouse_position,
'scale_text' : self.scale_text,
'map_width' : self.map_width,
'map_height' : self.map_height,
'point_zoom' : self.point_zoom,
'srid' : self.map_srid,
'display_srid' : self.display_srid,
'wms_url' : self.wms_url,
'wms_layer' : self.wms_layer,
'wms_name' : self.wms_name,
'debug' : self.debug,
}
return OLMap
from django.contrib.gis import gdal
if gdal.HAS_GDAL:
class OSMGeoAdmin(GeoModelAdmin):
map_template = 'gis/admin/osm.html'
extra_js = ['http://www.openstreetmap.org/openlayers/OpenStreetMap.js']
num_zoom = 20
map_srid = 900913
max_extent = '-20037508,-20037508,20037508,20037508'
max_resolution = '156543.0339'
point_zoom = num_zoom - 6
units = 'm'
| ajibawa-2023/Python-Code-Large/train/row_98716 | 73 | 124 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98716:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0081, 0.0081, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:ImportFrom_L2_C0", "label": "from django.contrib.admin import ModelAdmin", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0161, 0.0081, 0, 0.66, 0.1429, 703, 0, 1, 0, 0, 703, 0, 0], "semantic": {"name": "django.contrib.admin", "arg_names": [], "import_names": ["ModelAdmin"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.admin import ModelAdmin"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:ImportFrom_L3_C0", "label": "from django.contrib.gis.admin.widgets import OpenLayersWidget", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0242, 0.0081, 0, 0.66, 0.2857, 364, 0, 1, 0, 0, 364, 0, 0], "semantic": {"name": "django.contrib.gis.admin.widgets", "arg_names": [], "import_names": ["OpenLayersWidget"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.admin.widgets import OpenLayersWidget"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:ImportFrom_L4_C0", "label": "from django.contrib.gis.gdal import OGRGeomType", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0323, 0.0081, 0, 0.66, 0.4286, 793, 0, 1, 0, 0, 793, 0, 0], "semantic": {"name": "django.contrib.gis.gdal", "arg_names": [], "import_names": ["OGRGeomType"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal import OGRGeomType"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:ImportFrom_L5_C0", "label": "from django.contrib.gis.db import models", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0403, 0.0081, 0, 0.66, 0.5714, 964, 0, 1, 0, 0, 964, 0, 0], "semantic": {"name": "django.contrib.gis.db", "arg_names": [], "import_names": ["models"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db import models"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "label": "GeoModelAdmin", "type": "class", "loc": [7, 112], "level": 0, "parent": null, "vector": [3, 0, 0.4798, 0.8548, 0, 0.66, 0.7143, 605, 0, 3, 0, 0, 534, 0, 14], "semantic": {"name": "GeoModelAdmin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GeoModelAdmin(ModelAdmin):\n \"\"\"\n The administration options class for Geographic models. Map settings\n may be overloaded from their defaults to create custom maps.\n \"\"\"\n # The default map settings that may be overloaded -- still subject\n # to API changes.\n default_lon = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Expr_L8_C4", "label": "expression", "type": "expression", "loc": [8, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [8, 1, 0.0766, 0.0323, 1, 0.09, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n The administration options class for Geographic models. Map settings\n may be overloaded from their defaults to create custom maps.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L14_C4", "label": "default_lon =", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.1129, 0.0081, 1, 0.09, 0.0312, 785, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "default_lon", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " default_lon = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L15_C4", "label": "default_lat =", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.121, 0.0081, 1, 0.09, 0.0625, 584, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "default_lat", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " default_lat = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L16_C4", "label": "default_zoom =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.129, 0.0081, 1, 0.09, 0.0938, 580, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "default_zoom", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " default_zoom = 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L17_C4", "label": "display_wkt =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.1371, 0.0081, 1, 0.09, 0.125, 776, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "display_wkt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " display_wkt = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L18_C4", "label": "display_srid =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.1452, 0.0081, 1, 0.09, 0.1562, 537, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "display_srid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " display_srid = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L19_C4", "label": "extra_js =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.1532, 0.0081, 1, 0.09, 0.1875, 537, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "extra_js", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " extra_js = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L20_C4", "label": "num_zoom =", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.1613, 0.0081, 1, 0.09, 0.2188, 369, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "num_zoom", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " num_zoom = 18"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L21_C4", "label": "max_zoom =", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.1694, 0.0081, 1, 0.09, 0.25, 926, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "max_zoom", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " max_zoom = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L22_C4", "label": "min_zoom =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.1774, 0.0081, 1, 0.09, 0.2812, 323, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "min_zoom", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " min_zoom = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L23_C4", "label": "units =", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.1855, 0.0081, 1, 0.09, 0.3125, 805, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "units", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " units = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L24_C4", "label": "max_resolution =", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.1935, 0.0081, 1, 0.09, 0.3438, 193, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "max_resolution", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " max_resolution = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L25_C4", "label": "max_extent =", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.2016, 0.0081, 1, 0.09, 0.375, 532, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "max_extent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " max_extent = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L26_C4", "label": "modifiable =", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.2097, 0.0081, 1, 0.09, 0.4062, 666, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "modifiable", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " modifiable = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L27_C4", "label": "mouse_position =", "type": "assigned_variable", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.2177, 0.0081, 1, 0.09, 0.4375, 309, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "mouse_position", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mouse_position = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L28_C4", "label": "scale_text =", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.2258, 0.0081, 1, 0.09, 0.4688, 970, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "scale_text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " scale_text = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L29_C4", "label": "layerswitcher =", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.2339, 0.0081, 1, 0.09, 0.5, 526, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "layerswitcher", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " layerswitcher = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L30_C4", "label": "scrollable =", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.2419, 0.0081, 1, 0.09, 0.5312, 587, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "scrollable", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " scrollable = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L31_C4", "label": "map_width =", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.25, 0.0081, 1, 0.09, 0.5625, 741, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "map_width", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " map_width = 600"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L32_C4", "label": "map_height =", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.2581, 0.0081, 1, 0.09, 0.5938, 674, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "map_height", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " map_height = 400"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L33_C4", "label": "map_srid =", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.2661, 0.0081, 1, 0.09, 0.625, 255, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "map_srid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " map_srid = 4326"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L34_C4", "label": "map_template =", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.2742, 0.0081, 1, 0.09, 0.6562, 545, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "map_template", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " map_template = 'gis/admin/openlayers.html'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L35_C4", "label": "openlayers_url =", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.2823, 0.0081, 1, 0.09, 0.6875, 303, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "openlayers_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " openlayers_url = 'http://openlayers.org/api/2.10/OpenLayers.js'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L36_C4", "label": "point_zoom =", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.2903, 0.0081, 1, 0.09, 0.7188, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "point_zoom", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " point_zoom = num_zoom - 6"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L37_C4", "label": "wms_url =", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.2984, 0.0081, 1, 0.09, 0.75, 959, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "wms_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wms_url = 'http://labs.metacarta.com/wms/vmap0'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L38_C4", "label": "wms_layer =", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.3065, 0.0081, 1, 0.09, 0.7812, 570, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "wms_layer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wms_layer = 'basic'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L39_C4", "label": "wms_name =", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.3145, 0.0081, 1, 0.09, 0.8125, 245, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "wms_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wms_name = 'OpenLayers WMS'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L40_C4", "label": "debug =", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.3226, 0.0081, 1, 0.09, 0.8438, 924, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " debug = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L41_C4", "label": "widget =", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.3306, 0.0081, 1, 0.09, 0.875, 972, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "widget", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " widget = OpenLayersWidget"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L43_C4", "label": "_media", "type": "function", "loc": [43, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [2, 1, 0.3669, 0.0484, 1, 0.09, 0.9062, 650, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "_media", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _media(self):\n \"Injects OpenLayers JavaScript into the admin.\"\n media = super(GeoModelAdmin, self)._media()\n media.add_js([self.openlayers_url])\n media.add_js(self.extra_js)\n return media"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Expr_L44_C8", "label": "expression", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L43_C4", "vector": [8, 2, 0.3548, 0.0081, 2, 0.48, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Injects OpenLayers JavaScript into the admin.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L45_C8", "label": "media = _media()", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L43_C4", "vector": [14, 2, 0.3629, 0.0081, 2, 0.48, 0.25, 317, 3, 0, 0, 0, 650, 10, 2], "semantic": {"name": "media", "arg_names": [], "import_names": [], "rhs_call_name": "_media", "annotation": ""}, "snippet": " media = super(GeoModelAdmin, self)._media()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Expr_L46_C8", "label": "add_js()", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L43_C4", "vector": [8, 2, 0.371, 0.0081, 2, 0.48, 0.5, 681, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add_js", "arg_names": [], "import_names": [], "rhs_call_name": "add_js", "annotation": ""}, "snippet": " media.add_js([self.openlayers_url])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Expr_L47_C8", "label": "add_js()", "type": "expression", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L43_C4", "vector": [8, 2, 0.379, 0.0081, 2, 0.48, 0.75, 681, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add_js", "arg_names": [], "import_names": [], "rhs_call_name": "add_js", "annotation": ""}, "snippet": " media.add_js(self.extra_js)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Return_L48_C8", "label": "return", "type": "return", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L43_C4", "vector": [13, 2, 0.3871, 0.0081, 2, 0.48, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return media"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L49_C4", "label": "media = property()", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [14, 1, 0.3952, 0.0081, 1, 0.09, 0.9375, 317, 3, 1, 0, 0, 244, 10, 1], "semantic": {"name": "media", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " media = property(_media)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L51_C4", "label": "formfield_for_dbfield", "type": "function", "loc": [51, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [2, 1, 0.4556, 0.0968, 1, 0.09, 0.9688, 937, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "formfield_for_dbfield", "arg_names": ["self", "db_field", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def formfield_for_dbfield(self, db_field, **kwargs):\n \"\"\"\n Overloaded from ModelAdmin so that an OpenLayersWidget is used\n for viewing/editing GeometryFields.\n \"\"\"\n if isinstance(db_field, models.GeometryField):\n request = kwargs.pop('request', None)\n # Setting the widget with the newly defined widget."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Expr_L52_C8", "label": "expression", "type": "expression", "loc": [52, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L51_C4", "vector": [8, 2, 0.4315, 0.0323, 2, 0.26, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Overloaded from ModelAdmin so that an OpenLayersWidget is used\n for viewing/editing GeometryFields.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:If_L56_C8", "label": "if", "type": "if", "loc": [56, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L51_C4", "vector": [4, 2, 0.4758, 0.0565, 2, 0.26, 1.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(db_field, models.GeometryField):\n request = kwargs.pop('request', None)\n # Setting the widget with the newly defined widget.\n kwargs['widget'] = self.get_map_widget(db_field)\n return db_field.formfield(**kwargs)\n else:\n return super(GeoModelAdmin, self).formfield_for_dbfield(db_field, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L57_C12", "label": "request = pop()", "type": "assigned_variable", "loc": [57, 57], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:If_L56_C8", "vector": [14, 3, 0.4597, 0.0081, 3, 0.43, 0.0, 50, 3, 2, 0, 0, 969, 10, 1], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " request = kwargs.pop('request', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L59_C12", "label": " = get_map_widget()", "type": "assigned_variable", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:If_L56_C8", "vector": [14, 3, 0.4758, 0.0081, 3, 0.43, 0.3333, 0, 3, 1, 0, 0, 169, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "get_map_widget", "annotation": ""}, "snippet": " kwargs['widget'] = self.get_map_widget(db_field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Return_L60_C12", "label": "return", "type": "return", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:If_L56_C8", "vector": [13, 3, 0.4839, 0.0081, 3, 0.43, 0.6667, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return db_field.formfield(**kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Return_L62_C12", "label": "return", "type": "return", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:If_L56_C8", "vector": [13, 3, 0.5, 0.0081, 3, 0.43, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return super(GeoModelAdmin, self).formfield_for_dbfield(db_field, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L64_C4", "label": "get_map_widget", "type": "function", "loc": [64, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "vector": [2, 1, 0.7097, 0.3952, 1, 0.09, 1.0, 169, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "get_map_widget", "arg_names": ["self", "db_field"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_map_widget(self, db_field):\n \"\"\"\n Returns a subclass of the OpenLayersWidget (or whatever was specified\n in the `widget` attribute) using the settings from the attributes set\n in this class.\n \"\"\"\n is_collection = db_field.geom_type in ('MULTIPOINT', 'MULTILINESTRING', 'MULTIPOLYGON', 'GEOMETRYCOLLECTION')\n if is_collection:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Expr_L65_C8", "label": "expression", "type": "expression", "loc": [65, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L64_C4", "vector": [8, 2, 0.5403, 0.0403, 2, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a subclass of the OpenLayersWidget (or whatever was specified\n in the `widget` attribute) using the settings from the attributes set\n in this class.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L70_C8", "label": "is_collection =", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L64_C4", "vector": [14, 2, 0.5645, 0.0081, 2, 0.72, 0.25, 339, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "is_collection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " is_collection = db_field.geom_type in ('MULTIPOINT', 'MULTILINESTRING', 'MULTIPOLYGON', 'GEOMETRYCOLLECTION')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:If_L71_C8", "label": "if", "type": "if", "loc": [71, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L64_C4", "vector": [4, 2, 0.5887, 0.0403, 2, 0.72, 0.5, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if is_collection:\n if db_field.geom_type == 'GEOMETRYCOLLECTION': collection_type = 'Any'\n else: collection_type = OGRGeomType(db_field.geom_type.replace('MULTI', ''))\n else:\n collection_type = 'None'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:If_L72_C12", "label": "if", "type": "if", "loc": [72, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:If_L71_C8", "vector": [4, 3, 0.5847, 0.0161, 3, 0.52, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if db_field.geom_type == 'GEOMETRYCOLLECTION': collection_type = 'Any'\n else: collection_type = OGRGeomType(db_field.geom_type.replace('MULTI', ''))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L72_C59", "label": "collection_type =", "type": "assigned_variable", "loc": [72, 72], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:If_L72_C12", "vector": [14, 4, 0.5806, 0.0081, 4, 0.71, 0.0, 645, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "collection_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if db_field.geom_type == 'GEOMETRYCOLLECTION': collection_type = 'Any'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L73_C18", "label": "collection_type = OGRGeomType()", "type": "assigned_variable", "loc": [73, 73], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:If_L72_C12", "vector": [14, 4, 0.5887, 0.0081, 4, 0.71, 1.0, 645, 3, 1, 0, 0, 85, 10, 2], "semantic": {"name": "collection_type", "arg_names": [], "import_names": [], "rhs_call_name": "OGRGeomType", "annotation": ""}, "snippet": " else: collection_type = OGRGeomType(db_field.geom_type.replace('MULTI', ''))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L75_C12", "label": "collection_type =", "type": "assigned_variable", "loc": [75, 75], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:If_L71_C8", "vector": [14, 3, 0.6048, 0.0081, 3, 0.52, 1.0, 645, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "collection_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " collection_type = 'None'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L77_C8", "label": "OLMap", "type": "class", "loc": [77, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L64_C4", "vector": [3, 2, 0.7581, 0.2823, 2, 0.72, 0.75, 559, 0, 0, 0, 0, 102, 0, 1], "semantic": {"name": "OLMap", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class OLMap(self.widget):\n template = self.map_template\n geom_type = db_field.geom_type\n params = {'default_lon' : self.default_lon,\n 'default_lat' : self.default_lat,\n 'default_zoom' : self.default_zoom,\n 'display_wkt' : self.debug or self.display_wkt,\n 'geom_type' : OGRGeomType(db_field.geom_type),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L78_C12", "label": "template =", "type": "assigned_variable", "loc": [78, 78], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L77_C8", "vector": [14, 3, 0.629, 0.0081, 3, 0.05, 0.0, 549, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "template", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " template = self.map_template"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L79_C12", "label": "geom_type =", "type": "assigned_variable", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L77_C8", "vector": [14, 3, 0.6371, 0.0081, 3, 0.05, 0.5, 770, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geom_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geom_type = db_field.geom_type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L80_C12", "label": "params =", "type": "assigned_variable", "loc": [80, 111], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L77_C8", "vector": [14, 3, 0.7702, 0.2581, 3, 0.05, 1.0, 206, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = {'default_lon' : self.default_lon,\n 'default_lat' : self.default_lat,\n 'default_zoom' : self.default_zoom,\n 'display_wkt' : self.debug or self.display_wkt,\n 'geom_type' : OGRGeomType(db_field.geom_type),\n 'field_name' : db_field.name,\n 'is_collection' : is_collection,\n 'scrollable' : self.scrollable,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Return_L112_C8", "label": "return", "type": "return", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L64_C4", "vector": [13, 2, 0.9032, 0.0081, 2, 0.72, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return OLMap"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:ImportFrom_L114_C0", "label": "from django.contrib.gis import gdal", "type": "import", "loc": [114, 114], "level": 0, "parent": null, "vector": [1, 0, 0.9194, 0.0081, 0, 0.66, 0.8571, 735, 0, 1, 0, 0, 735, 0, 0], "semantic": {"name": "django.contrib.gis", "arg_names": [], "import_names": ["gdal"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis import gdal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:If_L115_C0", "label": "if", "type": "if", "loc": [115, 124], "level": 0, "parent": null, "vector": [4, 0, 0.9637, 0.0806, 0, 0.66, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if gdal.HAS_GDAL:\n class OSMGeoAdmin(GeoModelAdmin):\n map_template = 'gis/admin/osm.html'\n extra_js = ['http://www.openstreetmap.org/openlayers/OpenStreetMap.js']\n num_zoom = 20\n map_srid = 900913\n max_extent = '-20037508,-20037508,20037508,20037508'\n max_resolution = '156543.0339'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L116_C4", "label": "OSMGeoAdmin", "type": "class", "loc": [116, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:If_L115_C0", "vector": [3, 1, 0.9677, 0.0726, 1, 0.29, 0.0, 773, 0, 0, 0, 0, 605, 0, 0], "semantic": {"name": "OSMGeoAdmin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class OSMGeoAdmin(GeoModelAdmin):\n map_template = 'gis/admin/osm.html'\n extra_js = ['http://www.openstreetmap.org/openlayers/OpenStreetMap.js']\n num_zoom = 20\n map_srid = 900913\n max_extent = '-20037508,-20037508,20037508,20037508'\n max_resolution = '156543.0339'\n point_zoom = num_zoom - 6"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L117_C8", "label": "map_template =", "type": "assigned_variable", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L116_C4", "vector": [14, 2, 0.9435, 0.0081, 2, 0.22, 0.0, 545, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "map_template", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " map_template = 'gis/admin/osm.html'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L118_C8", "label": "extra_js =", "type": "assigned_variable", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L116_C4", "vector": [14, 2, 0.9516, 0.0081, 2, 0.22, 0.1429, 537, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "extra_js", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " extra_js = ['http://www.openstreetmap.org/openlayers/OpenStreetMap.js']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L119_C8", "label": "num_zoom =", "type": "assigned_variable", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L116_C4", "vector": [14, 2, 0.9597, 0.0081, 2, 0.22, 0.2857, 369, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "num_zoom", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " num_zoom = 20"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L120_C8", "label": "map_srid =", "type": "assigned_variable", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L116_C4", "vector": [14, 2, 0.9677, 0.0081, 2, 0.22, 0.4286, 255, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "map_srid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " map_srid = 900913"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L121_C8", "label": "max_extent =", "type": "assigned_variable", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L116_C4", "vector": [14, 2, 0.9758, 0.0081, 2, 0.22, 0.5714, 532, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "max_extent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " max_extent = '-20037508,-20037508,20037508,20037508'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L122_C8", "label": "max_resolution =", "type": "assigned_variable", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L116_C4", "vector": [14, 2, 0.9839, 0.0081, 2, 0.22, 0.7143, 193, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "max_resolution", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " max_resolution = '156543.0339'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L123_C8", "label": "point_zoom =", "type": "assigned_variable", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L116_C4", "vector": [14, 2, 0.9919, 0.0081, 2, 0.22, 0.8571, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "point_zoom", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " point_zoom = num_zoom - 6"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L124_C8", "label": "units =", "type": "assigned_variable", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L116_C4", "vector": [14, 2, 1.0, 0.0081, 2, 0.22, 1.0, 805, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "units", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " units = 'm'"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Expr_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Expr_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Expr_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Return_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Expr_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:If_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Return_L60_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Return_L62_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Expr_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:If_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:If_L71_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:If_L72_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:If_L72_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L72_C59"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:If_L72_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L73_C18"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:If_L71_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L75_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L80_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Return_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:If_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Assign_L124_C8"}] |
from django.conf import settings
from django.contrib.gis.gdal import OGRException
from django.contrib.gis.geos import GEOSGeometry, GEOSException
from django.forms.widgets import Textarea
from django.template import loader, Context
from django.utils import translation
# Creating a template context that contains Django settings
# values needed by admin map templates.
geo_context = Context({'ADMIN_MEDIA_PREFIX' : settings.ADMIN_MEDIA_PREFIX,
'LANGUAGE_BIDI' : translation.get_language_bidi(),
})
class OpenLayersWidget(Textarea):
"""
Renders an OpenLayers map using the WKT of the geometry.
"""
def render(self, name, value, attrs=None):
# Update the template parameters with any attributes passed in.
if attrs: self.params.update(attrs)
# Defaulting the WKT value to a blank string -- this
# will be tested in the JavaScript and the appropriate
# interface will be constructed.
self.params['wkt'] = ''
# If a string reaches here (via a validation error on another
# field) then just reconstruct the Geometry.
if isinstance(value, basestring):
try:
value = GEOSGeometry(value)
except (GEOSException, ValueError):
value = None
if value and value.geom_type.upper() != self.geom_type:
value = None
# Constructing the dictionary of the map options.
self.params['map_options'] = self.map_options()
# Constructing the JavaScript module name using the name of
# the GeometryField (passed in via the `attrs` keyword).
# Use the 'name' attr for the field name (rather than 'field')
self.params['name'] = name
# note: we must switch out dashes for underscores since js
# functions are created using the module variable
js_safe_name = self.params['name'].replace('-','_')
self.params['module'] = 'geodjango_%s' % js_safe_name
if value:
# Transforming the geometry to the projection used on the
# OpenLayers map.
srid = self.params['srid']
if value.srid != srid:
try:
ogr = value.ogr
ogr.transform(srid)
wkt = ogr.wkt
except OGRException:
wkt = ''
else:
wkt = value.wkt
# Setting the parameter WKT with that of the transformed
# geometry.
self.params['wkt'] = wkt
return loader.render_to_string(self.template, self.params,
context_instance=geo_context)
def map_options(self):
"Builds the map options hash for the OpenLayers template."
# JavaScript construction utilities for the Bounds and Projection.
def ol_bounds(extent):
return 'new OpenLayers.Bounds(%s)' % str(extent)
def ol_projection(srid):
return 'new OpenLayers.Projection("EPSG:%s")' % srid
# An array of the parameter name, the name of their OpenLayers
# counterpart, and the type of variable they are.
map_types = [('srid', 'projection', 'srid'),
('display_srid', 'displayProjection', 'srid'),
('units', 'units', str),
('max_resolution', 'maxResolution', float),
('max_extent', 'maxExtent', 'bounds'),
('num_zoom', 'numZoomLevels', int),
('max_zoom', 'maxZoomLevels', int),
('min_zoom', 'minZoomLevel', int),
]
# Building the map options hash.
map_options = {}
for param_name, js_name, option_type in map_types:
if self.params.get(param_name, False):
if option_type == 'srid':
value = ol_projection(self.params[param_name])
elif option_type == 'bounds':
value = ol_bounds(self.params[param_name])
elif option_type in (float, int):
value = self.params[param_name]
elif option_type in (str,):
value = '"%s"' % self.params[param_name]
else:
raise TypeError
map_options[js_name] = value
return map_options
| ajibawa-2023/Python-Code-Large/train/row_98717 | 54 | 107 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98717:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0093, 0.0093, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:ImportFrom_L2_C0", "label": "from django.contrib.gis.gdal import OGRException", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0187, 0.0093, 0, 0.66, 0.1429, 793, 0, 1, 0, 0, 793, 0, 0], "semantic": {"name": "django.contrib.gis.gdal", "arg_names": [], "import_names": ["OGRException"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal import OGRException"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:ImportFrom_L3_C0", "label": "from django.contrib.gis.geos import GEOSGeometry, GEOSException", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.028, 0.0093, 0, 0.66, 0.2857, 886, 0, 2, 0, 0, 886, 0, 0], "semantic": {"name": "django.contrib.gis.geos", "arg_names": [], "import_names": ["GEOSGeometry", "GEOSException"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos import GEOSGeometry, GEOSException"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:ImportFrom_L4_C0", "label": "from django.forms.widgets import Textarea", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0374, 0.0093, 0, 0.66, 0.4286, 260, 0, 1, 0, 0, 260, 0, 0], "semantic": {"name": "django.forms.widgets", "arg_names": [], "import_names": ["Textarea"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.forms.widgets import Textarea"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:ImportFrom_L5_C0", "label": "from django.template import loader, Context", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0467, 0.0093, 0, 0.66, 0.5714, 213, 0, 2, 0, 0, 213, 0, 0], "semantic": {"name": "django.template", "arg_names": [], "import_names": ["loader", "Context"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.template import loader, Context"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:ImportFrom_L6_C0", "label": "from django.utils import translation", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0561, 0.0093, 0, 0.66, 0.7143, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "django.utils", "arg_names": [], "import_names": ["translation"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils import translation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L10_C0", "label": "geo_context = Context()", "type": "assigned_variable", "loc": [10, 12], "level": 0, "parent": null, "vector": [14, 0, 0.1028, 0.028, 0, 0.66, 0.8571, 691, 3, 1, 0, 0, 560, 10, 2], "semantic": {"name": "geo_context", "arg_names": [], "import_names": [], "rhs_call_name": "Context", "annotation": ""}, "snippet": "geo_context = Context({'ADMIN_MEDIA_PREFIX' : settings.ADMIN_MEDIA_PREFIX,\n 'LANGUAGE_BIDI' : translation.get_language_bidi(),\n })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:ClassDef_L14_C0", "label": "OpenLayersWidget", "type": "class", "loc": [14, 107], "level": 0, "parent": null, "vector": [3, 0, 0.5654, 0.8785, 0, 0.66, 1.0, 741, 0, 4, 0, 0, 746, 0, 12], "semantic": {"name": "OpenLayersWidget", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OpenLayersWidget(Textarea):\n \"\"\"\n Renders an OpenLayers map using the WKT of the geometry.\n \"\"\"\n def render(self, name, value, attrs=None):\n # Update the template parameters with any attributes passed in.\n if attrs: self.params.update(attrs)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Expr_L15_C4", "label": "expression", "type": "expression", "loc": [15, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:ClassDef_L14_C0", "vector": [8, 1, 0.1495, 0.028, 1, 0.1, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Renders an OpenLayers map using the WKT of the geometry.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L18_C4", "label": "render", "type": "function", "loc": [18, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:ClassDef_L14_C0", "vector": [2, 1, 0.4065, 0.486, 1, 0.1, 0.5, 24, 0, 4, 1, 0, 0, 0, 8], "semantic": {"name": "render", "arg_names": ["self", "name", "value", "attrs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def render(self, name, value, attrs=None):\n # Update the template parameters with any attributes passed in.\n if attrs: self.params.update(attrs)\n\n # Defaulting the WKT value to a blank string -- this\n # will be tested in the JavaScript and the appropriate\n # interface will be constructed.\n self.params['wkt'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L20_C8", "label": "if", "type": "if", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L18_C4", "vector": [4, 2, 0.1869, 0.0093, 2, 0.22, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if attrs: self.params.update(attrs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Expr_L20_C18", "label": "update()", "type": "expression", "loc": [20, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L20_C8", "vector": [8, 3, 0.1869, 0.0093, 3, 0.48, 0.0, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " if attrs: self.params.update(attrs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L25_C8", "label": "assign", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L18_C4", "vector": [14, 2, 0.2336, 0.0093, 2, 0.22, 0.1111, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.params['wkt'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L29_C8", "label": "if", "type": "if", "loc": [29, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L18_C4", "vector": [4, 2, 0.2897, 0.0467, 2, 0.22, 0.2222, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, basestring):\n try:\n value = GEOSGeometry(value)\n except (GEOSException, ValueError):\n value = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Try_L30_C12", "label": "try", "type": "try", "loc": [30, 33], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L29_C8", "vector": [7, 3, 0.2944, 0.0374, 3, 0.18, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n value = GEOSGeometry(value)\n except (GEOSException, ValueError):\n value = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L31_C16", "label": "value = GEOSGeometry()", "type": "assigned_variable", "loc": [31, 31], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:Try_L30_C12", "vector": [14, 4, 0.2897, 0.0093, 4, 0.09, 0.0, 441, 3, 1, 0, 0, 958, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSGeometry", "annotation": ""}, "snippet": " value = GEOSGeometry(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L33_C16", "label": "value =", "type": "assigned_variable", "loc": [33, 33], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:Try_L30_C12", "vector": [14, 4, 0.3084, 0.0093, 4, 0.09, 0.0, 441, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L35_C8", "label": "if", "type": "if", "loc": [35, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L18_C4", "vector": [4, 2, 0.3318, 0.0187, 2, 0.22, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value and value.geom_type.upper() != self.geom_type:\n value = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L36_C12", "label": "value =", "type": "assigned_variable", "loc": [36, 36], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L35_C8", "vector": [14, 3, 0.3364, 0.0093, 3, 0.9, 0.0, 441, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L39_C8", "label": " = map_options()", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L18_C4", "vector": [14, 2, 0.3645, 0.0093, 2, 0.22, 0.4444, 0, 3, 0, 0, 0, 861, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "map_options", "annotation": ""}, "snippet": " self.params['map_options'] = self.map_options()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L44_C8", "label": "assign", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L18_C4", "vector": [14, 2, 0.4112, 0.0093, 2, 0.22, 0.5556, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.params['name'] = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L47_C8", "label": "js_safe_name = replace()", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L18_C4", "vector": [14, 2, 0.4393, 0.0093, 2, 0.22, 0.6667, 330, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "js_safe_name", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " js_safe_name = self.params['name'].replace('-','_')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L48_C8", "label": "assign", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L18_C4", "vector": [14, 2, 0.4486, 0.0093, 2, 0.22, 0.7778, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.params['module'] = 'geodjango_%s' % js_safe_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L50_C8", "label": "if", "type": "if", "loc": [50, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L18_C4", "vector": [4, 2, 0.5421, 0.1589, 2, 0.22, 0.8889, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value:\n # Transforming the geometry to the projection used on the\n # OpenLayers map.\n srid = self.params['srid']\n if value.srid != srid:\n try:\n ogr = value.ogr\n ogr.transform(srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L53_C12", "label": "srid =", "type": "assigned_variable", "loc": [53, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L50_C8", "vector": [14, 3, 0.4953, 0.0093, 3, 0.09, 0.0, 357, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "srid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " srid = self.params['srid']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L54_C12", "label": "if", "type": "if", "loc": [54, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L50_C8", "vector": [4, 3, 0.5421, 0.0841, 3, 0.09, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value.srid != srid:\n try:\n ogr = value.ogr\n ogr.transform(srid)\n wkt = ogr.wkt\n except OGRException:\n wkt = ''\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Try_L55_C16", "label": "try", "type": "try", "loc": [55, 60], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L54_C12", "vector": [7, 4, 0.5374, 0.0561, 4, 0.1, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n ogr = value.ogr\n ogr.transform(srid)\n wkt = ogr.wkt\n except OGRException:\n wkt = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L56_C20", "label": "ogr =", "type": "assigned_variable", "loc": [56, 56], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:Try_L55_C16", "vector": [14, 5, 0.5234, 0.0093, 5, 0.86, 0.0, 707, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ogr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ogr = value.ogr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Expr_L57_C20", "label": "transform()", "type": "expression", "loc": [57, 57], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:Try_L55_C16", "vector": [8, 5, 0.5327, 0.0093, 5, 0.86, 0.5, 48, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "transform", "arg_names": [], "import_names": [], "rhs_call_name": "transform", "annotation": ""}, "snippet": " ogr.transform(srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L58_C20", "label": "wkt =", "type": "assigned_variable", "loc": [58, 58], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:Try_L55_C16", "vector": [14, 5, 0.5421, 0.0093, 5, 0.86, 1.0, 836, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "wkt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wkt = ogr.wkt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L60_C20", "label": "wkt =", "type": "assigned_variable", "loc": [60, 60], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:Try_L55_C16", "vector": [14, 5, 0.5607, 0.0093, 5, 0.86, 0.0, 836, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "wkt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wkt = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L62_C16", "label": "wkt =", "type": "assigned_variable", "loc": [62, 62], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L54_C12", "vector": [14, 4, 0.5794, 0.0093, 4, 0.1, 1.0, 836, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "wkt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wkt = value.wkt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L66_C12", "label": "assign", "type": "assigned_variable", "loc": [66, 66], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L50_C8", "vector": [14, 3, 0.6168, 0.0093, 3, 0.09, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.params['wkt'] = wkt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Return_L68_C8", "label": "return", "type": "return", "loc": [68, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L18_C4", "vector": [13, 2, 0.6402, 0.0187, 2, 0.22, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return loader.render_to_string(self.template, self.params,\n context_instance=geo_context)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L71_C4", "label": "map_options", "type": "function", "loc": [71, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:ClassDef_L14_C0", "vector": [2, 1, 0.8318, 0.3458, 1, 0.1, 1.0, 861, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "map_options", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def map_options(self):\n \"Builds the map options hash for the OpenLayers template.\"\n\n # JavaScript construction utilities for the Bounds and Projection.\n def ol_bounds(extent):\n return 'new OpenLayers.Bounds(%s)' % str(extent)\n def ol_projection(srid):\n return 'new OpenLayers.Projection(\"EPSG:%s\")' % srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Expr_L72_C8", "label": "expression", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L71_C4", "vector": [8, 2, 0.6729, 0.0093, 2, 0.08, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Builds the map options hash for the OpenLayers template.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L75_C8", "label": "ol_bounds", "type": "function", "loc": [75, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L71_C4", "vector": [2, 2, 0.7056, 0.0187, 2, 0.08, 0.1667, 197, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "ol_bounds", "arg_names": ["extent"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def ol_bounds(extent):\n return 'new OpenLayers.Bounds(%s)' % str(extent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Return_L76_C12", "label": "return", "type": "return", "loc": [76, 76], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L75_C8", "vector": [13, 3, 0.7103, 0.0093, 3, 0.67, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'new OpenLayers.Bounds(%s)' % str(extent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L77_C8", "label": "ol_projection", "type": "function", "loc": [77, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L71_C4", "vector": [2, 2, 0.7243, 0.0187, 2, 0.08, 0.3333, 75, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "ol_projection", "arg_names": ["srid"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def ol_projection(srid):\n return 'new OpenLayers.Projection(\"EPSG:%s\")' % srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Return_L78_C12", "label": "return", "type": "return", "loc": [78, 78], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L77_C8", "vector": [13, 3, 0.729, 0.0093, 3, 0.53, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'new OpenLayers.Projection(\"EPSG:%s\")' % srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L82_C8", "label": "map_types =", "type": "assigned_variable", "loc": [82, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L71_C4", "vector": [14, 2, 0.8037, 0.0841, 2, 0.08, 0.5, 911, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "map_types", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " map_types = [('srid', 'projection', 'srid'),\n ('display_srid', 'displayProjection', 'srid'),\n ('units', 'units', str),\n ('max_resolution', 'maxResolution', float),\n ('max_extent', 'maxExtent', 'bounds'),\n ('num_zoom', 'numZoomLevels', int),\n ('max_zoom', 'maxZoomLevels', int),\n ('min_zoom', 'minZoomLevel', int),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L93_C8", "label": "map_options =", "type": "assigned_variable", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L71_C4", "vector": [14, 2, 0.8692, 0.0093, 2, 0.08, 0.6667, 861, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "map_options", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " map_options = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:For_L94_C8", "label": "for param_name, js_name, option_type", "type": "for", "loc": [94, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L71_C4", "vector": [6, 2, 0.9346, 0.1215, 2, 0.08, 0.8333, 11, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "param_name, js_name, option_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for param_name, js_name, option_type in map_types:\n if self.params.get(param_name, False):\n if option_type == 'srid':\n value = ol_projection(self.params[param_name])\n elif option_type == 'bounds':\n value = ol_bounds(self.params[param_name])\n elif option_type in (float, int):\n value = self.params[param_name]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L95_C12", "label": "if", "type": "if", "loc": [95, 106], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:For_L94_C8", "vector": [4, 3, 0.9393, 0.1121, 3, 0.98, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.params.get(param_name, False):\n if option_type == 'srid':\n value = ol_projection(self.params[param_name])\n elif option_type == 'bounds':\n value = ol_bounds(self.params[param_name])\n elif option_type in (float, int):\n value = self.params[param_name]\n elif option_type in (str,):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L96_C16", "label": "if", "type": "if", "loc": [96, 105], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L95_C12", "vector": [4, 4, 0.9393, 0.0935, 4, 0.95, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if option_type == 'srid':\n value = ol_projection(self.params[param_name])\n elif option_type == 'bounds':\n value = ol_bounds(self.params[param_name])\n elif option_type in (float, int):\n value = self.params[param_name]\n elif option_type in (str,):\n value = '\"%s\"' % self.params[param_name]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L97_C20", "label": "value = ol_projection()", "type": "assigned_variable", "loc": [97, 97], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L96_C16", "vector": [14, 5, 0.9065, 0.0093, 5, 0.19, 0.0, 441, 3, 1, 0, 0, 75, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "ol_projection", "annotation": ""}, "snippet": " value = ol_projection(self.params[param_name])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L98_C16", "label": "if", "type": "if", "loc": [98, 105], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L96_C16", "vector": [4, 5, 0.9486, 0.0748, 5, 0.19, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif option_type == 'bounds':\n value = ol_bounds(self.params[param_name])\n elif option_type in (float, int):\n value = self.params[param_name]\n elif option_type in (str,):\n value = '\"%s\"' % self.params[param_name]\n else:\n raise TypeError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L99_C20", "label": "value = ol_bounds()", "type": "assigned_variable", "loc": [99, 99], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L98_C16", "vector": [14, 6, 0.9252, 0.0093, 6, 0.64, 0.0, 441, 3, 1, 0, 0, 197, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "ol_bounds", "annotation": ""}, "snippet": " value = ol_bounds(self.params[param_name])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L100_C16", "label": "if", "type": "if", "loc": [100, 105], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L98_C16", "vector": [4, 6, 0.9579, 0.0561, 6, 0.64, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif option_type in (float, int):\n value = self.params[param_name]\n elif option_type in (str,):\n value = '\"%s\"' % self.params[param_name]\n else:\n raise TypeError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L101_C20", "label": "value =", "type": "assigned_variable", "loc": [101, 101], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L100_C16", "vector": [14, 7, 0.9439, 0.0093, 7, 0.33, 0.0, 441, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = self.params[param_name]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L102_C16", "label": "if", "type": "if", "loc": [102, 105], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L100_C16", "vector": [4, 7, 0.9673, 0.0374, 7, 0.33, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif option_type in (str,):\n value = '\"%s\"' % self.params[param_name]\n else:\n raise TypeError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L103_C20", "label": "value =", "type": "assigned_variable", "loc": [103, 103], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L102_C16", "vector": [14, 8, 0.9626, 0.0093, 8, 0.78, 0.0, 441, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = '\"%s\"' % self.params[param_name]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L106_C16", "label": "assign", "type": "assigned_variable", "loc": [106, 106], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L95_C12", "vector": [14, 4, 0.9907, 0.0093, 4, 0.95, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " map_options[js_name] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98717:Return_L107_C8", "label": "return", "type": "return", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L71_C4", "vector": [13, 2, 1.0, 0.0093, 2, 0.08, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return map_options"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98717:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L20_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Expr_L20_C18"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L29_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Try_L30_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:Try_L30_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L31_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:Try_L30_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L33_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L36_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L54_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L54_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Try_L55_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:Try_L55_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L56_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:Try_L55_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Expr_L57_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:Try_L55_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L58_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:Try_L55_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L60_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L54_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L62_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L66_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Return_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Expr_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L75_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Return_L76_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Return_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:For_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:For_L94_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L95_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L95_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L96_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L96_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L97_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L96_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L98_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L98_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L99_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L98_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L100_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L100_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L101_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L100_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L102_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L102_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L103_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:If_L95_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Assign_L106_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Return_L107_C8"}] |
# Getting the normal admin routines, classes, and `site` instance.
from django.contrib.admin import autodiscover, site, AdminSite, ModelAdmin, StackedInline, TabularInline, HORIZONTAL, VERTICAL
# Geographic admin options classes and widgets.
from django.contrib.gis.admin.options import GeoModelAdmin
from django.contrib.gis.admin.widgets import OpenLayersWidget
try:
from django.contrib.gis.admin.options import OSMGeoAdmin
HAS_OSM = True
except ImportError:
HAS_OSM = False
| ajibawa-2023/Python-Code-Large/train/row_98718 | 7 | 12 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98718:ImportFrom_L2_C0", "label": "from django.contrib.admin import autodiscover, site, AdminSite\u2026", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0833, 0, 0.66, 0.0, 703, 0, 8, 0, 0, 703, 0, 0], "semantic": {"name": "django.contrib.admin", "arg_names": [], "import_names": ["autodiscover", "site", "AdminSite", "ModelAdmin", "StackedInline", "TabularInline", "HORIZONTAL", "VERTICAL"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.admin import autodiscover, site, AdminSite, ModelAdmin, StackedInline, TabularInline, HORIZONTAL, VERTICAL"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98718:ImportFrom_L5_C0", "label": "from django.contrib.gis.admin.options import GeoModelAdmin", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.4167, 0.0833, 0, 0.66, 0.3333, 833, 0, 1, 0, 0, 833, 0, 0], "semantic": {"name": "django.contrib.gis.admin.options", "arg_names": [], "import_names": ["GeoModelAdmin"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.admin.options import GeoModelAdmin"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98718:ImportFrom_L6_C0", "label": "from django.contrib.gis.admin.widgets import OpenLayersWidget", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.0833, 0, 0.66, 0.6667, 364, 0, 1, 0, 0, 364, 0, 0], "semantic": {"name": "django.contrib.gis.admin.widgets", "arg_names": [], "import_names": ["OpenLayersWidget"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.admin.widgets import OpenLayersWidget"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98718:Try_L8_C0", "label": "try", "type": "try", "loc": [8, 12], "level": 0, "parent": null, "vector": [7, 0, 0.8333, 0.4167, 0, 0.66, 1.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from django.contrib.gis.admin.options import OSMGeoAdmin\n HAS_OSM = True\nexcept ImportError:\n HAS_OSM = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98718:ImportFrom_L9_C4", "label": "from django.contrib.gis.admin.options import OSMGeoAdmin", "type": "import", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98718:Try_L8_C0", "vector": [1, 1, 0.75, 0.0833, 1, 0.89, 0.0, 833, 0, 1, 0, 0, 833, 0, 0], "semantic": {"name": "django.contrib.gis.admin.options", "arg_names": [], "import_names": ["OSMGeoAdmin"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.admin.options import OSMGeoAdmin"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98718:Assign_L10_C4", "label": "HAS_OSM =", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98718:Try_L8_C0", "vector": [14, 1, 0.8333, 0.0833, 1, 0.89, 1.0, 69, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "HAS_OSM", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " HAS_OSM = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98718:Assign_L12_C4", "label": "HAS_OSM =", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98718:Try_L8_C0", "vector": [14, 1, 1.0, 0.0833, 1, 0.89, 0.0, 69, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "HAS_OSM", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " HAS_OSM = False"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98718:Try_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98718:ImportFrom_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98718:Try_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98718:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98718:Try_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98718:Assign_L12_C4"}] |
from django.contrib.gis.geos.base import numpy
from django.contrib.gis.geos.coordseq import GEOSCoordSeq
from django.contrib.gis.geos.error import GEOSException
from django.contrib.gis.geos.geometry import GEOSGeometry
from django.contrib.gis.geos.point import Point
from django.contrib.gis.geos import prototypes as capi
class LineString(GEOSGeometry):
_init_func = capi.create_linestring
_minlength = 2
#### Python 'magic' routines ####
def __init__(self, *args, **kwargs):
"""
Initializes on the given sequence -- may take lists, tuples, NumPy arrays
of X,Y pairs, or Point objects. If Point objects are used, ownership is
_not_ transferred to the LineString object.
Examples:
ls = LineString((1, 1), (2, 2))
ls = LineString([(1, 1), (2, 2)])
ls = LineString(array([(1, 1), (2, 2)]))
ls = LineString(Point(1, 1), Point(2, 2))
"""
# If only one argument provided, set the coords array appropriately
if len(args) == 1: coords = args[0]
else: coords = args
if isinstance(coords, (tuple, list)):
# Getting the number of coords and the number of dimensions -- which
# must stay the same, e.g., no LineString((1, 2), (1, 2, 3)).
ncoords = len(coords)
if coords: ndim = len(coords[0])
else: raise TypeError('Cannot initialize on empty sequence.')
self._checkdim(ndim)
# Incrementing through each of the coordinates and verifying
for i in xrange(1, ncoords):
if not isinstance(coords[i], (tuple, list, Point)):
raise TypeError('each coordinate should be a sequence (list or tuple)')
if len(coords[i]) != ndim: raise TypeError('Dimension mismatch.')
numpy_coords = False
elif numpy and isinstance(coords, numpy.ndarray):
shape = coords.shape # Using numpy's shape.
if len(shape) != 2: raise TypeError('Too many dimensions.')
self._checkdim(shape[1])
ncoords = shape[0]
ndim = shape[1]
numpy_coords = True
else:
raise TypeError('Invalid initialization input for LineStrings.')
# Creating a coordinate sequence object because it is easier to
# set the points using GEOSCoordSeq.__setitem__().
cs = GEOSCoordSeq(capi.create_cs(ncoords, ndim), z=bool(ndim==3))
for i in xrange(ncoords):
if numpy_coords: cs[i] = coords[i,:]
elif isinstance(coords[i], Point): cs[i] = coords[i].tuple
else: cs[i] = coords[i]
# If SRID was passed in with the keyword arguments
srid = kwargs.get('srid', None)
# Calling the base geometry initialization with the returned pointer
# from the function.
super(LineString, self).__init__(self._init_func(cs.ptr), srid=srid)
def __iter__(self):
"Allows iteration over this LineString."
for i in xrange(len(self)):
yield self[i]
def __len__(self):
"Returns the number of points in this LineString."
return len(self._cs)
def _get_single_external(self, index):
return self._cs[index]
_get_single_internal = _get_single_external
def _set_list(self, length, items):
ndim = self._cs.dims #
hasz = self._cs.hasz # I don't understand why these are different
# create a new coordinate sequence and populate accordingly
cs = GEOSCoordSeq(capi.create_cs(length, ndim), z=hasz)
for i, c in enumerate(items):
cs[i] = c
ptr = self._init_func(cs.ptr)
if ptr:
capi.destroy_geom(self.ptr)
self.ptr = ptr
self._post_init(self.srid)
else:
# can this happen?
raise GEOSException('Geometry resulting from slice deletion was invalid.')
def _set_single(self, index, value):
self._checkindex(index)
self._cs[index] = value
def _checkdim(self, dim):
if dim not in (2, 3): raise TypeError('Dimension mismatch.')
#### Sequence Properties ####
@property
def tuple(self):
"Returns a tuple version of the geometry from the coordinate sequence."
return self._cs.tuple
coords = tuple
def _listarr(self, func):
"""
Internal routine that returns a sequence (list) corresponding with
the given function. Will return a numpy array if possible.
"""
lst = [func(i) for i in xrange(len(self))]
if numpy: return numpy.array(lst) # ARRRR!
else: return lst
@property
def array(self):
"Returns a numpy array for the LineString."
return self._listarr(self._cs.__getitem__)
@property
def merged(self):
"Returns the line merge of this LineString."
return self._topology(capi.geos_linemerge(self.ptr))
@property
def x(self):
"Returns a list or numpy array of the X variable."
return self._listarr(self._cs.getX)
@property
def y(self):
"Returns a list or numpy array of the Y variable."
return self._listarr(self._cs.getY)
@property
def z(self):
"Returns a list or numpy array of the Z variable."
if not self.hasz: return None
else: return self._listarr(self._cs.getZ)
# LinearRings are LineStrings used within Polygons.
class LinearRing(LineString):
_minLength = 4
_init_func = capi.create_linearring
| ajibawa-2023/Python-Code-Large/train/row_98719 | 95 | 152 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98719:ImportFrom_L1_C0", "label": "from django.contrib.gis.geos.base import numpy", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0066, 0.0066, 0, 0.66, 0.0, 386, 0, 1, 0, 0, 386, 0, 0], "semantic": {"name": "django.contrib.gis.geos.base", "arg_names": [], "import_names": ["numpy"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.base import numpy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:ImportFrom_L2_C0", "label": "from django.contrib.gis.geos.coordseq import GEOSCoordSeq", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0132, 0.0066, 0, 0.66, 0.1429, 849, 0, 1, 0, 0, 849, 0, 0], "semantic": {"name": "django.contrib.gis.geos.coordseq", "arg_names": [], "import_names": ["GEOSCoordSeq"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.coordseq import GEOSCoordSeq"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:ImportFrom_L3_C0", "label": "from django.contrib.gis.geos.error import GEOSException", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0197, 0.0066, 0, 0.66, 0.2857, 827, 0, 1, 0, 0, 827, 0, 0], "semantic": {"name": "django.contrib.gis.geos.error", "arg_names": [], "import_names": ["GEOSException"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.error import GEOSException"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:ImportFrom_L4_C0", "label": "from django.contrib.gis.geos.geometry import GEOSGeometry", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0263, 0.0066, 0, 0.66, 0.4286, 843, 0, 1, 0, 0, 843, 0, 0], "semantic": {"name": "django.contrib.gis.geos.geometry", "arg_names": [], "import_names": ["GEOSGeometry"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.geometry import GEOSGeometry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:ImportFrom_L5_C0", "label": "from django.contrib.gis.geos.point import Point", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0329, 0.0066, 0, 0.66, 0.5714, 711, 0, 1, 0, 0, 711, 0, 0], "semantic": {"name": "django.contrib.gis.geos.point", "arg_names": [], "import_names": ["Point"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.point import Point"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:ImportFrom_L6_C0", "label": "from django.contrib.gis.geos import capi", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0395, 0.0066, 0, 0.66, 0.7143, 886, 0, 1, 0, 0, 886, 0, 0], "semantic": {"name": "django.contrib.gis.geos", "arg_names": [], "import_names": ["capi"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos import prototypes as capi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "label": "LineString", "type": "class", "loc": [8, 147], "level": 0, "parent": null, "vector": [3, 0, 0.5099, 0.9211, 0, 0.66, 0.8571, 440, 0, 14, 0, 0, 958, 0, 47], "semantic": {"name": "LineString", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class LineString(GEOSGeometry):\n _init_func = capi.create_linestring\n _minlength = 2\n\n #### Python 'magic' routines ####\n def __init__(self, *args, **kwargs):\n \"\"\"\n Initializes on the given sequence -- may take lists, tuples, NumPy arrays"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L9_C4", "label": "_init_func =", "type": "assigned_variable", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "vector": [14, 1, 0.0592, 0.0066, 1, 0.33, 0.0, 701, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_init_func", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _init_func = capi.create_linestring"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L10_C4", "label": "_minlength =", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "vector": [14, 1, 0.0658, 0.0066, 1, 0.33, 0.0588, 990, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "_minlength", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _minlength = 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L13_C4", "label": "__init__", "type": "function", "loc": [13, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "vector": [2, 1, 0.2599, 0.3553, 1, 0.33, 0.1176, 555, 0, 3, 0, 0, 0, 0, 25], "semantic": {"name": "__init__", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, *args, **kwargs):\n \"\"\"\n Initializes on the given sequence -- may take lists, tuples, NumPy arrays\n of X,Y pairs, or Point objects. If Point objects are used, ownership is\n _not_ transferred to the LineString object.\n\n Examples:\n ls = LineString((1, 1), (2, 2))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L14_C8", "label": "expression", "type": "expression", "loc": [14, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L13_C4", "vector": [8, 2, 0.125, 0.0724, 2, 0.26, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Initializes on the given sequence -- may take lists, tuples, NumPy arrays\n of X,Y pairs, or Point objects. If Point objects are used, ownership is\n _not_ transferred to the LineString object.\n\n Examples:\n ls = LineString((1, 1), (2, 2))\n ls = LineString([(1, 1), (2, 2)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L26_C8", "label": "if", "type": "if", "loc": [26, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L13_C4", "vector": [4, 2, 0.1743, 0.0132, 2, 0.26, 0.1667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(args) == 1: coords = args[0]\n else: coords = args"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L26_C27", "label": "coords =", "type": "assigned_variable", "loc": [26, 26], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L26_C8", "vector": [14, 3, 0.1711, 0.0066, 3, 0.07, 0.0, 216, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "coords", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(args) == 1: coords = args[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L27_C14", "label": "coords =", "type": "assigned_variable", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L26_C8", "vector": [14, 3, 0.1776, 0.0066, 3, 0.07, 1.0, 216, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "coords", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " else: coords = args"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L29_C8", "label": "if", "type": "if", "loc": [29, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L13_C4", "vector": [4, 2, 0.2599, 0.1447, 2, 0.26, 0.3333, 0, 3, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(coords, (tuple, list)):\n # Getting the number of coords and the number of dimensions -- which\n # must stay the same, e.g., no LineString((1, 2), (1, 2, 3)).\n ncoords = len(coords)\n if coords: ndim = len(coords[0])\n else: raise TypeError('Cannot initialize on empty sequence.')\n self._checkdim(ndim)\n # Incrementing through each of the coordinates and verifying"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L32_C12", "label": "ncoords = len()", "type": "assigned_variable", "loc": [32, 32], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L29_C8", "vector": [14, 3, 0.2105, 0.0066, 3, 0.61, 0.0, 476, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "ncoords", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " ncoords = len(coords)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L33_C12", "label": "if", "type": "if", "loc": [33, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L29_C8", "vector": [4, 3, 0.2204, 0.0132, 3, 0.61, 0.2, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if coords: ndim = len(coords[0])\n else: raise TypeError('Cannot initialize on empty sequence.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L33_C23", "label": "ndim = len()", "type": "assigned_variable", "loc": [33, 33], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L33_C12", "vector": [14, 4, 0.2171, 0.0066, 4, 0.58, 0.0, 129, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "ndim", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " if coords: ndim = len(coords[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L35_C12", "label": "_checkdim()", "type": "expression", "loc": [35, 35], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L29_C8", "vector": [8, 3, 0.2303, 0.0066, 3, 0.61, 0.4, 364, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_checkdim", "arg_names": [], "import_names": [], "rhs_call_name": "_checkdim", "annotation": ""}, "snippet": " self._checkdim(ndim)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:For_L37_C12", "label": "for i", "type": "for", "loc": [37, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L29_C8", "vector": [6, 3, 0.2533, 0.0263, 3, 0.61, 0.6, 826, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange(1, ncoords):\n if not isinstance(coords[i], (tuple, list, Point)):\n raise TypeError('each coordinate should be a sequence (list or tuple)')\n if len(coords[i]) != ndim: raise TypeError('Dimension mismatch.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L38_C16", "label": "if", "type": "if", "loc": [38, 39], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:For_L37_C12", "vector": [4, 4, 0.2533, 0.0132, 4, 0.09, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(coords[i], (tuple, list, Point)):\n raise TypeError('each coordinate should be a sequence (list or tuple)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L40_C16", "label": "if", "type": "if", "loc": [40, 40], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:For_L37_C12", "vector": [4, 4, 0.2632, 0.0066, 4, 0.09, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(coords[i]) != ndim: raise TypeError('Dimension mismatch.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L41_C12", "label": "numpy_coords =", "type": "assigned_variable", "loc": [41, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L29_C8", "vector": [14, 3, 0.2697, 0.0066, 3, 0.61, 0.8, 321, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "numpy_coords", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " numpy_coords = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L42_C8", "label": "if", "type": "if", "loc": [42, 50], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L29_C8", "vector": [4, 3, 0.3026, 0.0592, 3, 0.61, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif numpy and isinstance(coords, numpy.ndarray):\n shape = coords.shape # Using numpy's shape.\n if len(shape) != 2: raise TypeError('Too many dimensions.')\n self._checkdim(shape[1])\n ncoords = shape[0]\n ndim = shape[1]\n numpy_coords = True\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L43_C12", "label": "shape =", "type": "assigned_variable", "loc": [43, 43], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L42_C8", "vector": [14, 4, 0.2829, 0.0066, 4, 0.94, 0.0, 381, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "shape", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " shape = coords.shape # Using numpy's shape."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L44_C12", "label": "if", "type": "if", "loc": [44, 44], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L42_C8", "vector": [4, 4, 0.2895, 0.0066, 4, 0.94, 0.2, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(shape) != 2: raise TypeError('Too many dimensions.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L45_C12", "label": "_checkdim()", "type": "expression", "loc": [45, 45], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L42_C8", "vector": [8, 4, 0.2961, 0.0066, 4, 0.94, 0.4, 364, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_checkdim", "arg_names": [], "import_names": [], "rhs_call_name": "_checkdim", "annotation": ""}, "snippet": " self._checkdim(shape[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L46_C12", "label": "ncoords =", "type": "assigned_variable", "loc": [46, 46], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L42_C8", "vector": [14, 4, 0.3026, 0.0066, 4, 0.94, 0.6, 476, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ncoords", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ncoords = shape[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L47_C12", "label": "ndim =", "type": "assigned_variable", "loc": [47, 47], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L42_C8", "vector": [14, 4, 0.3092, 0.0066, 4, 0.94, 0.8, 129, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ndim", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ndim = shape[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L48_C12", "label": "numpy_coords =", "type": "assigned_variable", "loc": [48, 48], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L42_C8", "vector": [14, 4, 0.3158, 0.0066, 4, 0.94, 1.0, 321, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "numpy_coords", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " numpy_coords = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L54_C8", "label": "cs = GEOSCoordSeq()", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L13_C4", "vector": [14, 2, 0.3553, 0.0066, 2, 0.26, 0.5, 256, 3, 2, 0, 0, 895, 10, 3], "semantic": {"name": "cs", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSCoordSeq", "annotation": ""}, "snippet": " cs = GEOSCoordSeq(capi.create_cs(ncoords, ndim), z=bool(ndim==3))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:For_L56_C8", "label": "for i", "type": "for", "loc": [56, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L13_C4", "vector": [6, 2, 0.3783, 0.0263, 2, 0.26, 0.6667, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange(ncoords):\n if numpy_coords: cs[i] = coords[i,:]\n elif isinstance(coords[i], Point): cs[i] = coords[i].tuple\n else: cs[i] = coords[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L57_C12", "label": "if", "type": "if", "loc": [57, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:For_L56_C8", "vector": [4, 3, 0.3816, 0.0197, 3, 0.4, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if numpy_coords: cs[i] = coords[i,:]\n elif isinstance(coords[i], Point): cs[i] = coords[i].tuple\n else: cs[i] = coords[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L57_C29", "label": "assign", "type": "assigned_variable", "loc": [57, 57], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L57_C12", "vector": [14, 4, 0.375, 0.0066, 4, 0.48, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if numpy_coords: cs[i] = coords[i,:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L58_C12", "label": "if", "type": "if", "loc": [58, 59], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L57_C12", "vector": [4, 4, 0.3849, 0.0132, 4, 0.48, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(coords[i], Point): cs[i] = coords[i].tuple\n else: cs[i] = coords[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L58_C47", "label": "assign", "type": "assigned_variable", "loc": [58, 58], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L58_C12", "vector": [14, 5, 0.3816, 0.0066, 5, 0.34, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(coords[i], Point): cs[i] = coords[i].tuple"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L59_C18", "label": "assign", "type": "assigned_variable", "loc": [59, 59], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L58_C12", "vector": [14, 5, 0.3882, 0.0066, 5, 0.34, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " else: cs[i] = coords[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L62_C8", "label": "srid = get()", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L13_C4", "vector": [14, 2, 0.4079, 0.0066, 2, 0.26, 0.8333, 357, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "srid", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " srid = kwargs.get('srid', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L66_C8", "label": "__init__()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L13_C4", "vector": [8, 2, 0.4342, 0.0066, 2, 0.26, 1.0, 555, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(LineString, self).__init__(self._init_func(cs.ptr), srid=srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L68_C4", "label": "__iter__", "type": "function", "loc": [68, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "vector": [2, 1, 0.4572, 0.0263, 1, 0.33, 0.1765, 891, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n \"Allows iteration over this LineString.\"\n for i in xrange(len(self)):\n yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L69_C8", "label": "expression", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L68_C4", "vector": [8, 2, 0.4539, 0.0066, 2, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Allows iteration over this LineString.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:For_L70_C8", "label": "for i", "type": "for", "loc": [70, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L68_C4", "vector": [6, 2, 0.4638, 0.0132, 2, 0.13, 1.0, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange(len(self)):\n yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L71_C12", "label": "expression", "type": "expression", "loc": [71, 71], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:For_L70_C8", "vector": [8, 3, 0.4671, 0.0066, 3, 0.93, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L73_C4", "label": "__len__", "type": "function", "loc": [73, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "vector": [2, 1, 0.4868, 0.0197, 1, 0.33, 0.2353, 76, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__len__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __len__(self):\n \"Returns the number of points in this LineString.\"\n return len(self._cs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L74_C8", "label": "expression", "type": "expression", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L73_C4", "vector": [8, 2, 0.4868, 0.0066, 2, 0.56, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the number of points in this LineString.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Return_L75_C8", "label": "return", "type": "return", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L73_C4", "vector": [13, 2, 0.4934, 0.0066, 2, 0.56, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(self._cs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L77_C4", "label": "_get_single_external", "type": "function", "loc": [77, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "vector": [2, 1, 0.5099, 0.0132, 1, 0.33, 0.2941, 470, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "_get_single_external", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_single_external(self, index):\n return self._cs[index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Return_L78_C8", "label": "return", "type": "return", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L77_C4", "vector": [13, 2, 0.5132, 0.0066, 2, 0.53, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._cs[index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L80_C4", "label": "_get_single_internal =", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "vector": [14, 1, 0.5263, 0.0066, 1, 0.33, 0.3529, 98, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_get_single_internal", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _get_single_internal = _get_single_external"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L82_C4", "label": "_set_list", "type": "function", "loc": [82, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "vector": [2, 1, 0.5921, 0.1118, 1, 0.33, 0.4118, 305, 0, 3, 0, 0, 0, 0, 7], "semantic": {"name": "_set_list", "arg_names": ["self", "length", "items"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_list(self, length, items):\n ndim = self._cs.dims #\n hasz = self._cs.hasz # I don't understand why these are different\n\n # create a new coordinate sequence and populate accordingly\n cs = GEOSCoordSeq(capi.create_cs(length, ndim), z=hasz)\n for i, c in enumerate(items):\n cs[i] = c"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L83_C8", "label": "ndim =", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L82_C4", "vector": [14, 2, 0.5461, 0.0066, 2, 0.66, 0.0, 129, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ndim", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ndim = self._cs.dims #"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L84_C8", "label": "hasz =", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L82_C4", "vector": [14, 2, 0.5526, 0.0066, 2, 0.66, 0.2, 15, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "hasz", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hasz = self._cs.hasz # I don't understand why these are different"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L87_C8", "label": "cs = GEOSCoordSeq()", "type": "assigned_variable", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L82_C4", "vector": [14, 2, 0.5724, 0.0066, 2, 0.66, 0.4, 256, 3, 2, 0, 0, 895, 10, 2], "semantic": {"name": "cs", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSCoordSeq", "annotation": ""}, "snippet": " cs = GEOSCoordSeq(capi.create_cs(length, ndim), z=hasz)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:For_L88_C8", "label": "for i, c", "type": "for", "loc": [88, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L82_C4", "vector": [6, 2, 0.5822, 0.0132, 2, 0.66, 0.6, 787, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i, c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, c in enumerate(items):\n cs[i] = c"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L89_C12", "label": "assign", "type": "assigned_variable", "loc": [89, 89], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:For_L88_C8", "vector": [14, 3, 0.5855, 0.0066, 3, 0.76, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cs[i] = c"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L91_C8", "label": "ptr = _init_func()", "type": "assigned_variable", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L82_C4", "vector": [14, 2, 0.5987, 0.0066, 2, 0.66, 0.8, 676, 3, 1, 0, 0, 701, 10, 1], "semantic": {"name": "ptr", "arg_names": [], "import_names": [], "rhs_call_name": "_init_func", "annotation": ""}, "snippet": " ptr = self._init_func(cs.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L92_C8", "label": "if", "type": "if", "loc": [92, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L82_C4", "vector": [4, 2, 0.625, 0.0461, 2, 0.66, 1.0, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ptr:\n capi.destroy_geom(self.ptr)\n self.ptr = ptr\n self._post_init(self.srid)\n else:\n # can this happen?\n raise GEOSException('Geometry resulting from slice deletion was invalid.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L93_C12", "label": "destroy_geom()", "type": "expression", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L92_C8", "vector": [8, 3, 0.6118, 0.0066, 3, 0.8, 0.0, 266, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "destroy_geom", "arg_names": [], "import_names": [], "rhs_call_name": "destroy_geom", "annotation": ""}, "snippet": " capi.destroy_geom(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L94_C12", "label": "self.ptr =", "type": "assigned_variable", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L92_C8", "vector": [14, 3, 0.6184, 0.0066, 3, 0.8, 0.5, 386, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.ptr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ptr = ptr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L95_C12", "label": "_post_init()", "type": "expression", "loc": [95, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L92_C8", "vector": [8, 3, 0.625, 0.0066, 3, 0.8, 1.0, 831, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_post_init", "arg_names": [], "import_names": [], "rhs_call_name": "_post_init", "annotation": ""}, "snippet": " self._post_init(self.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L100_C4", "label": "_set_single", "type": "function", "loc": [100, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "vector": [2, 1, 0.6645, 0.0197, 1, 0.33, 0.4706, 950, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "_set_single", "arg_names": ["self", "index", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_single(self, index, value):\n self._checkindex(index)\n self._cs[index] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L101_C8", "label": "_checkindex()", "type": "expression", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L100_C4", "vector": [8, 2, 0.6645, 0.0066, 2, 0.14, 0.0, 679, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_checkindex", "arg_names": [], "import_names": [], "rhs_call_name": "_checkindex", "annotation": ""}, "snippet": " self._checkindex(index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L102_C8", "label": "assign", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L100_C4", "vector": [14, 2, 0.6711, 0.0066, 2, 0.14, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._cs[index] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L104_C4", "label": "_checkdim", "type": "function", "loc": [104, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "vector": [2, 1, 0.6875, 0.0132, 1, 0.33, 0.5294, 364, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_checkdim", "arg_names": ["self", "dim"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _checkdim(self, dim):\n if dim not in (2, 3): raise TypeError('Dimension mismatch.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L105_C8", "label": "if", "type": "if", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L104_C4", "vector": [4, 2, 0.6908, 0.0066, 2, 0.62, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if dim not in (2, 3): raise TypeError('Dimension mismatch.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L109_C4", "label": "tuple", "type": "function", "loc": [109, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "vector": [2, 1, 0.7237, 0.0197, 1, 0.33, 0.5882, 259, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "tuple", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def tuple(self):\n \"Returns a tuple version of the geometry from the coordinate sequence.\"\n return self._cs.tuple"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L110_C8", "label": "expression", "type": "expression", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L109_C4", "vector": [8, 2, 0.7237, 0.0066, 2, 0.17, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a tuple version of the geometry from the coordinate sequence.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Return_L111_C8", "label": "return", "type": "return", "loc": [111, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L109_C4", "vector": [13, 2, 0.7303, 0.0066, 2, 0.17, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._cs.tuple"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L112_C4", "label": "coords =", "type": "assigned_variable", "loc": [112, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "vector": [14, 1, 0.7368, 0.0066, 1, 0.33, 0.6471, 216, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "coords", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " coords = tuple"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L114_C4", "label": "_listarr", "type": "function", "loc": [114, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "vector": [2, 1, 0.773, 0.0526, 1, 0.33, 0.7059, 923, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "_listarr", "arg_names": ["self", "func"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _listarr(self, func):\n \"\"\"\n Internal routine that returns a sequence (list) corresponding with\n the given function. Will return a numpy array if possible.\n \"\"\"\n lst = [func(i) for i in xrange(len(self))]\n if numpy: return numpy.array(lst) # ARRRR!\n else: return lst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L115_C8", "label": "expression", "type": "expression", "loc": [115, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L114_C4", "vector": [8, 2, 0.7664, 0.0263, 2, 0.17, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Internal routine that returns a sequence (list) corresponding with\n the given function. Will return a numpy array if possible.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L119_C8", "label": "lst =", "type": "assigned_variable", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L114_C4", "vector": [14, 2, 0.7829, 0.0066, 2, 0.17, 0.5, 564, 5, 0, 0, 0, 0, 0, 3], "semantic": {"name": "lst", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lst = [func(i) for i in xrange(len(self))]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L120_C8", "label": "if", "type": "if", "loc": [120, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L114_C4", "vector": [4, 2, 0.7928, 0.0132, 2, 0.17, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if numpy: return numpy.array(lst) # ARRRR!\n else: return lst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Return_L120_C18", "label": "return", "type": "return", "loc": [120, 120], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L120_C8", "vector": [13, 3, 0.7895, 0.0066, 3, 0.61, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if numpy: return numpy.array(lst) # ARRRR!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Return_L121_C14", "label": "return", "type": "return", "loc": [121, 121], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L120_C8", "vector": [13, 3, 0.7961, 0.0066, 3, 0.61, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " else: return lst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L124_C4", "label": "array", "type": "function", "loc": [124, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "vector": [2, 1, 0.8224, 0.0197, 1, 0.33, 0.7647, 80, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "array", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def array(self):\n \"Returns a numpy array for the LineString.\"\n return self._listarr(self._cs.__getitem__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L125_C8", "label": "expression", "type": "expression", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L124_C4", "vector": [8, 2, 0.8224, 0.0066, 2, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a numpy array for the LineString.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Return_L126_C8", "label": "return", "type": "return", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L124_C4", "vector": [13, 2, 0.8289, 0.0066, 2, 0.74, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._listarr(self._cs.__getitem__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L129_C4", "label": "merged", "type": "function", "loc": [129, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "vector": [2, 1, 0.8553, 0.0197, 1, 0.33, 0.8235, 840, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "merged", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def merged(self):\n \"Returns the line merge of this LineString.\"\n return self._topology(capi.geos_linemerge(self.ptr)) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L130_C8", "label": "expression", "type": "expression", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L129_C4", "vector": [8, 2, 0.8553, 0.0066, 2, 0.78, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the line merge of this LineString.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Return_L131_C8", "label": "return", "type": "return", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L129_C4", "vector": [13, 2, 0.8618, 0.0066, 2, 0.78, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._topology(capi.geos_linemerge(self.ptr)) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L134_C4", "label": "x", "type": "function", "loc": [134, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "vector": [2, 1, 0.8882, 0.0197, 1, 0.33, 0.8824, 190, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "x", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def x(self):\n \"Returns a list or numpy array of the X variable.\"\n return self._listarr(self._cs.getX)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L135_C8", "label": "expression", "type": "expression", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L134_C4", "vector": [8, 2, 0.8882, 0.0066, 2, 0.23, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a list or numpy array of the X variable.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Return_L136_C8", "label": "return", "type": "return", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L134_C4", "vector": [13, 2, 0.8947, 0.0066, 2, 0.23, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._listarr(self._cs.getX)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L139_C4", "label": "y", "type": "function", "loc": [139, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "vector": [2, 1, 0.9211, 0.0197, 1, 0.33, 0.9412, 304, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "y", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def y(self):\n \"Returns a list or numpy array of the Y variable.\"\n return self._listarr(self._cs.getY)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L140_C8", "label": "expression", "type": "expression", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L139_C4", "vector": [8, 2, 0.9211, 0.0066, 2, 0.14, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a list or numpy array of the Y variable.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Return_L141_C8", "label": "return", "type": "return", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L139_C4", "vector": [13, 2, 0.9276, 0.0066, 2, 0.14, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._listarr(self._cs.getY)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L144_C4", "label": "z", "type": "function", "loc": [144, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "vector": [2, 1, 0.9572, 0.0263, 1, 0.33, 1.0, 859, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "z", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def z(self):\n \"Returns a list or numpy array of the Z variable.\"\n if not self.hasz: return None\n else: return self._listarr(self._cs.getZ)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L145_C8", "label": "expression", "type": "expression", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L144_C4", "vector": [8, 2, 0.9539, 0.0066, 2, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a list or numpy array of the Z variable.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L146_C8", "label": "if", "type": "if", "loc": [146, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L144_C4", "vector": [4, 2, 0.9638, 0.0132, 2, 0.46, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.hasz: return None\n else: return self._listarr(self._cs.getZ)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Return_L146_C26", "label": "return", "type": "return", "loc": [146, 146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L146_C8", "vector": [13, 3, 0.9605, 0.0066, 3, 0.81, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.hasz: return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Return_L147_C14", "label": "return", "type": "return", "loc": [147, 147], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L146_C8", "vector": [13, 3, 0.9671, 0.0066, 3, 0.81, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " else: return self._listarr(self._cs.getZ)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L150_C0", "label": "LinearRing", "type": "class", "loc": [150, 152], "level": 0, "parent": null, "vector": [3, 0, 0.9934, 0.0197, 0, 0.66, 1.0, 441, 0, 0, 0, 0, 440, 0, 0], "semantic": {"name": "LinearRing", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class LinearRing(LineString):\n _minLength = 4\n _init_func = capi.create_linearring"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L151_C4", "label": "_minLength =", "type": "assigned_variable", "loc": [151, 151], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L150_C0", "vector": [14, 1, 0.9934, 0.0066, 1, 0.25, 0.0, 578, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "_minLength", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _minLength = 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L152_C4", "label": "_init_func =", "type": "assigned_variable", "loc": [152, 152], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L150_C0", "vector": [14, 1, 1.0, 0.0066, 1, 0.25, 1.0, 701, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_init_func", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _init_func = capi.create_linearring"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L26_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L26_C27"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L26_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L27_C14"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L29_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L32_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L29_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L33_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L33_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L33_C23"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L29_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L35_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L29_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:For_L37_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:For_L37_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L38_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:For_L37_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L40_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L29_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L41_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L29_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L43_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L44_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L45_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:For_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:For_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L57_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L57_C29"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L57_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L58_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L58_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L58_C47"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L58_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L59_C18"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:For_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:For_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L71_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Return_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Return_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:For_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:For_L88_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L89_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L92_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L93_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L92_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L94_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L92_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L95_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Return_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L120_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Return_L120_C18"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L120_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Return_L121_C14"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L124_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L124_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Return_L126_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Return_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Return_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L139_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Return_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Expr_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:FunctionDef_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Return_L146_C26"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Return_L147_C14"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L150_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L151_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L150_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L152_C4"}] |
"""
This module houses the GEOS exceptions, specifically, GEOSException and
GEOSGeometryIndexError.
"""
class GEOSException(Exception):
"The base GEOS exception, indicates a GEOS-related error."
pass
class GEOSIndexError(GEOSException, KeyError):
"""
This exception is raised when an invalid index is encountered, and has
the 'silent_variable_feature' attribute set to true. This ensures that
django's templates proceed to use the next lookup type gracefully when
an Exception is raised. Fixes ticket #4740.
"""
# "If, during the method lookup, a method raises an exception, the exception
# will be propagated, unless the exception has an attribute
# `silent_variable_failure` whose value is True." -- Django template docs.
silent_variable_failure = True
| ajibawa-2023/Python-Code-Large/train/row_98720 | 6 | 20 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98720:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.125, 0.2, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n This module houses the GEOS exceptions, specifically, GEOSException and\n GEOSGeometryIndexError.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98720:ClassDef_L6_C0", "label": "GEOSException", "type": "class", "loc": [6, 8], "level": 0, "parent": null, "vector": [3, 0, 0.35, 0.15, 0, 0.66, 0.5, 290, 0, 0, 0, 0, 645, 0, 0], "semantic": {"name": "GEOSException", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GEOSException(Exception):\n \"The base GEOS exception, indicates a GEOS-related error.\"\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98720:Expr_L7_C4", "label": "expression", "type": "expression", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98720:ClassDef_L6_C0", "vector": [8, 1, 0.35, 0.05, 1, 0.64, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"The base GEOS exception, indicates a GEOS-related error.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98720:ClassDef_L10_C0", "label": "GEOSIndexError", "type": "class", "loc": [10, 20], "level": 0, "parent": null, "vector": [3, 0, 0.75, 0.55, 0, 0.66, 1.0, 23, 0, 0, 0, 0, 290, 0, 0], "semantic": {"name": "GEOSIndexError", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GEOSIndexError(GEOSException, KeyError):\n \"\"\"\n This exception is raised when an invalid index is encountered, and has\n the 'silent_variable_feature' attribute set to true. This ensures that\n django's templates proceed to use the next lookup type gracefully when\n an Exception is raised. Fixes ticket #4740.\n \"\"\"\n # \"If, during the method lookup, a method raises an exception, the exception"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98720:Expr_L11_C4", "label": "expression", "type": "expression", "loc": [11, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98720:ClassDef_L10_C0", "vector": [8, 1, 0.675, 0.3, 1, 0.59, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n This exception is raised when an invalid index is encountered, and has\n the 'silent_variable_feature' attribute set to true. This ensures that\n django's templates proceed to use the next lookup type gracefully when\n an Exception is raised. Fixes ticket #4740.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98720:Assign_L20_C4", "label": "silent_variable_failure =", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98720:ClassDef_L10_C0", "vector": [14, 1, 1.0, 0.05, 1, 0.59, 1.0, 884, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "silent_variable_failure", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " silent_variable_failure = True"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98720:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98720:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98720:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98720:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98720:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98720:Assign_L20_C4"}] |
"""
Module that holds classes for performing I/O operations on GEOS geometry
objects. Specifically, this has Python implementations of WKB/WKT
reader and writer classes.
"""
from django.contrib.gis.geos.geometry import GEOSGeometry
from django.contrib.gis.geos.prototypes.io import _WKTReader, _WKBReader, WKBWriter, WKTWriter
# Public classes for (WKB|WKT)Reader, which return GEOSGeometry
class WKBReader(_WKBReader):
def read(self, wkb):
"Returns a GEOSGeometry for the given WKB buffer."
return GEOSGeometry(super(WKBReader, self).read(wkb))
class WKTReader(_WKTReader):
def read(self, wkt):
"Returns a GEOSGeometry for the given WKT string."
return GEOSGeometry(super(WKTReader, self).read(wkt))
| ajibawa-2023/Python-Code-Large/train/row_98721 | 11 | 20 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98721:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.15, 0.25, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nModule that holds classes for performing I/O operations on GEOS geometry\nobjects. Specifically, this has Python implementations of WKB/WKT\nreader and writer classes.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98721:ImportFrom_L6_C0", "label": "from django.contrib.gis.geos.geometry import GEOSGeometry", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.3, 0.05, 0, 0.66, 0.25, 843, 0, 1, 0, 0, 843, 0, 0], "semantic": {"name": "django.contrib.gis.geos.geometry", "arg_names": [], "import_names": ["GEOSGeometry"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.geometry import GEOSGeometry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98721:ImportFrom_L7_C0", "label": "from django.contrib.gis.geos.prototypes.io import _WKTReader, _WKBReader, WKBWriter\u2026", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.35, 0.05, 0, 0.66, 0.5, 150, 0, 4, 0, 0, 150, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes.io", "arg_names": [], "import_names": ["_WKTReader", "_WKBReader", "WKBWriter", "WKTWriter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes.io import _WKTReader, _WKBReader, WKBWriter, WKTWriter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98721:ClassDef_L10_C0", "label": "WKBReader", "type": "class", "loc": [10, 13], "level": 0, "parent": null, "vector": [3, 0, 0.575, 0.2, 0, 0.66, 0.75, 158, 0, 1, 0, 0, 522, 0, 3], "semantic": {"name": "WKBReader", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WKBReader(_WKBReader):\n def read(self, wkb):\n \"Returns a GEOSGeometry for the given WKB buffer.\"\n return GEOSGeometry(super(WKBReader, self).read(wkb))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98721:FunctionDef_L11_C4", "label": "read", "type": "function", "loc": [11, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98721:ClassDef_L10_C0", "vector": [2, 1, 0.6, 0.15, 1, 0.01, 0.0, 453, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "read", "arg_names": ["self", "wkb"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def read(self, wkb):\n \"Returns a GEOSGeometry for the given WKB buffer.\"\n return GEOSGeometry(super(WKBReader, self).read(wkb))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98721:Expr_L12_C8", "label": "expression", "type": "expression", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98721:FunctionDef_L11_C4", "vector": [8, 2, 0.6, 0.05, 2, 0.56, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a GEOSGeometry for the given WKB buffer.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98721:Return_L13_C8", "label": "return", "type": "return", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98721:FunctionDef_L11_C4", "vector": [13, 2, 0.65, 0.05, 2, 0.56, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return GEOSGeometry(super(WKBReader, self).read(wkb))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98721:ClassDef_L15_C0", "label": "WKTReader", "type": "class", "loc": [15, 18], "level": 0, "parent": null, "vector": [3, 0, 0.825, 0.2, 0, 0.66, 1.0, 433, 0, 1, 0, 0, 784, 0, 3], "semantic": {"name": "WKTReader", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WKTReader(_WKTReader):\n def read(self, wkt):\n \"Returns a GEOSGeometry for the given WKT string.\"\n return GEOSGeometry(super(WKTReader, self).read(wkt))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98721:FunctionDef_L16_C4", "label": "read", "type": "function", "loc": [16, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98721:ClassDef_L15_C0", "vector": [2, 1, 0.85, 0.15, 1, 0.54, 0.0, 453, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "read", "arg_names": ["self", "wkt"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def read(self, wkt):\n \"Returns a GEOSGeometry for the given WKT string.\"\n return GEOSGeometry(super(WKTReader, self).read(wkt))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98721:Expr_L17_C8", "label": "expression", "type": "expression", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98721:FunctionDef_L16_C4", "vector": [8, 2, 0.85, 0.05, 2, 0.93, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a GEOSGeometry for the given WKT string.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98721:Return_L18_C8", "label": "return", "type": "return", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98721:FunctionDef_L16_C4", "vector": [13, 2, 0.9, 0.05, 2, 0.93, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return GEOSGeometry(super(WKTReader, self).read(wkt))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98721:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98721:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98721:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98721:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98721:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98721:Return_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98721:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98721:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98721:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98721:Expr_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98721:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98721:Return_L18_C8"}] |
"""
This module houses the Geometry Collection objects:
GeometryCollection, MultiPoint, MultiLineString, and MultiPolygon
"""
from ctypes import c_int, c_uint, byref
from django.contrib.gis.geos.error import GEOSException, GEOSIndexError
from django.contrib.gis.geos.geometry import GEOSGeometry
from django.contrib.gis.geos.libgeos import get_pointer_arr, GEOM_PTR, GEOS_PREPARE
from django.contrib.gis.geos.linestring import LineString, LinearRing
from django.contrib.gis.geos.point import Point
from django.contrib.gis.geos.polygon import Polygon
from django.contrib.gis.geos import prototypes as capi
class GeometryCollection(GEOSGeometry):
_typeid = 7
def __init__(self, *args, **kwargs):
"Initializes a Geometry Collection from a sequence of Geometry objects."
# Checking the arguments
if not args:
raise TypeError('Must provide at least one Geometry to initialize %s.' % self.__class__.__name__)
if len(args) == 1:
# If only one geometry provided or a list of geometries is provided
# in the first argument.
if isinstance(args[0], (tuple, list)):
init_geoms = args[0]
else:
init_geoms = args
else:
init_geoms = args
# Ensuring that only the permitted geometries are allowed in this collection
# this is moved to list mixin super class
self._check_allowed(init_geoms)
# Creating the geometry pointer array.
collection = self._create_collection(len(init_geoms), iter(init_geoms))
super(GeometryCollection, self).__init__(collection, **kwargs)
def __iter__(self):
"Iterates over each Geometry in the Collection."
for i in xrange(len(self)):
yield self[i]
def __len__(self):
"Returns the number of geometries in this Collection."
return self.num_geom
### Methods for compatibility with ListMixin ###
def _create_collection(self, length, items):
# Creating the geometry pointer array.
geoms = get_pointer_arr(length)
for i, g in enumerate(items):
# this is a little sloppy, but makes life easier
# allow GEOSGeometry types (python wrappers) or pointer types
geoms[i] = capi.geom_clone(getattr(g, 'ptr', g))
return capi.create_collection(c_int(self._typeid), byref(geoms), c_uint(length))
def _get_single_internal(self, index):
return capi.get_geomn(self.ptr, index)
def _get_single_external(self, index):
"Returns the Geometry from this Collection at the given index (0-based)."
# Checking the index and returning the corresponding GEOS geometry.
return GEOSGeometry(capi.geom_clone(self._get_single_internal(index)), srid=self.srid)
def _set_list(self, length, items):
"Create a new collection, and destroy the contents of the previous pointer."
prev_ptr = self.ptr
srid = self.srid
self.ptr = self._create_collection(length, items)
if srid: self.srid = srid
capi.destroy_geom(prev_ptr)
_set_single = GEOSGeometry._set_single_rebuild
_assign_extended_slice = GEOSGeometry._assign_extended_slice_rebuild
@property
def kml(self):
"Returns the KML for this Geometry Collection."
return '<MultiGeometry>%s</MultiGeometry>' % ''.join([g.kml for g in self])
@property
def tuple(self):
"Returns a tuple of all the coordinates in this Geometry Collection"
return tuple([g.tuple for g in self])
coords = tuple
# MultiPoint, MultiLineString, and MultiPolygon class definitions.
class MultiPoint(GeometryCollection):
_allowed = Point
_typeid = 4
class MultiLineString(GeometryCollection):
_allowed = (LineString, LinearRing)
_typeid = 5
@property
def merged(self):
"""
Returns a LineString representing the line merge of this
MultiLineString.
"""
return self._topology(capi.geos_linemerge(self.ptr))
class MultiPolygon(GeometryCollection):
_allowed = Polygon
_typeid = 6
@property
def cascaded_union(self):
"Returns a cascaded union of this MultiPolygon."
if GEOS_PREPARE:
return GEOSGeometry(capi.geos_cascaded_union(self.ptr), self.srid)
else:
raise GEOSException('The cascaded union operation requires GEOS 3.1+.')
# Setting the allowed types here since GeometryCollection is defined before
# its subclasses.
GeometryCollection._allowed = (Point, LineString, LinearRing, Polygon, MultiPoint, MultiLineString, MultiPolygon)
| ajibawa-2023/Python-Code-Large/train/row_98722 | 73 | 123 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0203, 0.0325, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n This module houses the Geometry Collection objects:\n GeometryCollection, MultiPoint, MultiLineString, and MultiPolygon\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:ImportFrom_L5_C0", "label": "from ctypes import c_int, c_uint, byref", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0407, 0.0081, 0, 0.66, 0.0769, 182, 0, 3, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_int", "c_uint", "byref"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import c_int, c_uint, byref"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:ImportFrom_L6_C0", "label": "from django.contrib.gis.geos.error import GEOSException, GEOSIndexError", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0488, 0.0081, 0, 0.66, 0.1538, 827, 0, 2, 0, 0, 827, 0, 0], "semantic": {"name": "django.contrib.gis.geos.error", "arg_names": [], "import_names": ["GEOSException", "GEOSIndexError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.error import GEOSException, GEOSIndexError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:ImportFrom_L7_C0", "label": "from django.contrib.gis.geos.geometry import GEOSGeometry", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0569, 0.0081, 0, 0.66, 0.2308, 843, 0, 1, 0, 0, 843, 0, 0], "semantic": {"name": "django.contrib.gis.geos.geometry", "arg_names": [], "import_names": ["GEOSGeometry"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.geometry import GEOSGeometry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:ImportFrom_L8_C0", "label": "from django.contrib.gis.geos.libgeos import get_pointer_arr, GEOM_PTR, GEOS_PREPARE", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.065, 0.0081, 0, 0.66, 0.3077, 64, 0, 3, 0, 0, 64, 0, 0], "semantic": {"name": "django.contrib.gis.geos.libgeos", "arg_names": [], "import_names": ["get_pointer_arr", "GEOM_PTR", "GEOS_PREPARE"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.libgeos import get_pointer_arr, GEOM_PTR, GEOS_PREPARE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:ImportFrom_L9_C0", "label": "from django.contrib.gis.geos.linestring import LineString, LinearRing", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0732, 0.0081, 0, 0.66, 0.3846, 662, 0, 2, 0, 0, 662, 0, 0], "semantic": {"name": "django.contrib.gis.geos.linestring", "arg_names": [], "import_names": ["LineString", "LinearRing"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.linestring import LineString, LinearRing"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:ImportFrom_L10_C0", "label": "from django.contrib.gis.geos.point import Point", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0813, 0.0081, 0, 0.66, 0.4615, 711, 0, 1, 0, 0, 711, 0, 0], "semantic": {"name": "django.contrib.gis.geos.point", "arg_names": [], "import_names": ["Point"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.point import Point"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:ImportFrom_L11_C0", "label": "from django.contrib.gis.geos.polygon import Polygon", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0894, 0.0081, 0, 0.66, 0.5385, 745, 0, 1, 0, 0, 745, 0, 0], "semantic": {"name": "django.contrib.gis.geos.polygon", "arg_names": [], "import_names": ["Polygon"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.polygon import Polygon"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:ImportFrom_L12_C0", "label": "from django.contrib.gis.geos import capi", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0976, 0.0081, 0, 0.66, 0.6154, 886, 0, 1, 0, 0, 886, 0, 0], "semantic": {"name": "django.contrib.gis.geos", "arg_names": [], "import_names": ["capi"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos import prototypes as capi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "label": "GeometryCollection", "type": "class", "loc": [14, 90], "level": 0, "parent": null, "vector": [3, 0, 0.4228, 0.626, 0, 0.66, 0.6923, 918, 0, 9, 0, 0, 958, 0, 27], "semantic": {"name": "GeometryCollection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GeometryCollection(GEOSGeometry):\n _typeid = 7\n\n def __init__(self, *args, **kwargs):\n \"Initializes a Geometry Collection from a sequence of Geometry objects.\"\n\n # Checking the arguments\n if not args:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L15_C4", "label": "_typeid =", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "vector": [14, 1, 0.122, 0.0081, 1, 0.11, 0.0, 272, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "_typeid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _typeid = 7"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L17_C4", "label": "__init__", "type": "function", "loc": [17, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "vector": [2, 1, 0.2317, 0.1951, 1, 0.11, 0.0833, 555, 0, 3, 0, 0, 0, 0, 9], "semantic": {"name": "__init__", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, *args, **kwargs):\n \"Initializes a Geometry Collection from a sequence of Geometry objects.\"\n\n # Checking the arguments\n if not args:\n raise TypeError('Must provide at least one Geometry to initialize %s.' % self.__class__.__name__)\n\n if len(args) == 1:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L18_C8", "label": "expression", "type": "expression", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L17_C4", "vector": [8, 2, 0.1463, 0.0081, 2, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Initializes a Geometry Collection from a sequence of Geometry objects.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:If_L21_C8", "label": "if", "type": "if", "loc": [21, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L17_C4", "vector": [4, 2, 0.1748, 0.0163, 2, 0.44, 0.2, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not args:\n raise TypeError('Must provide at least one Geometry to initialize %s.' % self.__class__.__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:If_L24_C8", "label": "if", "type": "if", "loc": [24, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L17_C4", "vector": [4, 2, 0.2276, 0.0732, 2, 0.44, 0.4, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(args) == 1:\n # If only one geometry provided or a list of geometries is provided\n # in the first argument.\n if isinstance(args[0], (tuple, list)):\n init_geoms = args[0]\n else:\n init_geoms = args\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:If_L27_C12", "label": "if", "type": "if", "loc": [27, 30], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:If_L24_C8", "vector": [4, 3, 0.2317, 0.0325, 3, 0.61, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(args[0], (tuple, list)):\n init_geoms = args[0]\n else:\n init_geoms = args"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L28_C16", "label": "init_geoms =", "type": "assigned_variable", "loc": [28, 28], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:If_L27_C12", "vector": [14, 4, 0.2276, 0.0081, 4, 0.84, 0.0, 536, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "init_geoms", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " init_geoms = args[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L30_C16", "label": "init_geoms =", "type": "assigned_variable", "loc": [30, 30], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:If_L27_C12", "vector": [14, 4, 0.2439, 0.0081, 4, 0.84, 1.0, 536, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "init_geoms", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " init_geoms = args"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L32_C12", "label": "init_geoms =", "type": "assigned_variable", "loc": [32, 32], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:If_L24_C8", "vector": [14, 3, 0.2602, 0.0081, 3, 0.61, 1.0, 536, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "init_geoms", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " init_geoms = args"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L36_C8", "label": "_check_allowed()", "type": "expression", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L17_C4", "vector": [8, 2, 0.2927, 0.0081, 2, 0.44, 0.6, 582, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_check_allowed", "arg_names": [], "import_names": [], "rhs_call_name": "_check_allowed", "annotation": ""}, "snippet": " self._check_allowed(init_geoms)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L39_C8", "label": "collection = _create_collection()", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L17_C4", "vector": [14, 2, 0.3171, 0.0081, 2, 0.44, 0.8, 186, 3, 2, 0, 0, 957, 10, 3], "semantic": {"name": "collection", "arg_names": [], "import_names": [], "rhs_call_name": "_create_collection", "annotation": ""}, "snippet": " collection = self._create_collection(len(init_geoms), iter(init_geoms))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L40_C8", "label": "__init__()", "type": "expression", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L17_C4", "vector": [8, 2, 0.3252, 0.0081, 2, 0.44, 1.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(GeometryCollection, self).__init__(collection, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L42_C4", "label": "__iter__", "type": "function", "loc": [42, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "vector": [2, 1, 0.3537, 0.0325, 1, 0.11, 0.1667, 891, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n \"Iterates over each Geometry in the Collection.\"\n for i in xrange(len(self)):\n yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L43_C8", "label": "expression", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L42_C4", "vector": [8, 2, 0.3496, 0.0081, 2, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Iterates over each Geometry in the Collection.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:For_L44_C8", "label": "for i", "type": "for", "loc": [44, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L42_C4", "vector": [6, 2, 0.3618, 0.0163, 2, 0.07, 1.0, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange(len(self)):\n yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L45_C12", "label": "expression", "type": "expression", "loc": [45, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:For_L44_C8", "vector": [8, 3, 0.3659, 0.0081, 3, 0.65, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L47_C4", "label": "__len__", "type": "function", "loc": [47, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "vector": [2, 1, 0.3902, 0.0244, 1, 0.11, 0.25, 76, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__len__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __len__(self):\n \"Returns the number of geometries in this Collection.\"\n return self.num_geom"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L48_C8", "label": "expression", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L47_C4", "vector": [8, 2, 0.3902, 0.0081, 2, 0.8, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the number of geometries in this Collection.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Return_L49_C8", "label": "return", "type": "return", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L47_C4", "vector": [13, 2, 0.3984, 0.0081, 2, 0.8, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.num_geom"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L52_C4", "label": "_create_collection", "type": "function", "loc": [52, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "vector": [2, 1, 0.4553, 0.0732, 1, 0.11, 0.3333, 957, 0, 3, 1, 0, 0, 0, 8], "semantic": {"name": "_create_collection", "arg_names": ["self", "length", "items"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _create_collection(self, length, items):\n # Creating the geometry pointer array.\n geoms = get_pointer_arr(length)\n for i, g in enumerate(items):\n # this is a little sloppy, but makes life easier\n # allow GEOSGeometry types (python wrappers) or pointer types\n geoms[i] = capi.geom_clone(getattr(g, 'ptr', g))\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L54_C8", "label": "geoms = get_pointer_arr()", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L52_C4", "vector": [14, 2, 0.439, 0.0081, 2, 0.03, 0.0, 692, 3, 1, 0, 0, 677, 10, 1], "semantic": {"name": "geoms", "arg_names": [], "import_names": [], "rhs_call_name": "get_pointer_arr", "annotation": ""}, "snippet": " geoms = get_pointer_arr(length)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:For_L55_C8", "label": "for i, g", "type": "for", "loc": [55, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L52_C4", "vector": [6, 2, 0.4593, 0.0325, 2, 0.03, 0.5, 674, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i, g", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, g in enumerate(items):\n # this is a little sloppy, but makes life easier\n # allow GEOSGeometry types (python wrappers) or pointer types\n geoms[i] = capi.geom_clone(getattr(g, 'ptr', g))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L58_C12", "label": " = geom_clone()", "type": "assigned_variable", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:For_L55_C8", "vector": [14, 3, 0.4715, 0.0081, 3, 0.96, 0.0, 0, 3, 1, 0, 0, 54, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "geom_clone", "annotation": ""}, "snippet": " geoms[i] = capi.geom_clone(getattr(g, 'ptr', g))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Return_L60_C8", "label": "return", "type": "return", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L52_C4", "vector": [13, 2, 0.4878, 0.0081, 2, 0.03, 1.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.create_collection(c_int(self._typeid), byref(geoms), c_uint(length))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L62_C4", "label": "_get_single_internal", "type": "function", "loc": [62, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "vector": [2, 1, 0.5081, 0.0163, 1, 0.11, 0.4167, 98, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "_get_single_internal", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_single_internal(self, index):\n return capi.get_geomn(self.ptr, index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Return_L63_C8", "label": "return", "type": "return", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L62_C4", "vector": [13, 2, 0.5122, 0.0081, 2, 0.33, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_geomn(self.ptr, index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L65_C4", "label": "_get_single_external", "type": "function", "loc": [65, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "vector": [2, 1, 0.5407, 0.0325, 1, 0.11, 0.5, 470, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "_get_single_external", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_single_external(self, index):\n \"Returns the Geometry from this Collection at the given index (0-based).\"\n # Checking the index and returning the corresponding GEOS geometry.\n return GEOSGeometry(capi.geom_clone(self._get_single_internal(index)), srid=self.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L66_C8", "label": "expression", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L65_C4", "vector": [8, 2, 0.5366, 0.0081, 2, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the Geometry from this Collection at the given index (0-based).\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Return_L68_C8", "label": "return", "type": "return", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L65_C4", "vector": [13, 2, 0.5528, 0.0081, 2, 0.37, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return GEOSGeometry(capi.geom_clone(self._get_single_internal(index)), srid=self.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L70_C4", "label": "_set_list", "type": "function", "loc": [70, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "vector": [2, 1, 0.5935, 0.0569, 1, 0.11, 0.5833, 305, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "_set_list", "arg_names": ["self", "length", "items"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_list(self, length, items):\n \"Create a new collection, and destroy the contents of the previous pointer.\"\n prev_ptr = self.ptr\n srid = self.srid\n self.ptr = self._create_collection(length, items)\n if srid: self.srid = srid\n capi.destroy_geom(prev_ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L71_C8", "label": "expression", "type": "expression", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L70_C4", "vector": [8, 2, 0.5772, 0.0081, 2, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Create a new collection, and destroy the contents of the previous pointer.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L72_C8", "label": "prev_ptr =", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L70_C4", "vector": [14, 2, 0.5854, 0.0081, 2, 0.75, 0.2, 766, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "prev_ptr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prev_ptr = self.ptr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L73_C8", "label": "srid =", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L70_C4", "vector": [14, 2, 0.5935, 0.0081, 2, 0.75, 0.4, 357, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "srid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " srid = self.srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L74_C8", "label": "self.ptr = _create_collection()", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L70_C4", "vector": [14, 2, 0.6016, 0.0081, 2, 0.75, 0.6, 386, 3, 2, 0, 0, 957, 10, 1], "semantic": {"name": "self.ptr", "arg_names": [], "import_names": [], "rhs_call_name": "_create_collection", "annotation": ""}, "snippet": " self.ptr = self._create_collection(length, items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:If_L75_C8", "label": "if", "type": "if", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L70_C4", "vector": [4, 2, 0.6098, 0.0081, 2, 0.75, 0.8, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if srid: self.srid = srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L75_C17", "label": "self.srid =", "type": "assigned_variable", "loc": [75, 75], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:If_L75_C8", "vector": [14, 3, 0.6098, 0.0081, 3, 0.44, 0.0, 289, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.srid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if srid: self.srid = srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L76_C8", "label": "destroy_geom()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L70_C4", "vector": [8, 2, 0.6179, 0.0081, 2, 0.75, 1.0, 266, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "destroy_geom", "arg_names": [], "import_names": [], "rhs_call_name": "destroy_geom", "annotation": ""}, "snippet": " capi.destroy_geom(prev_ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L78_C4", "label": "_set_single =", "type": "assigned_variable", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "vector": [14, 1, 0.6341, 0.0081, 1, 0.11, 0.6667, 950, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_set_single", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _set_single = GEOSGeometry._set_single_rebuild"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L79_C4", "label": "_assign_extended_slice =", "type": "assigned_variable", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "vector": [14, 1, 0.6423, 0.0081, 1, 0.11, 0.75, 725, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_assign_extended_slice", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _assign_extended_slice = GEOSGeometry._assign_extended_slice_rebuild"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L82_C4", "label": "kml", "type": "function", "loc": [82, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "vector": [2, 1, 0.6748, 0.0244, 1, 0.11, 0.8333, 168, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "kml", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def kml(self):\n \"Returns the KML for this Geometry Collection.\"\n return '<MultiGeometry>%s</MultiGeometry>' % ''.join([g.kml for g in self])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L83_C8", "label": "expression", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L82_C4", "vector": [8, 2, 0.6748, 0.0081, 2, 0.77, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the KML for this Geometry Collection.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Return_L84_C8", "label": "return", "type": "return", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L82_C4", "vector": [13, 2, 0.6829, 0.0081, 2, 0.77, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '<MultiGeometry>%s</MultiGeometry>' % ''.join([g.kml for g in self])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L87_C4", "label": "tuple", "type": "function", "loc": [87, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "vector": [2, 1, 0.7154, 0.0244, 1, 0.11, 0.9167, 259, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "tuple", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def tuple(self):\n \"Returns a tuple of all the coordinates in this Geometry Collection\"\n return tuple([g.tuple for g in self])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L88_C8", "label": "expression", "type": "expression", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L87_C4", "vector": [8, 2, 0.7154, 0.0081, 2, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a tuple of all the coordinates in this Geometry Collection\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Return_L89_C8", "label": "return", "type": "return", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L87_C4", "vector": [13, 2, 0.7236, 0.0081, 2, 0.46, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return tuple([g.tuple for g in self])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L90_C4", "label": "coords =", "type": "assigned_variable", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "vector": [14, 1, 0.7317, 0.0081, 1, 0.11, 1.0, 216, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "coords", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " coords = tuple"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L93_C0", "label": "MultiPoint", "type": "class", "loc": [93, 95], "level": 0, "parent": null, "vector": [3, 0, 0.7642, 0.0244, 0, 0.66, 0.7692, 493, 0, 0, 0, 0, 918, 0, 0], "semantic": {"name": "MultiPoint", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MultiPoint(GeometryCollection):\n _allowed = Point\n _typeid = 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L94_C4", "label": "_allowed =", "type": "assigned_variable", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L93_C0", "vector": [14, 1, 0.7642, 0.0081, 1, 0.92, 0.0, 806, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_allowed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _allowed = Point"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L95_C4", "label": "_typeid =", "type": "assigned_variable", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L93_C0", "vector": [14, 1, 0.7724, 0.0081, 1, 0.92, 1.0, 272, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "_typeid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _typeid = 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L97_C0", "label": "MultiLineString", "type": "class", "loc": [97, 107], "level": 0, "parent": null, "vector": [3, 0, 0.8293, 0.0894, 0, 0.66, 0.8462, 278, 0, 1, 0, 0, 918, 0, 2], "semantic": {"name": "MultiLineString", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MultiLineString(GeometryCollection):\n _allowed = (LineString, LinearRing)\n _typeid = 5\n\n @property\n def merged(self):\n \"\"\" \n Returns a LineString representing the line merge of this "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L98_C4", "label": "_allowed =", "type": "assigned_variable", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L97_C0", "vector": [14, 1, 0.7967, 0.0081, 1, 0.96, 0.0, 806, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "_allowed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _allowed = (LineString, LinearRing)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L99_C4", "label": "_typeid =", "type": "assigned_variable", "loc": [99, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L97_C0", "vector": [14, 1, 0.8049, 0.0081, 1, 0.96, 0.5, 272, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "_typeid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _typeid = 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L102_C4", "label": "merged", "type": "function", "loc": [102, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L97_C0", "vector": [2, 1, 0.8496, 0.0488, 1, 0.96, 1.0, 840, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "merged", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def merged(self):\n \"\"\" \n Returns a LineString representing the line merge of this \n MultiLineString.\n \"\"\" \n return self._topology(capi.geos_linemerge(self.ptr)) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L103_C8", "label": "expression", "type": "expression", "loc": [103, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L102_C4", "vector": [8, 2, 0.8496, 0.0325, 2, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" \n Returns a LineString representing the line merge of this \n MultiLineString.\n \"\"\" "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Return_L107_C8", "label": "return", "type": "return", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L102_C4", "vector": [13, 2, 0.8699, 0.0081, 2, 0.54, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._topology(capi.geos_linemerge(self.ptr)) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L109_C0", "label": "MultiPolygon", "type": "class", "loc": [109, 119], "level": 0, "parent": null, "vector": [3, 0, 0.9268, 0.0894, 0, 0.66, 0.9231, 911, 0, 1, 0, 0, 918, 0, 3], "semantic": {"name": "MultiPolygon", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MultiPolygon(GeometryCollection):\n _allowed = Polygon\n _typeid = 6\n\n @property\n def cascaded_union(self):\n \"Returns a cascaded union of this MultiPolygon.\"\n if GEOS_PREPARE:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L110_C4", "label": "_allowed =", "type": "assigned_variable", "loc": [110, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L109_C0", "vector": [14, 1, 0.8943, 0.0081, 1, 0.99, 0.0, 806, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_allowed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _allowed = Polygon"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L111_C4", "label": "_typeid =", "type": "assigned_variable", "loc": [111, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L109_C0", "vector": [14, 1, 0.9024, 0.0081, 1, 0.99, 0.5, 272, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "_typeid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _typeid = 6"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L114_C4", "label": "cascaded_union", "type": "function", "loc": [114, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L109_C0", "vector": [2, 1, 0.9472, 0.0488, 1, 0.99, 1.0, 39, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "cascaded_union", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def cascaded_union(self):\n \"Returns a cascaded union of this MultiPolygon.\"\n if GEOS_PREPARE:\n return GEOSGeometry(capi.geos_cascaded_union(self.ptr), self.srid)\n else:\n raise GEOSException('The cascaded union operation requires GEOS 3.1+.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L115_C8", "label": "expression", "type": "expression", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L114_C4", "vector": [8, 2, 0.935, 0.0081, 2, 0.35, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a cascaded union of this MultiPolygon.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:If_L116_C8", "label": "if", "type": "if", "loc": [116, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L114_C4", "vector": [4, 2, 0.9553, 0.0325, 2, 0.35, 1.0, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if GEOS_PREPARE:\n return GEOSGeometry(capi.geos_cascaded_union(self.ptr), self.srid)\n else:\n raise GEOSException('The cascaded union operation requires GEOS 3.1+.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Return_L117_C12", "label": "return", "type": "return", "loc": [117, 117], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98722:If_L116_C8", "vector": [13, 3, 0.9512, 0.0081, 3, 0.46, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return GEOSGeometry(capi.geos_cascaded_union(self.ptr), self.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L123_C0", "label": "GeometryCollection._allowed =", "type": "assigned_variable", "loc": [123, 123], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.0081, 0, 0.66, 1.0, 907, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "GeometryCollection._allowed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "GeometryCollection._allowed = (Point, LineString, LinearRing, Polygon, MultiPoint, MultiLineString, MultiPolygon)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:If_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:If_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:If_L24_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:If_L27_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:If_L27_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L28_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:If_L27_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L30_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:If_L24_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L32_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:For_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:For_L44_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L45_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Return_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:For_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:For_L55_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L58_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Return_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Return_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L65_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L65_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Return_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:If_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:If_L75_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L75_C17"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Return_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Return_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L97_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L97_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L97_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Return_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L109_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L109_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L109_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Expr_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:If_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:If_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Return_L117_C12"}] |
from ctypes import c_char_p, c_int, c_size_t, c_ubyte, c_uint, POINTER
from django.contrib.gis.geos.libgeos import CS_PTR, GEOM_PTR, PREPGEOM_PTR, GEOS_PREPARE
from django.contrib.gis.geos.prototypes.errcheck import \
check_geom, check_minus_one, check_sized_string, check_string, check_zero
from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc
# This is the return type used by binary output (WKB, HEX) routines.
c_uchar_p = POINTER(c_ubyte)
# We create a simple subclass of c_char_p here because when the response
# type is set to c_char_p, you get a _Python_ string and there's no way
# to access the string's address inside the error checking function.
# In other words, you can't free the memory allocated inside GEOS. Previously,
# the return type would just be omitted and the integer address would be
# used -- but this allows us to be specific in the function definition and
# keeps the reference so it may be free'd.
class geos_char_p(c_char_p):
pass
### ctypes generation functions ###
def bin_constructor(func):
"Generates a prototype for binary construction (HEX, WKB) GEOS routines."
func.argtypes = [c_char_p, c_size_t]
func.restype = GEOM_PTR
func.errcheck = check_geom
return func
# HEX & WKB output
def bin_output(func):
"Generates a prototype for the routines that return a a sized string."
func.argtypes = [GEOM_PTR, POINTER(c_size_t)]
func.errcheck = check_sized_string
func.restype = c_uchar_p
return func
def geom_output(func, argtypes):
"For GEOS routines that return a geometry."
if argtypes: func.argtypes = argtypes
func.restype = GEOM_PTR
func.errcheck = check_geom
return func
def geom_index(func):
"For GEOS routines that return geometries from an index."
return geom_output(func, [GEOM_PTR, c_int])
def int_from_geom(func, zero=False):
"Argument is a geometry, return type is an integer."
func.argtypes = [GEOM_PTR]
func.restype = c_int
if zero:
func.errcheck = check_zero
else:
func.errcheck = check_minus_one
return func
def string_from_geom(func):
"Argument is a Geometry, return type is a string."
func.argtypes = [GEOM_PTR]
func.restype = geos_char_p
func.errcheck = check_string
return func
### ctypes prototypes ###
# Deprecated creation routines from WKB, HEX, WKT
from_hex = bin_constructor(GEOSFunc('GEOSGeomFromHEX_buf'))
from_wkb = bin_constructor(GEOSFunc('GEOSGeomFromWKB_buf'))
from_wkt = geom_output(GEOSFunc('GEOSGeomFromWKT'), [c_char_p])
# Deprecated output routines
to_hex = bin_output(GEOSFunc('GEOSGeomToHEX_buf'))
to_wkb = bin_output(GEOSFunc('GEOSGeomToWKB_buf'))
to_wkt = string_from_geom(GEOSFunc('GEOSGeomToWKT'))
# The GEOS geometry type, typeid, num_coordites and number of geometries
geos_normalize = int_from_geom(GEOSFunc('GEOSNormalize'))
geos_type = string_from_geom(GEOSFunc('GEOSGeomType'))
geos_typeid = int_from_geom(GEOSFunc('GEOSGeomTypeId'))
get_dims = int_from_geom(GEOSFunc('GEOSGeom_getDimensions'), zero=True)
get_num_coords = int_from_geom(GEOSFunc('GEOSGetNumCoordinates'))
get_num_geoms = int_from_geom(GEOSFunc('GEOSGetNumGeometries'))
# Geometry creation factories
create_point = geom_output(GEOSFunc('GEOSGeom_createPoint'), [CS_PTR])
create_linestring = geom_output(GEOSFunc('GEOSGeom_createLineString'), [CS_PTR])
create_linearring = geom_output(GEOSFunc('GEOSGeom_createLinearRing'), [CS_PTR])
# Polygon and collection creation routines are special and will not
# have their argument types defined.
create_polygon = geom_output(GEOSFunc('GEOSGeom_createPolygon'), None)
create_collection = geom_output(GEOSFunc('GEOSGeom_createCollection'), None)
# Ring routines
get_extring = geom_output(GEOSFunc('GEOSGetExteriorRing'), [GEOM_PTR])
get_intring = geom_index(GEOSFunc('GEOSGetInteriorRingN'))
get_nrings = int_from_geom(GEOSFunc('GEOSGetNumInteriorRings'))
# Collection Routines
get_geomn = geom_index(GEOSFunc('GEOSGetGeometryN'))
# Cloning
geom_clone = GEOSFunc('GEOSGeom_clone')
geom_clone.argtypes = [GEOM_PTR]
geom_clone.restype = GEOM_PTR
# Destruction routine.
destroy_geom = GEOSFunc('GEOSGeom_destroy')
destroy_geom.argtypes = [GEOM_PTR]
destroy_geom.restype = None
# SRID routines
geos_get_srid = GEOSFunc('GEOSGetSRID')
geos_get_srid.argtypes = [GEOM_PTR]
geos_get_srid.restype = c_int
geos_set_srid = GEOSFunc('GEOSSetSRID')
geos_set_srid.argtypes = [GEOM_PTR, c_int]
geos_set_srid.restype = None
| ajibawa-2023/Python-Code-Large/train/row_98723 | 75 | 119 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98723:ImportFrom_L1_C0", "label": "from ctypes import c_char_p, c_int, c_size_t\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0084, 0.0084, 0, 0.66, 0.0, 182, 0, 6, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_char_p", "c_int", "c_size_t", "c_ubyte", "c_uint", "POINTER"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import c_char_p, c_int, c_size_t, c_ubyte, c_uint, POINTER"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:ImportFrom_L2_C0", "label": "from django.contrib.gis.geos.libgeos import CS_PTR, GEOM_PTR, PREPGEOM_PTR\u2026", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0168, 0.0084, 0, 0.66, 0.0227, 64, 0, 4, 0, 0, 64, 0, 0], "semantic": {"name": "django.contrib.gis.geos.libgeos", "arg_names": [], "import_names": ["CS_PTR", "GEOM_PTR", "PREPGEOM_PTR", "GEOS_PREPARE"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.libgeos import CS_PTR, GEOM_PTR, PREPGEOM_PTR, GEOS_PREPARE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:ImportFrom_L3_C0", "label": "from django.contrib.gis.geos.prototypes.errcheck import check_geom, check_minus_one, check_sized_string\u2026", "type": "import", "loc": [3, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0294, 0.0168, 0, 0.66, 0.0455, 104, 0, 5, 0, 0, 104, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes.errcheck", "arg_names": [], "import_names": ["check_geom", "check_minus_one", "check_sized_string", "check_string", "check_zero"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes.errcheck import \\\n check_geom, check_minus_one, check_sized_string, check_string, check_zero"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:ImportFrom_L5_C0", "label": "from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.042, 0.0084, 0, 0.66, 0.0682, 130, 0, 1, 0, 0, 130, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes.threadsafe", "arg_names": [], "import_names": ["GEOSFunc"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L8_C0", "label": "c_uchar_p = POINTER()", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.0672, 0.0084, 0, 0.66, 0.0909, 593, 3, 1, 0, 0, 785, 10, 1], "semantic": {"name": "c_uchar_p", "arg_names": [], "import_names": [], "rhs_call_name": "POINTER", "annotation": ""}, "snippet": "c_uchar_p = POINTER(c_ubyte)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:ClassDef_L17_C0", "label": "geos_char_p", "type": "class", "loc": [17, 18], "level": 0, "parent": null, "vector": [3, 0, 0.1471, 0.0168, 0, 0.66, 0.1136, 22, 0, 0, 0, 0, 288, 0, 0], "semantic": {"name": "geos_char_p", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class geos_char_p(c_char_p):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L21_C0", "label": "bin_constructor", "type": "function", "loc": [21, 26], "level": 0, "parent": null, "vector": [2, 0, 0.1975, 0.0504, 0, 0.66, 0.1364, 584, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "bin_constructor", "arg_names": ["func"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def bin_constructor(func):\n \"Generates a prototype for binary construction (HEX, WKB) GEOS routines.\"\n func.argtypes = [c_char_p, c_size_t]\n func.restype = GEOM_PTR\n func.errcheck = check_geom\n return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Expr_L22_C4", "label": "expression", "type": "expression", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L21_C0", "vector": [8, 1, 0.1849, 0.0084, 1, 0.89, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Generates a prototype for binary construction (HEX, WKB) GEOS routines.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L23_C4", "label": "func.argtypes =", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L21_C0", "vector": [14, 1, 0.1933, 0.0084, 1, 0.89, 0.25, 441, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.argtypes = [c_char_p, c_size_t]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L24_C4", "label": "func.restype =", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L21_C0", "vector": [14, 1, 0.2017, 0.0084, 1, 0.89, 0.5, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = GEOM_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L25_C4", "label": "func.errcheck =", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L21_C0", "vector": [14, 1, 0.2101, 0.0084, 1, 0.89, 0.75, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.errcheck = check_geom"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Return_L26_C4", "label": "return", "type": "return", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L21_C0", "vector": [13, 1, 0.2185, 0.0084, 1, 0.89, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L29_C0", "label": "bin_output", "type": "function", "loc": [29, 34], "level": 0, "parent": null, "vector": [2, 0, 0.2647, 0.0504, 0, 0.66, 0.1591, 933, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "bin_output", "arg_names": ["func"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def bin_output(func):\n \"Generates a prototype for the routines that return a a sized string.\"\n func.argtypes = [GEOM_PTR, POINTER(c_size_t)]\n func.errcheck = check_sized_string\n func.restype = c_uchar_p\n return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Expr_L30_C4", "label": "expression", "type": "expression", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L29_C0", "vector": [8, 1, 0.2521, 0.0084, 1, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Generates a prototype for the routines that return a a sized string.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L31_C4", "label": "func.argtypes =", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L29_C0", "vector": [14, 1, 0.2605, 0.0084, 1, 0.54, 0.25, 441, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.argtypes = [GEOM_PTR, POINTER(c_size_t)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L32_C4", "label": "func.errcheck =", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L29_C0", "vector": [14, 1, 0.2689, 0.0084, 1, 0.54, 0.5, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.errcheck = check_sized_string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L33_C4", "label": "func.restype =", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L29_C0", "vector": [14, 1, 0.2773, 0.0084, 1, 0.54, 0.75, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = c_uchar_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Return_L34_C4", "label": "return", "type": "return", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L29_C0", "vector": [13, 1, 0.2857, 0.0084, 1, 0.54, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L36_C0", "label": "geom_output", "type": "function", "loc": [36, 41], "level": 0, "parent": null, "vector": [2, 0, 0.3235, 0.0504, 0, 0.66, 0.1818, 16, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "geom_output", "arg_names": ["func", "argtypes"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def geom_output(func, argtypes):\n \"For GEOS routines that return a geometry.\"\n if argtypes: func.argtypes = argtypes\n func.restype = GEOM_PTR\n func.errcheck = check_geom\n return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Expr_L37_C4", "label": "expression", "type": "expression", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L36_C0", "vector": [8, 1, 0.3109, 0.0084, 1, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"For GEOS routines that return a geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:If_L38_C4", "label": "if", "type": "if", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L36_C0", "vector": [4, 1, 0.3193, 0.0084, 1, 0.49, 0.25, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if argtypes: func.argtypes = argtypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L38_C17", "label": "func.argtypes =", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:If_L38_C4", "vector": [14, 2, 0.3193, 0.0084, 2, 0.59, 0.0, 441, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if argtypes: func.argtypes = argtypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L39_C4", "label": "func.restype =", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L36_C0", "vector": [14, 1, 0.3277, 0.0084, 1, 0.49, 0.5, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = GEOM_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L40_C4", "label": "func.errcheck =", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L36_C0", "vector": [14, 1, 0.3361, 0.0084, 1, 0.49, 0.75, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.errcheck = check_geom"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Return_L41_C4", "label": "return", "type": "return", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L36_C0", "vector": [13, 1, 0.3445, 0.0084, 1, 0.49, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L43_C0", "label": "geom_index", "type": "function", "loc": [43, 45], "level": 0, "parent": null, "vector": [2, 0, 0.3697, 0.0252, 0, 0.66, 0.2045, 894, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "geom_index", "arg_names": ["func"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def geom_index(func):\n \"For GEOS routines that return geometries from an index.\"\n return geom_output(func, [GEOM_PTR, c_int])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Expr_L44_C4", "label": "expression", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L43_C0", "vector": [8, 1, 0.3697, 0.0084, 1, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"For GEOS routines that return geometries from an index.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Return_L45_C4", "label": "return", "type": "return", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L43_C0", "vector": [13, 1, 0.3782, 0.0084, 1, 0.44, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return geom_output(func, [GEOM_PTR, c_int])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L47_C0", "label": "int_from_geom", "type": "function", "loc": [47, 55], "level": 0, "parent": null, "vector": [2, 0, 0.4286, 0.0756, 0, 0.66, 0.2273, 312, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "int_from_geom", "arg_names": ["func", "zero"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def int_from_geom(func, zero=False):\n \"Argument is a geometry, return type is an integer.\"\n func.argtypes = [GEOM_PTR]\n func.restype = c_int\n if zero:\n func.errcheck = check_zero\n else:\n func.errcheck = check_minus_one"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Expr_L48_C4", "label": "expression", "type": "expression", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L47_C0", "vector": [8, 1, 0.4034, 0.0084, 1, 0.61, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Argument is a geometry, return type is an integer.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L49_C4", "label": "func.argtypes =", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L47_C0", "vector": [14, 1, 0.4118, 0.0084, 1, 0.61, 0.25, 441, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.argtypes = [GEOM_PTR]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L50_C4", "label": "func.restype =", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L47_C0", "vector": [14, 1, 0.4202, 0.0084, 1, 0.61, 0.5, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = c_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:If_L51_C4", "label": "if", "type": "if", "loc": [51, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L47_C0", "vector": [4, 1, 0.4412, 0.0336, 1, 0.61, 0.75, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if zero:\n func.errcheck = check_zero\n else:\n func.errcheck = check_minus_one"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L52_C8", "label": "func.errcheck =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:If_L51_C4", "vector": [14, 2, 0.437, 0.0084, 2, 0.41, 0.0, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.errcheck = check_zero"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L54_C8", "label": "func.errcheck =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:If_L51_C4", "vector": [14, 2, 0.4538, 0.0084, 2, 0.41, 1.0, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.errcheck = check_minus_one"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Return_L55_C4", "label": "return", "type": "return", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L47_C0", "vector": [13, 1, 0.4622, 0.0084, 1, 0.61, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L57_C0", "label": "string_from_geom", "type": "function", "loc": [57, 62], "level": 0, "parent": null, "vector": [2, 0, 0.5, 0.0504, 0, 0.66, 0.25, 514, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "string_from_geom", "arg_names": ["func"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def string_from_geom(func):\n \"Argument is a Geometry, return type is a string.\"\n func.argtypes = [GEOM_PTR]\n func.restype = geos_char_p\n func.errcheck = check_string\n return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Expr_L58_C4", "label": "expression", "type": "expression", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L57_C0", "vector": [8, 1, 0.4874, 0.0084, 1, 0.03, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Argument is a Geometry, return type is a string.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L59_C4", "label": "func.argtypes =", "type": "assigned_variable", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L57_C0", "vector": [14, 1, 0.4958, 0.0084, 1, 0.03, 0.25, 441, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.argtypes = [GEOM_PTR]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L60_C4", "label": "func.restype =", "type": "assigned_variable", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L57_C0", "vector": [14, 1, 0.5042, 0.0084, 1, 0.03, 0.5, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = geos_char_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L61_C4", "label": "func.errcheck =", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L57_C0", "vector": [14, 1, 0.5126, 0.0084, 1, 0.03, 0.75, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.errcheck = check_string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Return_L62_C4", "label": "return", "type": "return", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L57_C0", "vector": [13, 1, 0.521, 0.0084, 1, 0.03, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L67_C0", "label": "from_hex = bin_constructor()", "type": "assigned_variable", "loc": [67, 67], "level": 0, "parent": null, "vector": [14, 0, 0.563, 0.0084, 0, 0.66, 0.2727, 701, 3, 1, 0, 0, 584, 10, 2], "semantic": {"name": "from_hex", "arg_names": [], "import_names": [], "rhs_call_name": "bin_constructor", "annotation": ""}, "snippet": "from_hex = bin_constructor(GEOSFunc('GEOSGeomFromHEX_buf'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L68_C0", "label": "from_wkb = bin_constructor()", "type": "assigned_variable", "loc": [68, 68], "level": 0, "parent": null, "vector": [14, 0, 0.5714, 0.0084, 0, 0.66, 0.2955, 581, 3, 1, 0, 0, 584, 10, 2], "semantic": {"name": "from_wkb", "arg_names": [], "import_names": [], "rhs_call_name": "bin_constructor", "annotation": ""}, "snippet": "from_wkb = bin_constructor(GEOSFunc('GEOSGeomFromWKB_buf'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L69_C0", "label": "from_wkt = geom_output()", "type": "assigned_variable", "loc": [69, 69], "level": 0, "parent": null, "vector": [14, 0, 0.5798, 0.0084, 0, 0.66, 0.3182, 252, 3, 2, 0, 0, 16, 10, 2], "semantic": {"name": "from_wkt", "arg_names": [], "import_names": [], "rhs_call_name": "geom_output", "annotation": ""}, "snippet": "from_wkt = geom_output(GEOSFunc('GEOSGeomFromWKT'), [c_char_p])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L72_C0", "label": "to_hex = bin_output()", "type": "assigned_variable", "loc": [72, 72], "level": 0, "parent": null, "vector": [14, 0, 0.605, 0.0084, 0, 0.66, 0.3409, 33, 3, 1, 0, 0, 933, 10, 2], "semantic": {"name": "to_hex", "arg_names": [], "import_names": [], "rhs_call_name": "bin_output", "annotation": ""}, "snippet": "to_hex = bin_output(GEOSFunc('GEOSGeomToHEX_buf'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L73_C0", "label": "to_wkb = bin_output()", "type": "assigned_variable", "loc": [73, 73], "level": 0, "parent": null, "vector": [14, 0, 0.6134, 0.0084, 0, 0.66, 0.3636, 265, 3, 1, 0, 0, 933, 10, 2], "semantic": {"name": "to_wkb", "arg_names": [], "import_names": [], "rhs_call_name": "bin_output", "annotation": ""}, "snippet": "to_wkb = bin_output(GEOSFunc('GEOSGeomToWKB_buf'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L74_C0", "label": "to_wkt = string_from_geom()", "type": "assigned_variable", "loc": [74, 74], "level": 0, "parent": null, "vector": [14, 0, 0.6218, 0.0084, 0, 0.66, 0.3864, 255, 3, 1, 0, 0, 514, 10, 2], "semantic": {"name": "to_wkt", "arg_names": [], "import_names": [], "rhs_call_name": "string_from_geom", "annotation": ""}, "snippet": "to_wkt = string_from_geom(GEOSFunc('GEOSGeomToWKT'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L77_C0", "label": "geos_normalize = int_from_geom()", "type": "assigned_variable", "loc": [77, 77], "level": 0, "parent": null, "vector": [14, 0, 0.6471, 0.0084, 0, 0.66, 0.4091, 46, 3, 1, 0, 0, 312, 10, 2], "semantic": {"name": "geos_normalize", "arg_names": [], "import_names": [], "rhs_call_name": "int_from_geom", "annotation": ""}, "snippet": "geos_normalize = int_from_geom(GEOSFunc('GEOSNormalize'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L78_C0", "label": "geos_type = string_from_geom()", "type": "assigned_variable", "loc": [78, 78], "level": 0, "parent": null, "vector": [14, 0, 0.6555, 0.0084, 0, 0.66, 0.4318, 294, 3, 1, 0, 0, 514, 10, 2], "semantic": {"name": "geos_type", "arg_names": [], "import_names": [], "rhs_call_name": "string_from_geom", "annotation": ""}, "snippet": "geos_type = string_from_geom(GEOSFunc('GEOSGeomType'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L79_C0", "label": "geos_typeid = int_from_geom()", "type": "assigned_variable", "loc": [79, 79], "level": 0, "parent": null, "vector": [14, 0, 0.6639, 0.0084, 0, 0.66, 0.4545, 384, 3, 1, 0, 0, 312, 10, 2], "semantic": {"name": "geos_typeid", "arg_names": [], "import_names": [], "rhs_call_name": "int_from_geom", "annotation": ""}, "snippet": "geos_typeid = int_from_geom(GEOSFunc('GEOSGeomTypeId'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L80_C0", "label": "get_dims = int_from_geom()", "type": "assigned_variable", "loc": [80, 80], "level": 0, "parent": null, "vector": [14, 0, 0.6723, 0.0084, 0, 0.66, 0.4773, 558, 3, 2, 0, 0, 312, 10, 2], "semantic": {"name": "get_dims", "arg_names": [], "import_names": [], "rhs_call_name": "int_from_geom", "annotation": ""}, "snippet": "get_dims = int_from_geom(GEOSFunc('GEOSGeom_getDimensions'), zero=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L81_C0", "label": "get_num_coords = int_from_geom()", "type": "assigned_variable", "loc": [81, 81], "level": 0, "parent": null, "vector": [14, 0, 0.6807, 0.0084, 0, 0.66, 0.5, 233, 3, 1, 0, 0, 312, 10, 2], "semantic": {"name": "get_num_coords", "arg_names": [], "import_names": [], "rhs_call_name": "int_from_geom", "annotation": ""}, "snippet": "get_num_coords = int_from_geom(GEOSFunc('GEOSGetNumCoordinates'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L82_C0", "label": "get_num_geoms = int_from_geom()", "type": "assigned_variable", "loc": [82, 82], "level": 0, "parent": null, "vector": [14, 0, 0.6891, 0.0084, 0, 0.66, 0.5227, 62, 3, 1, 0, 0, 312, 10, 2], "semantic": {"name": "get_num_geoms", "arg_names": [], "import_names": [], "rhs_call_name": "int_from_geom", "annotation": ""}, "snippet": "get_num_geoms = int_from_geom(GEOSFunc('GEOSGetNumGeometries'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L85_C0", "label": "create_point = geom_output()", "type": "assigned_variable", "loc": [85, 85], "level": 0, "parent": null, "vector": [14, 0, 0.7143, 0.0084, 0, 0.66, 0.5455, 666, 3, 2, 0, 0, 16, 10, 2], "semantic": {"name": "create_point", "arg_names": [], "import_names": [], "rhs_call_name": "geom_output", "annotation": ""}, "snippet": "create_point = geom_output(GEOSFunc('GEOSGeom_createPoint'), [CS_PTR])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L86_C0", "label": "create_linestring = geom_output()", "type": "assigned_variable", "loc": [86, 86], "level": 0, "parent": null, "vector": [14, 0, 0.7227, 0.0084, 0, 0.66, 0.5682, 28, 3, 2, 0, 0, 16, 10, 2], "semantic": {"name": "create_linestring", "arg_names": [], "import_names": [], "rhs_call_name": "geom_output", "annotation": ""}, "snippet": "create_linestring = geom_output(GEOSFunc('GEOSGeom_createLineString'), [CS_PTR])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L87_C0", "label": "create_linearring = geom_output()", "type": "assigned_variable", "loc": [87, 87], "level": 0, "parent": null, "vector": [14, 0, 0.7311, 0.0084, 0, 0.66, 0.5909, 525, 3, 2, 0, 0, 16, 10, 2], "semantic": {"name": "create_linearring", "arg_names": [], "import_names": [], "rhs_call_name": "geom_output", "annotation": ""}, "snippet": "create_linearring = geom_output(GEOSFunc('GEOSGeom_createLinearRing'), [CS_PTR])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L91_C0", "label": "create_polygon = geom_output()", "type": "assigned_variable", "loc": [91, 91], "level": 0, "parent": null, "vector": [14, 0, 0.7647, 0.0084, 0, 0.66, 0.6136, 935, 3, 2, 0, 0, 16, 10, 2], "semantic": {"name": "create_polygon", "arg_names": [], "import_names": [], "rhs_call_name": "geom_output", "annotation": ""}, "snippet": "create_polygon = geom_output(GEOSFunc('GEOSGeom_createPolygon'), None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L92_C0", "label": "create_collection = geom_output()", "type": "assigned_variable", "loc": [92, 92], "level": 0, "parent": null, "vector": [14, 0, 0.7731, 0.0084, 0, 0.66, 0.6364, 52, 3, 2, 0, 0, 16, 10, 2], "semantic": {"name": "create_collection", "arg_names": [], "import_names": [], "rhs_call_name": "geom_output", "annotation": ""}, "snippet": "create_collection = geom_output(GEOSFunc('GEOSGeom_createCollection'), None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L95_C0", "label": "get_extring = geom_output()", "type": "assigned_variable", "loc": [95, 95], "level": 0, "parent": null, "vector": [14, 0, 0.7983, 0.0084, 0, 0.66, 0.6591, 233, 3, 2, 0, 0, 16, 10, 2], "semantic": {"name": "get_extring", "arg_names": [], "import_names": [], "rhs_call_name": "geom_output", "annotation": ""}, "snippet": "get_extring = geom_output(GEOSFunc('GEOSGetExteriorRing'), [GEOM_PTR])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L96_C0", "label": "get_intring = geom_index()", "type": "assigned_variable", "loc": [96, 96], "level": 0, "parent": null, "vector": [14, 0, 0.8067, 0.0084, 0, 0.66, 0.6818, 763, 3, 1, 0, 0, 894, 10, 2], "semantic": {"name": "get_intring", "arg_names": [], "import_names": [], "rhs_call_name": "geom_index", "annotation": ""}, "snippet": "get_intring = geom_index(GEOSFunc('GEOSGetInteriorRingN'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L97_C0", "label": "get_nrings = int_from_geom()", "type": "assigned_variable", "loc": [97, 97], "level": 0, "parent": null, "vector": [14, 0, 0.8151, 0.0084, 0, 0.66, 0.7045, 640, 3, 1, 0, 0, 312, 10, 2], "semantic": {"name": "get_nrings", "arg_names": [], "import_names": [], "rhs_call_name": "int_from_geom", "annotation": ""}, "snippet": "get_nrings = int_from_geom(GEOSFunc('GEOSGetNumInteriorRings'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L100_C0", "label": "get_geomn = geom_index()", "type": "assigned_variable", "loc": [100, 100], "level": 0, "parent": null, "vector": [14, 0, 0.8403, 0.0084, 0, 0.66, 0.7273, 50, 3, 1, 0, 0, 894, 10, 2], "semantic": {"name": "get_geomn", "arg_names": [], "import_names": [], "rhs_call_name": "geom_index", "annotation": ""}, "snippet": "get_geomn = geom_index(GEOSFunc('GEOSGetGeometryN'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L103_C0", "label": "geom_clone = GEOSFunc()", "type": "assigned_variable", "loc": [103, 103], "level": 0, "parent": null, "vector": [14, 0, 0.8655, 0.0084, 0, 0.66, 0.75, 54, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "geom_clone", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSFunc", "annotation": ""}, "snippet": "geom_clone = GEOSFunc('GEOSGeom_clone')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L104_C0", "label": "geom_clone.argtypes =", "type": "assigned_variable", "loc": [104, 104], "level": 0, "parent": null, "vector": [14, 0, 0.8739, 0.0084, 0, 0.66, 0.7727, 505, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "geom_clone.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "geom_clone.argtypes = [GEOM_PTR]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L105_C0", "label": "geom_clone.restype =", "type": "assigned_variable", "loc": [105, 105], "level": 0, "parent": null, "vector": [14, 0, 0.8824, 0.0084, 0, 0.66, 0.7955, 622, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geom_clone.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "geom_clone.restype = GEOM_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L108_C0", "label": "destroy_geom = GEOSFunc()", "type": "assigned_variable", "loc": [108, 108], "level": 0, "parent": null, "vector": [14, 0, 0.9076, 0.0084, 0, 0.66, 0.8182, 266, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "destroy_geom", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSFunc", "annotation": ""}, "snippet": "destroy_geom = GEOSFunc('GEOSGeom_destroy')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L109_C0", "label": "destroy_geom.argtypes =", "type": "assigned_variable", "loc": [109, 109], "level": 0, "parent": null, "vector": [14, 0, 0.916, 0.0084, 0, 0.66, 0.8409, 948, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "destroy_geom.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "destroy_geom.argtypes = [GEOM_PTR]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L110_C0", "label": "destroy_geom.restype =", "type": "assigned_variable", "loc": [110, 110], "level": 0, "parent": null, "vector": [14, 0, 0.9244, 0.0084, 0, 0.66, 0.8636, 469, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "destroy_geom.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "destroy_geom.restype = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L113_C0", "label": "geos_get_srid = GEOSFunc()", "type": "assigned_variable", "loc": [113, 113], "level": 0, "parent": null, "vector": [14, 0, 0.9496, 0.0084, 0, 0.66, 0.8864, 779, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "geos_get_srid", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSFunc", "annotation": ""}, "snippet": "geos_get_srid = GEOSFunc('GEOSGetSRID')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L114_C0", "label": "geos_get_srid.argtypes =", "type": "assigned_variable", "loc": [114, 114], "level": 0, "parent": null, "vector": [14, 0, 0.958, 0.0084, 0, 0.66, 0.9091, 524, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "geos_get_srid.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "geos_get_srid.argtypes = [GEOM_PTR]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L115_C0", "label": "geos_get_srid.restype =", "type": "assigned_variable", "loc": [115, 115], "level": 0, "parent": null, "vector": [14, 0, 0.9664, 0.0084, 0, 0.66, 0.9318, 618, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geos_get_srid.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "geos_get_srid.restype = c_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L117_C0", "label": "geos_set_srid = GEOSFunc()", "type": "assigned_variable", "loc": [117, 117], "level": 0, "parent": null, "vector": [14, 0, 0.9832, 0.0084, 0, 0.66, 0.9545, 340, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "geos_set_srid", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSFunc", "annotation": ""}, "snippet": "geos_set_srid = GEOSFunc('GEOSSetSRID')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L118_C0", "label": "geos_set_srid.argtypes =", "type": "assigned_variable", "loc": [118, 118], "level": 0, "parent": null, "vector": [14, 0, 0.9916, 0.0084, 0, 0.66, 0.9773, 979, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "geos_set_srid.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "geos_set_srid.argtypes = [GEOM_PTR, c_int]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L119_C0", "label": "geos_set_srid.restype =", "type": "assigned_variable", "loc": [119, 119], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.0084, 0, 0.66, 1.0, 913, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "geos_set_srid.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "geos_set_srid.restype = None"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Return_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Expr_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Return_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Expr_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:If_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:If_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L38_C17"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Return_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Return_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:If_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:If_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:If_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Return_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Assign_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Return_L62_C4"}] |
import threading
from ctypes import byref, c_char_p, c_int, c_char, c_size_t, Structure, POINTER
from django.contrib.gis.geos.base import GEOSBase
from django.contrib.gis.geos.libgeos import GEOM_PTR
from django.contrib.gis.geos.prototypes.errcheck import check_geom, check_string, check_sized_string
from django.contrib.gis.geos.prototypes.geom import c_uchar_p, geos_char_p
from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc
### The WKB/WKT Reader/Writer structures and pointers ###
class WKTReader_st(Structure): pass
class WKTWriter_st(Structure): pass
class WKBReader_st(Structure): pass
class WKBWriter_st(Structure): pass
WKT_READ_PTR = POINTER(WKTReader_st)
WKT_WRITE_PTR = POINTER(WKTWriter_st)
WKB_READ_PTR = POINTER(WKBReader_st)
WKB_WRITE_PTR = POINTER(WKBReader_st)
### WKTReader routines ###
wkt_reader_create = GEOSFunc('GEOSWKTReader_create')
wkt_reader_create.restype = WKT_READ_PTR
wkt_reader_destroy = GEOSFunc('GEOSWKTReader_destroy')
wkt_reader_destroy.argtypes = [WKT_READ_PTR]
wkt_reader_read = GEOSFunc('GEOSWKTReader_read')
wkt_reader_read.argtypes = [WKT_READ_PTR, c_char_p]
wkt_reader_read.restype = GEOM_PTR
wkt_reader_read.errcheck = check_geom
### WKTWriter routines ###
wkt_writer_create = GEOSFunc('GEOSWKTWriter_create')
wkt_writer_create.restype = WKT_WRITE_PTR
wkt_writer_destroy = GEOSFunc('GEOSWKTWriter_destroy')
wkt_writer_destroy.argtypes = [WKT_WRITE_PTR]
wkt_writer_write = GEOSFunc('GEOSWKTWriter_write')
wkt_writer_write.argtypes = [WKT_WRITE_PTR, GEOM_PTR]
wkt_writer_write.restype = geos_char_p
wkt_writer_write.errcheck = check_string
### WKBReader routines ###
wkb_reader_create = GEOSFunc('GEOSWKBReader_create')
wkb_reader_create.restype = WKB_READ_PTR
wkb_reader_destroy = GEOSFunc('GEOSWKBReader_destroy')
wkb_reader_destroy.argtypes = [WKB_READ_PTR]
def wkb_read_func(func):
# Although the function definitions take `const unsigned char *`
# as their parameter, we use c_char_p here so the function may
# take Python strings directly as parameters. Inside Python there
# is not a difference between signed and unsigned characters, so
# it is not a problem.
func.argtypes = [WKB_READ_PTR, c_char_p, c_size_t]
func.restype = GEOM_PTR
func.errcheck = check_geom
return func
wkb_reader_read = wkb_read_func(GEOSFunc('GEOSWKBReader_read'))
wkb_reader_read_hex = wkb_read_func(GEOSFunc('GEOSWKBReader_readHEX'))
### WKBWriter routines ###
wkb_writer_create = GEOSFunc('GEOSWKBWriter_create')
wkb_writer_create.restype = WKB_WRITE_PTR
wkb_writer_destroy = GEOSFunc('GEOSWKBWriter_destroy')
wkb_writer_destroy.argtypes = [WKB_WRITE_PTR]
# WKB Writing prototypes.
def wkb_write_func(func):
func.argtypes = [WKB_WRITE_PTR, GEOM_PTR, POINTER(c_size_t)]
func.restype = c_uchar_p
func.errcheck = check_sized_string
return func
wkb_writer_write = wkb_write_func(GEOSFunc('GEOSWKBWriter_write'))
wkb_writer_write_hex = wkb_write_func(GEOSFunc('GEOSWKBWriter_writeHEX'))
# WKBWriter property getter/setter prototypes.
def wkb_writer_get(func, restype=c_int):
func.argtypes = [WKB_WRITE_PTR]
func.restype = restype
return func
def wkb_writer_set(func, argtype=c_int):
func.argtypes = [WKB_WRITE_PTR, argtype]
return func
wkb_writer_get_byteorder = wkb_writer_get(GEOSFunc('GEOSWKBWriter_getByteOrder'))
wkb_writer_set_byteorder = wkb_writer_set(GEOSFunc('GEOSWKBWriter_setByteOrder'))
wkb_writer_get_outdim = wkb_writer_get(GEOSFunc('GEOSWKBWriter_getOutputDimension'))
wkb_writer_set_outdim = wkb_writer_set(GEOSFunc('GEOSWKBWriter_setOutputDimension'))
wkb_writer_get_include_srid = wkb_writer_get(GEOSFunc('GEOSWKBWriter_getIncludeSRID'), restype=c_char)
wkb_writer_set_include_srid = wkb_writer_set(GEOSFunc('GEOSWKBWriter_setIncludeSRID'), argtype=c_char)
### Base I/O Class ###
class IOBase(GEOSBase):
"Base class for GEOS I/O objects."
def __init__(self):
# Getting the pointer with the constructor.
self.ptr = self._constructor()
def __del__(self):
# Cleaning up with the appropriate destructor.
if self._ptr: self._destructor(self._ptr)
### Base WKB/WKT Reading and Writing objects ###
# Non-public WKB/WKT reader classes for internal use because
# their `read` methods return _pointers_ instead of GEOSGeometry
# objects.
class _WKTReader(IOBase):
_constructor = wkt_reader_create
_destructor = wkt_reader_destroy
ptr_type = WKT_READ_PTR
def read(self, wkt):
if not isinstance(wkt, basestring): raise TypeError
return wkt_reader_read(self.ptr, wkt)
class _WKBReader(IOBase):
_constructor = wkb_reader_create
_destructor = wkb_reader_destroy
ptr_type = WKB_READ_PTR
def read(self, wkb):
"Returns a _pointer_ to C GEOS Geometry object from the given WKB."
if isinstance(wkb, buffer):
wkb_s = str(wkb)
return wkb_reader_read(self.ptr, wkb_s, len(wkb_s))
elif isinstance(wkb, basestring):
return wkb_reader_read_hex(self.ptr, wkb, len(wkb))
else:
raise TypeError
### WKB/WKT Writer Classes ###
class WKTWriter(IOBase):
_constructor = wkt_writer_create
_destructor = wkt_writer_destroy
ptr_type = WKT_WRITE_PTR
def write(self, geom):
"Returns the WKT representation of the given geometry."
return wkt_writer_write(self.ptr, geom.ptr)
class WKBWriter(IOBase):
_constructor = wkb_writer_create
_destructor = wkb_writer_destroy
ptr_type = WKB_WRITE_PTR
def write(self, geom):
"Returns the WKB representation of the given geometry."
return buffer(wkb_writer_write(self.ptr, geom.ptr, byref(c_size_t())))
def write_hex(self, geom):
"Returns the HEXEWKB representation of the given geometry."
return wkb_writer_write_hex(self.ptr, geom.ptr, byref(c_size_t()))
### WKBWriter Properties ###
# Property for getting/setting the byteorder.
def _get_byteorder(self):
return wkb_writer_get_byteorder(self.ptr)
def _set_byteorder(self, order):
if not order in (0, 1): raise ValueError('Byte order parameter must be 0 (Big Endian) or 1 (Little Endian).')
wkb_writer_set_byteorder(self.ptr, order)
byteorder = property(_get_byteorder, _set_byteorder)
# Property for getting/setting the output dimension.
def _get_outdim(self):
return wkb_writer_get_outdim(self.ptr)
def _set_outdim(self, new_dim):
if not new_dim in (2, 3): raise ValueError('WKB output dimension must be 2 or 3')
wkb_writer_set_outdim(self.ptr, new_dim)
outdim = property(_get_outdim, _set_outdim)
# Property for getting/setting the include srid flag.
def _get_include_srid(self):
return bool(ord(wkb_writer_get_include_srid(self.ptr)))
def _set_include_srid(self, include):
if bool(include): flag = chr(1)
else: flag = chr(0)
wkb_writer_set_include_srid(self.ptr, flag)
srid = property(_get_include_srid, _set_include_srid)
# `ThreadLocalIO` object holds instances of the WKT and WKB reader/writer
# objects that are local to the thread. The `GEOSGeometry` internals
# access these instances by calling the module-level functions, defined
# below.
class ThreadLocalIO(threading.local):
wkt_r = None
wkt_w = None
wkb_r = None
wkb_w = None
ewkb_w = None
ewkb_w3d = None
thread_context = ThreadLocalIO()
# These module-level routines return the I/O object that is local to the
# the thread. If the I/O object does not exist yet it will be initialized.
def wkt_r():
if not thread_context.wkt_r:
thread_context.wkt_r = _WKTReader()
return thread_context.wkt_r
def wkt_w():
if not thread_context.wkt_w:
thread_context.wkt_w = WKTWriter()
return thread_context.wkt_w
def wkb_r():
if not thread_context.wkb_r:
thread_context.wkb_r = _WKBReader()
return thread_context.wkb_r
def wkb_w():
if not thread_context.wkb_w:
thread_context.wkb_w = WKBWriter()
return thread_context.wkb_w
def ewkb_w():
if not thread_context.ewkb_w:
thread_context.ewkb_w = WKBWriter()
thread_context.ewkb_w.srid = True
return thread_context.ewkb_w
def ewkb_w3d():
if not thread_context.ewkb_w3d:
thread_context.ewkb_w3d = WKBWriter()
thread_context.ewkb_w3d.srid = True
thread_context.ewkb_w3d.outdim = 3
return thread_context.ewkb_w3d
| ajibawa-2023/Python-Code-Large/train/row_98724 | 163 | 242 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Import_L1_C0", "label": "threading import threading", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0041, 0.0041, 0, 0.66, 0.0, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["threading"], "rhs_call_name": "", "annotation": ""}, "snippet": "import threading"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:ImportFrom_L2_C0", "label": "from ctypes import byref, c_char_p, c_int\u2026", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0083, 0.0041, 0, 0.66, 0.0154, 182, 0, 7, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["byref", "c_char_p", "c_int", "c_char", "c_size_t", "Structure", "POINTER"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import byref, c_char_p, c_int, c_char, c_size_t, Structure, POINTER"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:ImportFrom_L3_C0", "label": "from django.contrib.gis.geos.base import GEOSBase", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0124, 0.0041, 0, 0.66, 0.0308, 386, 0, 1, 0, 0, 386, 0, 0], "semantic": {"name": "django.contrib.gis.geos.base", "arg_names": [], "import_names": ["GEOSBase"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.base import GEOSBase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:ImportFrom_L4_C0", "label": "from django.contrib.gis.geos.libgeos import GEOM_PTR", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0165, 0.0041, 0, 0.66, 0.0462, 64, 0, 1, 0, 0, 64, 0, 0], "semantic": {"name": "django.contrib.gis.geos.libgeos", "arg_names": [], "import_names": ["GEOM_PTR"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.libgeos import GEOM_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:ImportFrom_L5_C0", "label": "from django.contrib.gis.geos.prototypes.errcheck import check_geom, check_string, check_sized_string", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0207, 0.0041, 0, 0.66, 0.0615, 104, 0, 3, 0, 0, 104, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes.errcheck", "arg_names": [], "import_names": ["check_geom", "check_string", "check_sized_string"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes.errcheck import check_geom, check_string, check_sized_string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:ImportFrom_L6_C0", "label": "from django.contrib.gis.geos.prototypes.geom import c_uchar_p, geos_char_p", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0248, 0.0041, 0, 0.66, 0.0769, 589, 0, 2, 0, 0, 589, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes.geom", "arg_names": [], "import_names": ["c_uchar_p", "geos_char_p"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes.geom import c_uchar_p, geos_char_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:ImportFrom_L7_C0", "label": "from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0289, 0.0041, 0, 0.66, 0.0923, 130, 0, 1, 0, 0, 130, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes.threadsafe", "arg_names": [], "import_names": ["GEOSFunc"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L10_C0", "label": "WKTReader_st", "type": "class", "loc": [10, 10], "level": 0, "parent": null, "vector": [3, 0, 0.0413, 0.0041, 0, 0.66, 0.1077, 62, 0, 0, 0, 0, 183, 0, 0], "semantic": {"name": "WKTReader_st", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WKTReader_st(Structure): pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L11_C0", "label": "WKTWriter_st", "type": "class", "loc": [11, 11], "level": 0, "parent": null, "vector": [3, 0, 0.0455, 0.0041, 0, 0.66, 0.1231, 683, 0, 0, 0, 0, 183, 0, 0], "semantic": {"name": "WKTWriter_st", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WKTWriter_st(Structure): pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L12_C0", "label": "WKBReader_st", "type": "class", "loc": [12, 12], "level": 0, "parent": null, "vector": [3, 0, 0.0496, 0.0041, 0, 0.66, 0.1385, 712, 0, 0, 0, 0, 183, 0, 0], "semantic": {"name": "WKBReader_st", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WKBReader_st(Structure): pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L13_C0", "label": "WKBWriter_st", "type": "class", "loc": [13, 13], "level": 0, "parent": null, "vector": [3, 0, 0.0537, 0.0041, 0, 0.66, 0.1538, 280, 0, 0, 0, 0, 183, 0, 0], "semantic": {"name": "WKBWriter_st", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WKBWriter_st(Structure): pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L15_C0", "label": "WKT_READ_PTR = POINTER()", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.062, 0.0041, 0, 0.66, 0.1692, 589, 3, 1, 0, 0, 785, 10, 1], "semantic": {"name": "WKT_READ_PTR", "arg_names": [], "import_names": [], "rhs_call_name": "POINTER", "annotation": ""}, "snippet": "WKT_READ_PTR = POINTER(WKTReader_st)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L16_C0", "label": "WKT_WRITE_PTR = POINTER()", "type": "assigned_variable", "loc": [16, 16], "level": 0, "parent": null, "vector": [14, 0, 0.0661, 0.0041, 0, 0.66, 0.1846, 523, 3, 1, 0, 0, 785, 10, 1], "semantic": {"name": "WKT_WRITE_PTR", "arg_names": [], "import_names": [], "rhs_call_name": "POINTER", "annotation": ""}, "snippet": "WKT_WRITE_PTR = POINTER(WKTWriter_st)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L17_C0", "label": "WKB_READ_PTR = POINTER()", "type": "assigned_variable", "loc": [17, 17], "level": 0, "parent": null, "vector": [14, 0, 0.0702, 0.0041, 0, 0.66, 0.2, 148, 3, 1, 0, 0, 785, 10, 1], "semantic": {"name": "WKB_READ_PTR", "arg_names": [], "import_names": [], "rhs_call_name": "POINTER", "annotation": ""}, "snippet": "WKB_READ_PTR = POINTER(WKBReader_st)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L18_C0", "label": "WKB_WRITE_PTR = POINTER()", "type": "assigned_variable", "loc": [18, 18], "level": 0, "parent": null, "vector": [14, 0, 0.0744, 0.0041, 0, 0.66, 0.2154, 459, 3, 1, 0, 0, 785, 10, 1], "semantic": {"name": "WKB_WRITE_PTR", "arg_names": [], "import_names": [], "rhs_call_name": "POINTER", "annotation": ""}, "snippet": "WKB_WRITE_PTR = POINTER(WKBReader_st)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L21_C0", "label": "wkt_reader_create = GEOSFunc()", "type": "assigned_variable", "loc": [21, 21], "level": 0, "parent": null, "vector": [14, 0, 0.0868, 0.0041, 0, 0.66, 0.2308, 535, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "wkt_reader_create", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSFunc", "annotation": ""}, "snippet": "wkt_reader_create = GEOSFunc('GEOSWKTReader_create')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L22_C0", "label": "wkt_reader_create.restype =", "type": "assigned_variable", "loc": [22, 22], "level": 0, "parent": null, "vector": [14, 0, 0.0909, 0.0041, 0, 0.66, 0.2462, 292, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "wkt_reader_create.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "wkt_reader_create.restype = WKT_READ_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L24_C0", "label": "wkt_reader_destroy = GEOSFunc()", "type": "assigned_variable", "loc": [24, 24], "level": 0, "parent": null, "vector": [14, 0, 0.0992, 0.0041, 0, 0.66, 0.2615, 758, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "wkt_reader_destroy", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSFunc", "annotation": ""}, "snippet": "wkt_reader_destroy = GEOSFunc('GEOSWKTReader_destroy')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L25_C0", "label": "wkt_reader_destroy.argtypes =", "type": "assigned_variable", "loc": [25, 25], "level": 0, "parent": null, "vector": [14, 0, 0.1033, 0.0041, 0, 0.66, 0.2769, 469, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "wkt_reader_destroy.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "wkt_reader_destroy.argtypes = [WKT_READ_PTR]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L27_C0", "label": "wkt_reader_read = GEOSFunc()", "type": "assigned_variable", "loc": [27, 27], "level": 0, "parent": null, "vector": [14, 0, 0.1116, 0.0041, 0, 0.66, 0.2923, 335, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "wkt_reader_read", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSFunc", "annotation": ""}, "snippet": "wkt_reader_read = GEOSFunc('GEOSWKTReader_read')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L28_C0", "label": "wkt_reader_read.argtypes =", "type": "assigned_variable", "loc": [28, 28], "level": 0, "parent": null, "vector": [14, 0, 0.1157, 0.0041, 0, 0.66, 0.3077, 879, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "wkt_reader_read.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "wkt_reader_read.argtypes = [WKT_READ_PTR, c_char_p]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L29_C0", "label": "wkt_reader_read.restype =", "type": "assigned_variable", "loc": [29, 29], "level": 0, "parent": null, "vector": [14, 0, 0.1198, 0.0041, 0, 0.66, 0.3231, 69, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "wkt_reader_read.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "wkt_reader_read.restype = GEOM_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L30_C0", "label": "wkt_reader_read.errcheck =", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.124, 0.0041, 0, 0.66, 0.3385, 783, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "wkt_reader_read.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "wkt_reader_read.errcheck = check_geom"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L33_C0", "label": "wkt_writer_create = GEOSFunc()", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 0.1364, 0.0041, 0, 0.66, 0.3538, 83, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "wkt_writer_create", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSFunc", "annotation": ""}, "snippet": "wkt_writer_create = GEOSFunc('GEOSWKTWriter_create')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L34_C0", "label": "wkt_writer_create.restype =", "type": "assigned_variable", "loc": [34, 34], "level": 0, "parent": null, "vector": [14, 0, 0.1405, 0.0041, 0, 0.66, 0.3692, 204, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "wkt_writer_create.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "wkt_writer_create.restype = WKT_WRITE_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L36_C0", "label": "wkt_writer_destroy = GEOSFunc()", "type": "assigned_variable", "loc": [36, 36], "level": 0, "parent": null, "vector": [14, 0, 0.1488, 0.0041, 0, 0.66, 0.3846, 423, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "wkt_writer_destroy", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSFunc", "annotation": ""}, "snippet": "wkt_writer_destroy = GEOSFunc('GEOSWKTWriter_destroy')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L37_C0", "label": "wkt_writer_destroy.argtypes =", "type": "assigned_variable", "loc": [37, 37], "level": 0, "parent": null, "vector": [14, 0, 0.1529, 0.0041, 0, 0.66, 0.4, 577, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "wkt_writer_destroy.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "wkt_writer_destroy.argtypes = [WKT_WRITE_PTR]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L39_C0", "label": "wkt_writer_write = GEOSFunc()", "type": "assigned_variable", "loc": [39, 39], "level": 0, "parent": null, "vector": [14, 0, 0.1612, 0.0041, 0, 0.66, 0.4154, 71, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "wkt_writer_write", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSFunc", "annotation": ""}, "snippet": "wkt_writer_write = GEOSFunc('GEOSWKTWriter_write')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L40_C0", "label": "wkt_writer_write.argtypes =", "type": "assigned_variable", "loc": [40, 40], "level": 0, "parent": null, "vector": [14, 0, 0.1653, 0.0041, 0, 0.66, 0.4308, 962, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "wkt_writer_write.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "wkt_writer_write.argtypes = [WKT_WRITE_PTR, GEOM_PTR]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L41_C0", "label": "wkt_writer_write.restype =", "type": "assigned_variable", "loc": [41, 41], "level": 0, "parent": null, "vector": [14, 0, 0.1694, 0.0041, 0, 0.66, 0.4462, 583, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "wkt_writer_write.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "wkt_writer_write.restype = geos_char_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L42_C0", "label": "wkt_writer_write.errcheck =", "type": "assigned_variable", "loc": [42, 42], "level": 0, "parent": null, "vector": [14, 0, 0.1736, 0.0041, 0, 0.66, 0.4615, 221, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "wkt_writer_write.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "wkt_writer_write.errcheck = check_string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L45_C0", "label": "wkb_reader_create = GEOSFunc()", "type": "assigned_variable", "loc": [45, 45], "level": 0, "parent": null, "vector": [14, 0, 0.186, 0.0041, 0, 0.66, 0.4769, 681, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "wkb_reader_create", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSFunc", "annotation": ""}, "snippet": "wkb_reader_create = GEOSFunc('GEOSWKBReader_create')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L46_C0", "label": "wkb_reader_create.restype =", "type": "assigned_variable", "loc": [46, 46], "level": 0, "parent": null, "vector": [14, 0, 0.1901, 0.0041, 0, 0.66, 0.4923, 4, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "wkb_reader_create.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "wkb_reader_create.restype = WKB_READ_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L48_C0", "label": "wkb_reader_destroy = GEOSFunc()", "type": "assigned_variable", "loc": [48, 48], "level": 0, "parent": null, "vector": [14, 0, 0.1983, 0.0041, 0, 0.66, 0.5077, 866, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "wkb_reader_destroy", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSFunc", "annotation": ""}, "snippet": "wkb_reader_destroy = GEOSFunc('GEOSWKBReader_destroy')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L49_C0", "label": "wkb_reader_destroy.argtypes =", "type": "assigned_variable", "loc": [49, 49], "level": 0, "parent": null, "vector": [14, 0, 0.2025, 0.0041, 0, 0.66, 0.5231, 540, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "wkb_reader_destroy.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "wkb_reader_destroy.argtypes = [WKB_READ_PTR]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L51_C0", "label": "wkb_read_func", "type": "function", "loc": [51, 60], "level": 0, "parent": null, "vector": [2, 0, 0.2293, 0.0413, 0, 0.66, 0.5385, 906, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "wkb_read_func", "arg_names": ["func"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def wkb_read_func(func):\n # Although the function definitions take `const unsigned char *`\n # as their parameter, we use c_char_p here so the function may\n # take Python strings directly as parameters. Inside Python there\n # is not a difference between signed and unsigned characters, so\n # it is not a problem.\n func.argtypes = [WKB_READ_PTR, c_char_p, c_size_t]\n func.restype = GEOM_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L57_C4", "label": "func.argtypes =", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L51_C0", "vector": [14, 1, 0.2355, 0.0041, 1, 0.98, 0.0, 441, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.argtypes = [WKB_READ_PTR, c_char_p, c_size_t]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L58_C4", "label": "func.restype =", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L51_C0", "vector": [14, 1, 0.2397, 0.0041, 1, 0.98, 0.3333, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = GEOM_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L59_C4", "label": "func.errcheck =", "type": "assigned_variable", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L51_C0", "vector": [14, 1, 0.2438, 0.0041, 1, 0.98, 0.6667, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.errcheck = check_geom"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L60_C4", "label": "return", "type": "return", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L51_C0", "vector": [13, 1, 0.2479, 0.0041, 1, 0.98, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L62_C0", "label": "wkb_reader_read = wkb_read_func()", "type": "assigned_variable", "loc": [62, 62], "level": 0, "parent": null, "vector": [14, 0, 0.2562, 0.0041, 0, 0.66, 0.5538, 278, 3, 1, 0, 0, 906, 10, 2], "semantic": {"name": "wkb_reader_read", "arg_names": [], "import_names": [], "rhs_call_name": "wkb_read_func", "annotation": ""}, "snippet": "wkb_reader_read = wkb_read_func(GEOSFunc('GEOSWKBReader_read'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L63_C0", "label": "wkb_reader_read_hex = wkb_read_func()", "type": "assigned_variable", "loc": [63, 63], "level": 0, "parent": null, "vector": [14, 0, 0.2603, 0.0041, 0, 0.66, 0.5692, 834, 3, 1, 0, 0, 906, 10, 2], "semantic": {"name": "wkb_reader_read_hex", "arg_names": [], "import_names": [], "rhs_call_name": "wkb_read_func", "annotation": ""}, "snippet": "wkb_reader_read_hex = wkb_read_func(GEOSFunc('GEOSWKBReader_readHEX'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L66_C0", "label": "wkb_writer_create = GEOSFunc()", "type": "assigned_variable", "loc": [66, 66], "level": 0, "parent": null, "vector": [14, 0, 0.2727, 0.0041, 0, 0.66, 0.5846, 598, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "wkb_writer_create", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSFunc", "annotation": ""}, "snippet": "wkb_writer_create = GEOSFunc('GEOSWKBWriter_create')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L67_C0", "label": "wkb_writer_create.restype =", "type": "assigned_variable", "loc": [67, 67], "level": 0, "parent": null, "vector": [14, 0, 0.2769, 0.0041, 0, 0.66, 0.6, 784, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "wkb_writer_create.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "wkb_writer_create.restype = WKB_WRITE_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L69_C0", "label": "wkb_writer_destroy = GEOSFunc()", "type": "assigned_variable", "loc": [69, 69], "level": 0, "parent": null, "vector": [14, 0, 0.2851, 0.0041, 0, 0.66, 0.6154, 364, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "wkb_writer_destroy", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSFunc", "annotation": ""}, "snippet": "wkb_writer_destroy = GEOSFunc('GEOSWKBWriter_destroy')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L70_C0", "label": "wkb_writer_destroy.argtypes =", "type": "assigned_variable", "loc": [70, 70], "level": 0, "parent": null, "vector": [14, 0, 0.2893, 0.0041, 0, 0.66, 0.6308, 977, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "wkb_writer_destroy.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "wkb_writer_destroy.argtypes = [WKB_WRITE_PTR]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L73_C0", "label": "wkb_write_func", "type": "function", "loc": [73, 77], "level": 0, "parent": null, "vector": [2, 0, 0.3099, 0.0207, 0, 0.66, 0.6462, 184, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "wkb_write_func", "arg_names": ["func"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def wkb_write_func(func):\n func.argtypes = [WKB_WRITE_PTR, GEOM_PTR, POINTER(c_size_t)]\n func.restype = c_uchar_p\n func.errcheck = check_sized_string\n return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L74_C4", "label": "func.argtypes =", "type": "assigned_variable", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L73_C0", "vector": [14, 1, 0.3058, 0.0041, 1, 0.51, 0.0, 441, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.argtypes = [WKB_WRITE_PTR, GEOM_PTR, POINTER(c_size_t)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L75_C4", "label": "func.restype =", "type": "assigned_variable", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L73_C0", "vector": [14, 1, 0.3099, 0.0041, 1, 0.51, 0.3333, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = c_uchar_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L76_C4", "label": "func.errcheck =", "type": "assigned_variable", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L73_C0", "vector": [14, 1, 0.314, 0.0041, 1, 0.51, 0.6667, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.errcheck = check_sized_string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L77_C4", "label": "return", "type": "return", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L73_C0", "vector": [13, 1, 0.3182, 0.0041, 1, 0.51, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L79_C0", "label": "wkb_writer_write = wkb_write_func()", "type": "assigned_variable", "loc": [79, 79], "level": 0, "parent": null, "vector": [14, 0, 0.3264, 0.0041, 0, 0.66, 0.6615, 326, 3, 1, 0, 0, 184, 10, 2], "semantic": {"name": "wkb_writer_write", "arg_names": [], "import_names": [], "rhs_call_name": "wkb_write_func", "annotation": ""}, "snippet": "wkb_writer_write = wkb_write_func(GEOSFunc('GEOSWKBWriter_write'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L80_C0", "label": "wkb_writer_write_hex = wkb_write_func()", "type": "assigned_variable", "loc": [80, 80], "level": 0, "parent": null, "vector": [14, 0, 0.3306, 0.0041, 0, 0.66, 0.6769, 654, 3, 1, 0, 0, 184, 10, 2], "semantic": {"name": "wkb_writer_write_hex", "arg_names": [], "import_names": [], "rhs_call_name": "wkb_write_func", "annotation": ""}, "snippet": "wkb_writer_write_hex = wkb_write_func(GEOSFunc('GEOSWKBWriter_writeHEX'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L83_C0", "label": "wkb_writer_get", "type": "function", "loc": [83, 86], "level": 0, "parent": null, "vector": [2, 0, 0.3492, 0.0165, 0, 0.66, 0.6923, 673, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "wkb_writer_get", "arg_names": ["func", "restype"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def wkb_writer_get(func, restype=c_int):\n func.argtypes = [WKB_WRITE_PTR]\n func.restype = restype\n return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L84_C4", "label": "func.argtypes =", "type": "assigned_variable", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L83_C0", "vector": [14, 1, 0.3471, 0.0041, 1, 0.97, 0.0, 441, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.argtypes = [WKB_WRITE_PTR]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L85_C4", "label": "func.restype =", "type": "assigned_variable", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L83_C0", "vector": [14, 1, 0.3512, 0.0041, 1, 0.97, 0.5, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = restype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L86_C4", "label": "return", "type": "return", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L83_C0", "vector": [13, 1, 0.3554, 0.0041, 1, 0.97, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L88_C0", "label": "wkb_writer_set", "type": "function", "loc": [88, 90], "level": 0, "parent": null, "vector": [2, 0, 0.3678, 0.0124, 0, 0.66, 0.7077, 515, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "wkb_writer_set", "arg_names": ["func", "argtype"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def wkb_writer_set(func, argtype=c_int):\n func.argtypes = [WKB_WRITE_PTR, argtype]\n return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L89_C4", "label": "func.argtypes =", "type": "assigned_variable", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L88_C0", "vector": [14, 1, 0.3678, 0.0041, 1, 0.41, 0.0, 441, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.argtypes = [WKB_WRITE_PTR, argtype]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L90_C4", "label": "return", "type": "return", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L88_C0", "vector": [13, 1, 0.3719, 0.0041, 1, 0.41, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L92_C0", "label": "wkb_writer_get_byteorder = wkb_writer_get()", "type": "assigned_variable", "loc": [92, 92], "level": 0, "parent": null, "vector": [14, 0, 0.3802, 0.0041, 0, 0.66, 0.7231, 327, 3, 1, 0, 0, 673, 10, 2], "semantic": {"name": "wkb_writer_get_byteorder", "arg_names": [], "import_names": [], "rhs_call_name": "wkb_writer_get", "annotation": ""}, "snippet": "wkb_writer_get_byteorder = wkb_writer_get(GEOSFunc('GEOSWKBWriter_getByteOrder'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L93_C0", "label": "wkb_writer_set_byteorder = wkb_writer_set()", "type": "assigned_variable", "loc": [93, 93], "level": 0, "parent": null, "vector": [14, 0, 0.3843, 0.0041, 0, 0.66, 0.7385, 399, 3, 1, 0, 0, 515, 10, 2], "semantic": {"name": "wkb_writer_set_byteorder", "arg_names": [], "import_names": [], "rhs_call_name": "wkb_writer_set", "annotation": ""}, "snippet": "wkb_writer_set_byteorder = wkb_writer_set(GEOSFunc('GEOSWKBWriter_setByteOrder'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L94_C0", "label": "wkb_writer_get_outdim = wkb_writer_get()", "type": "assigned_variable", "loc": [94, 94], "level": 0, "parent": null, "vector": [14, 0, 0.3884, 0.0041, 0, 0.66, 0.7538, 954, 3, 1, 0, 0, 673, 10, 2], "semantic": {"name": "wkb_writer_get_outdim", "arg_names": [], "import_names": [], "rhs_call_name": "wkb_writer_get", "annotation": ""}, "snippet": "wkb_writer_get_outdim = wkb_writer_get(GEOSFunc('GEOSWKBWriter_getOutputDimension'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L95_C0", "label": "wkb_writer_set_outdim = wkb_writer_set()", "type": "assigned_variable", "loc": [95, 95], "level": 0, "parent": null, "vector": [14, 0, 0.3926, 0.0041, 0, 0.66, 0.7692, 396, 3, 1, 0, 0, 515, 10, 2], "semantic": {"name": "wkb_writer_set_outdim", "arg_names": [], "import_names": [], "rhs_call_name": "wkb_writer_set", "annotation": ""}, "snippet": "wkb_writer_set_outdim = wkb_writer_set(GEOSFunc('GEOSWKBWriter_setOutputDimension'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L96_C0", "label": "wkb_writer_get_include_srid = wkb_writer_get()", "type": "assigned_variable", "loc": [96, 96], "level": 0, "parent": null, "vector": [14, 0, 0.3967, 0.0041, 0, 0.66, 0.7846, 561, 3, 2, 0, 0, 673, 10, 2], "semantic": {"name": "wkb_writer_get_include_srid", "arg_names": [], "import_names": [], "rhs_call_name": "wkb_writer_get", "annotation": ""}, "snippet": "wkb_writer_get_include_srid = wkb_writer_get(GEOSFunc('GEOSWKBWriter_getIncludeSRID'), restype=c_char)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L97_C0", "label": "wkb_writer_set_include_srid = wkb_writer_set()", "type": "assigned_variable", "loc": [97, 97], "level": 0, "parent": null, "vector": [14, 0, 0.4008, 0.0041, 0, 0.66, 0.8, 943, 3, 2, 0, 0, 515, 10, 2], "semantic": {"name": "wkb_writer_set_include_srid", "arg_names": [], "import_names": [], "rhs_call_name": "wkb_writer_set", "annotation": ""}, "snippet": "wkb_writer_set_include_srid = wkb_writer_set(GEOSFunc('GEOSWKBWriter_setIncludeSRID'), argtype=c_char)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L100_C0", "label": "IOBase", "type": "class", "loc": [100, 108], "level": 0, "parent": null, "vector": [3, 0, 0.4298, 0.0372, 0, 0.66, 0.8154, 41, 0, 2, 0, 0, 274, 0, 2], "semantic": {"name": "IOBase", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class IOBase(GEOSBase):\n \"Base class for GEOS I/O objects.\"\n def __init__(self):\n # Getting the pointer with the constructor.\n self.ptr = self._constructor()\n\n def __del__(self):\n # Cleaning up with the appropriate destructor."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Expr_L101_C4", "label": "expression", "type": "expression", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L100_C0", "vector": [8, 1, 0.4174, 0.0041, 1, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Base class for GEOS I/O objects.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L102_C4", "label": "__init__", "type": "function", "loc": [102, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L100_C0", "vector": [2, 1, 0.4256, 0.0124, 1, 0.84, 0.5, 555, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n # Getting the pointer with the constructor.\n self.ptr = self._constructor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L104_C8", "label": "self.ptr = _constructor()", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L102_C4", "vector": [14, 2, 0.4298, 0.0041, 2, 0.26, 0.0, 386, 3, 0, 0, 0, 344, 10, 1], "semantic": {"name": "self.ptr", "arg_names": [], "import_names": [], "rhs_call_name": "_constructor", "annotation": ""}, "snippet": " self.ptr = self._constructor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L106_C4", "label": "__del__", "type": "function", "loc": [106, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L100_C0", "vector": [2, 1, 0.4421, 0.0124, 1, 0.84, 1.0, 258, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__del__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __del__(self):\n # Cleaning up with the appropriate destructor.\n if self._ptr: self._destructor(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L108_C8", "label": "if", "type": "if", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L106_C4", "vector": [4, 2, 0.4463, 0.0041, 2, 0.68, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._ptr: self._destructor(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Expr_L108_C22", "label": "_destructor()", "type": "expression", "loc": [108, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L108_C8", "vector": [8, 3, 0.4463, 0.0041, 3, 0.15, 0.0, 93, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_destructor", "arg_names": [], "import_names": [], "rhs_call_name": "_destructor", "annotation": ""}, "snippet": " if self._ptr: self._destructor(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L115_C0", "label": "_WKTReader", "type": "class", "loc": [115, 122], "level": 0, "parent": null, "vector": [3, 0, 0.4897, 0.0331, 0, 0.66, 0.8308, 784, 0, 1, 0, 0, 41, 0, 2], "semantic": {"name": "_WKTReader", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class _WKTReader(IOBase):\n _constructor = wkt_reader_create\n _destructor = wkt_reader_destroy\n ptr_type = WKT_READ_PTR\n\n def read(self, wkt):\n if not isinstance(wkt, basestring): raise TypeError\n return wkt_reader_read(self.ptr, wkt)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L116_C4", "label": "_constructor =", "type": "assigned_variable", "loc": [116, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L115_C0", "vector": [14, 1, 0.4793, 0.0041, 1, 0.5, 0.0, 344, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_constructor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _constructor = wkt_reader_create"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L117_C4", "label": "_destructor =", "type": "assigned_variable", "loc": [117, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L115_C0", "vector": [14, 1, 0.4835, 0.0041, 1, 0.5, 0.3333, 93, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_destructor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _destructor = wkt_reader_destroy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L118_C4", "label": "ptr_type =", "type": "assigned_variable", "loc": [118, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L115_C0", "vector": [14, 1, 0.4876, 0.0041, 1, 0.5, 0.6667, 247, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ptr_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ptr_type = WKT_READ_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L120_C4", "label": "read", "type": "function", "loc": [120, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L115_C0", "vector": [2, 1, 0.5, 0.0124, 1, 0.5, 1.0, 453, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "read", "arg_names": ["self", "wkt"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def read(self, wkt):\n if not isinstance(wkt, basestring): raise TypeError\n return wkt_reader_read(self.ptr, wkt)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L121_C8", "label": "if", "type": "if", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L120_C4", "vector": [4, 2, 0.5, 0.0041, 2, 0.89, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(wkt, basestring): raise TypeError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L122_C8", "label": "return", "type": "return", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L120_C4", "vector": [13, 2, 0.5041, 0.0041, 2, 0.89, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return wkt_reader_read(self.ptr, wkt)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L124_C0", "label": "_WKBReader", "type": "class", "loc": [124, 137], "level": 0, "parent": null, "vector": [3, 0, 0.5393, 0.0579, 0, 0.66, 0.8462, 522, 0, 1, 0, 0, 41, 0, 7], "semantic": {"name": "_WKBReader", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class _WKBReader(IOBase):\n _constructor = wkb_reader_create\n _destructor = wkb_reader_destroy\n ptr_type = WKB_READ_PTR\n\n def read(self, wkb):\n \"Returns a _pointer_ to C GEOS Geometry object from the given WKB.\"\n if isinstance(wkb, buffer):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L125_C4", "label": "_constructor =", "type": "assigned_variable", "loc": [125, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L124_C0", "vector": [14, 1, 0.5165, 0.0041, 1, 0.44, 0.0, 344, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_constructor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _constructor = wkb_reader_create"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L126_C4", "label": "_destructor =", "type": "assigned_variable", "loc": [126, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L124_C0", "vector": [14, 1, 0.5207, 0.0041, 1, 0.44, 0.3333, 93, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_destructor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _destructor = wkb_reader_destroy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L127_C4", "label": "ptr_type =", "type": "assigned_variable", "loc": [127, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L124_C0", "vector": [14, 1, 0.5248, 0.0041, 1, 0.44, 0.6667, 247, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ptr_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ptr_type = WKB_READ_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L129_C4", "label": "read", "type": "function", "loc": [129, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L124_C0", "vector": [2, 1, 0.5496, 0.0372, 1, 0.44, 1.0, 453, 0, 2, 1, 0, 0, 0, 7], "semantic": {"name": "read", "arg_names": ["self", "wkb"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def read(self, wkb):\n \"Returns a _pointer_ to C GEOS Geometry object from the given WKB.\"\n if isinstance(wkb, buffer):\n wkb_s = str(wkb)\n return wkb_reader_read(self.ptr, wkb_s, len(wkb_s))\n elif isinstance(wkb, basestring):\n return wkb_reader_read_hex(self.ptr, wkb, len(wkb))\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Expr_L130_C8", "label": "expression", "type": "expression", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L129_C4", "vector": [8, 2, 0.5372, 0.0041, 2, 0.55, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a _pointer_ to C GEOS Geometry object from the given WKB.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L131_C8", "label": "if", "type": "if", "loc": [131, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L129_C4", "vector": [4, 2, 0.5537, 0.0289, 2, 0.55, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(wkb, buffer):\n wkb_s = str(wkb)\n return wkb_reader_read(self.ptr, wkb_s, len(wkb_s))\n elif isinstance(wkb, basestring):\n return wkb_reader_read_hex(self.ptr, wkb, len(wkb))\n else:\n raise TypeError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L132_C12", "label": "wkb_s = str()", "type": "assigned_variable", "loc": [132, 132], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L131_C8", "vector": [14, 3, 0.5455, 0.0041, 3, 0.19, 0.0, 725, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "wkb_s", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " wkb_s = str(wkb)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L133_C12", "label": "return", "type": "return", "loc": [133, 133], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L131_C8", "vector": [13, 3, 0.5496, 0.0041, 3, 0.19, 0.5, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return wkb_reader_read(self.ptr, wkb_s, len(wkb_s))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L134_C8", "label": "if", "type": "if", "loc": [134, 137], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L131_C8", "vector": [4, 3, 0.5599, 0.0165, 3, 0.19, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(wkb, basestring):\n return wkb_reader_read_hex(self.ptr, wkb, len(wkb))\n else:\n raise TypeError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L135_C12", "label": "return", "type": "return", "loc": [135, 135], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L134_C8", "vector": [13, 4, 0.5579, 0.0041, 4, 0.48, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return wkb_reader_read_hex(self.ptr, wkb, len(wkb))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L140_C0", "label": "WKTWriter", "type": "class", "loc": [140, 147], "level": 0, "parent": null, "vector": [3, 0, 0.593, 0.0331, 0, 0.66, 0.8615, 905, 0, 1, 0, 0, 41, 0, 1], "semantic": {"name": "WKTWriter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WKTWriter(IOBase):\n _constructor = wkt_writer_create\n _destructor = wkt_writer_destroy\n ptr_type = WKT_WRITE_PTR\n\n def write(self, geom):\n \"Returns the WKT representation of the given geometry.\"\n return wkt_writer_write(self.ptr, geom.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L141_C4", "label": "_constructor =", "type": "assigned_variable", "loc": [141, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L140_C0", "vector": [14, 1, 0.5826, 0.0041, 1, 0.55, 0.0, 344, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_constructor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _constructor = wkt_writer_create"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L142_C4", "label": "_destructor =", "type": "assigned_variable", "loc": [142, 142], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L140_C0", "vector": [14, 1, 0.5868, 0.0041, 1, 0.55, 0.3333, 93, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_destructor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _destructor = wkt_writer_destroy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L143_C4", "label": "ptr_type =", "type": "assigned_variable", "loc": [143, 143], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L140_C0", "vector": [14, 1, 0.5909, 0.0041, 1, 0.55, 0.6667, 247, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ptr_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ptr_type = WKT_WRITE_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L145_C4", "label": "write", "type": "function", "loc": [145, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L140_C0", "vector": [2, 1, 0.6033, 0.0124, 1, 0.55, 1.0, 837, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": ["self", "geom"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def write(self, geom):\n \"Returns the WKT representation of the given geometry.\"\n return wkt_writer_write(self.ptr, geom.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Expr_L146_C8", "label": "expression", "type": "expression", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L145_C4", "vector": [8, 2, 0.6033, 0.0041, 2, 0.3, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the WKT representation of the given geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L147_C8", "label": "return", "type": "return", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L145_C4", "vector": [13, 2, 0.6074, 0.0041, 2, 0.3, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return wkt_writer_write(self.ptr, geom.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "label": "WKBWriter", "type": "class", "loc": [149, 193], "level": 0, "parent": null, "vector": [3, 0, 0.7066, 0.186, 0, 0.66, 0.8769, 96, 0, 8, 0, 0, 41, 0, 23], "semantic": {"name": "WKBWriter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WKBWriter(IOBase):\n _constructor = wkb_writer_create\n _destructor = wkb_writer_destroy\n ptr_type = WKB_WRITE_PTR\n\n def write(self, geom):\n \"Returns the WKB representation of the given geometry.\"\n return buffer(wkb_writer_write(self.ptr, geom.ptr, byref(c_size_t())))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L150_C4", "label": "_constructor =", "type": "assigned_variable", "loc": [150, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "vector": [14, 1, 0.6198, 0.0041, 1, 0.24, 0.0, 344, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_constructor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _constructor = wkb_writer_create"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L151_C4", "label": "_destructor =", "type": "assigned_variable", "loc": [151, 151], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "vector": [14, 1, 0.624, 0.0041, 1, 0.24, 0.0769, 93, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_destructor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _destructor = wkb_writer_destroy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L152_C4", "label": "ptr_type =", "type": "assigned_variable", "loc": [152, 152], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "vector": [14, 1, 0.6281, 0.0041, 1, 0.24, 0.1538, 247, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ptr_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ptr_type = WKB_WRITE_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L154_C4", "label": "write", "type": "function", "loc": [154, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "vector": [2, 1, 0.6405, 0.0124, 1, 0.24, 0.2308, 837, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "write", "arg_names": ["self", "geom"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def write(self, geom):\n \"Returns the WKB representation of the given geometry.\"\n return buffer(wkb_writer_write(self.ptr, geom.ptr, byref(c_size_t())))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Expr_L155_C8", "label": "expression", "type": "expression", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L154_C4", "vector": [8, 2, 0.6405, 0.0041, 2, 0.14, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the WKB representation of the given geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L156_C8", "label": "return", "type": "return", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L154_C4", "vector": [13, 2, 0.6446, 0.0041, 2, 0.14, 1.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return buffer(wkb_writer_write(self.ptr, geom.ptr, byref(c_size_t())))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L158_C4", "label": "write_hex", "type": "function", "loc": [158, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "vector": [2, 1, 0.657, 0.0124, 1, 0.24, 0.3077, 286, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "write_hex", "arg_names": ["self", "geom"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def write_hex(self, geom):\n \"Returns the HEXEWKB representation of the given geometry.\"\n return wkb_writer_write_hex(self.ptr, geom.ptr, byref(c_size_t()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Expr_L159_C8", "label": "expression", "type": "expression", "loc": [159, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L158_C4", "vector": [8, 2, 0.657, 0.0041, 2, 0.63, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the HEXEWKB representation of the given geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L160_C8", "label": "return", "type": "return", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L158_C4", "vector": [13, 2, 0.6612, 0.0041, 2, 0.63, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return wkb_writer_write_hex(self.ptr, geom.ptr, byref(c_size_t()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L165_C4", "label": "_get_byteorder", "type": "function", "loc": [165, 166], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "vector": [2, 1, 0.6839, 0.0083, 1, 0.24, 0.3846, 396, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "_get_byteorder", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_byteorder(self):\n return wkb_writer_get_byteorder(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L166_C8", "label": "return", "type": "return", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L165_C4", "vector": [13, 2, 0.686, 0.0041, 2, 0.98, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return wkb_writer_get_byteorder(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L168_C4", "label": "_set_byteorder", "type": "function", "loc": [168, 170], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "vector": [2, 1, 0.6983, 0.0124, 1, 0.24, 0.4615, 232, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_set_byteorder", "arg_names": ["self", "order"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_byteorder(self, order):\n if not order in (0, 1): raise ValueError('Byte order parameter must be 0 (Big Endian) or 1 (Little Endian).')\n wkb_writer_set_byteorder(self.ptr, order)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L169_C8", "label": "if", "type": "if", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L168_C4", "vector": [4, 2, 0.6983, 0.0041, 2, 0.46, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not order in (0, 1): raise ValueError('Byte order parameter must be 0 (Big Endian) or 1 (Little Endian).')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Expr_L170_C8", "label": "wkb_writer_set_byteorder()", "type": "expression", "loc": [170, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L168_C4", "vector": [8, 2, 0.7025, 0.0041, 2, 0.46, 1.0, 399, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "wkb_writer_set_byteorder", "arg_names": [], "import_names": [], "rhs_call_name": "wkb_writer_set_byteorder", "annotation": ""}, "snippet": " wkb_writer_set_byteorder(self.ptr, order)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L172_C4", "label": "byteorder = property()", "type": "assigned_variable", "loc": [172, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "vector": [14, 1, 0.7107, 0.0041, 1, 0.24, 0.5385, 509, 3, 2, 0, 0, 244, 10, 1], "semantic": {"name": "byteorder", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " byteorder = property(_get_byteorder, _set_byteorder)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L175_C4", "label": "_get_outdim", "type": "function", "loc": [175, 176], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "vector": [2, 1, 0.7252, 0.0083, 1, 0.24, 0.6154, 625, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "_get_outdim", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_outdim(self):\n return wkb_writer_get_outdim(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L176_C8", "label": "return", "type": "return", "loc": [176, 176], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L175_C4", "vector": [13, 2, 0.7273, 0.0041, 2, 0.57, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return wkb_writer_get_outdim(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L178_C4", "label": "_set_outdim", "type": "function", "loc": [178, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "vector": [2, 1, 0.7397, 0.0124, 1, 0.24, 0.6923, 935, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_set_outdim", "arg_names": ["self", "new_dim"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_outdim(self, new_dim):\n if not new_dim in (2, 3): raise ValueError('WKB output dimension must be 2 or 3')\n wkb_writer_set_outdim(self.ptr, new_dim)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L179_C8", "label": "if", "type": "if", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L178_C4", "vector": [4, 2, 0.7397, 0.0041, 2, 0.49, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not new_dim in (2, 3): raise ValueError('WKB output dimension must be 2 or 3')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Expr_L180_C8", "label": "wkb_writer_set_outdim()", "type": "expression", "loc": [180, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L178_C4", "vector": [8, 2, 0.7438, 0.0041, 2, 0.49, 1.0, 396, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "wkb_writer_set_outdim", "arg_names": [], "import_names": [], "rhs_call_name": "wkb_writer_set_outdim", "annotation": ""}, "snippet": " wkb_writer_set_outdim(self.ptr, new_dim)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L182_C4", "label": "outdim = property()", "type": "assigned_variable", "loc": [182, 182], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "vector": [14, 1, 0.7521, 0.0041, 1, 0.24, 0.7692, 840, 3, 2, 0, 0, 244, 10, 1], "semantic": {"name": "outdim", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " outdim = property(_get_outdim, _set_outdim)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L185_C4", "label": "_get_include_srid", "type": "function", "loc": [185, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "vector": [2, 1, 0.7665, 0.0083, 1, 0.24, 0.8462, 527, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "_get_include_srid", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_include_srid(self):\n return bool(ord(wkb_writer_get_include_srid(self.ptr)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L186_C8", "label": "return", "type": "return", "loc": [186, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L185_C4", "vector": [13, 2, 0.7686, 0.0041, 2, 0.72, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bool(ord(wkb_writer_get_include_srid(self.ptr)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L188_C4", "label": "_set_include_srid", "type": "function", "loc": [188, 191], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "vector": [2, 1, 0.7831, 0.0165, 1, 0.24, 0.9231, 806, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "_set_include_srid", "arg_names": ["self", "include"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_include_srid(self, include):\n if bool(include): flag = chr(1)\n else: flag = chr(0)\n wkb_writer_set_include_srid(self.ptr, flag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L189_C8", "label": "if", "type": "if", "loc": [189, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L188_C4", "vector": [4, 2, 0.7831, 0.0083, 2, 0.62, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if bool(include): flag = chr(1)\n else: flag = chr(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L189_C26", "label": "flag = chr()", "type": "assigned_variable", "loc": [189, 189], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L189_C8", "vector": [14, 3, 0.781, 0.0041, 3, 0.76, 0.0, 756, 3, 1, 0, 0, 915, 10, 1], "semantic": {"name": "flag", "arg_names": [], "import_names": [], "rhs_call_name": "chr", "annotation": ""}, "snippet": " if bool(include): flag = chr(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L190_C14", "label": "flag = chr()", "type": "assigned_variable", "loc": [190, 190], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L189_C8", "vector": [14, 3, 0.7851, 0.0041, 3, 0.76, 1.0, 756, 3, 1, 0, 0, 915, 10, 1], "semantic": {"name": "flag", "arg_names": [], "import_names": [], "rhs_call_name": "chr", "annotation": ""}, "snippet": " else: flag = chr(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Expr_L191_C8", "label": "wkb_writer_set_include_srid()", "type": "expression", "loc": [191, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L188_C4", "vector": [8, 2, 0.7893, 0.0041, 2, 0.62, 1.0, 943, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "wkb_writer_set_include_srid", "arg_names": [], "import_names": [], "rhs_call_name": "wkb_writer_set_include_srid", "annotation": ""}, "snippet": " wkb_writer_set_include_srid(self.ptr, flag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L193_C4", "label": "srid = property()", "type": "assigned_variable", "loc": [193, 193], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "vector": [14, 1, 0.7975, 0.0041, 1, 0.24, 1.0, 357, 3, 2, 0, 0, 244, 10, 1], "semantic": {"name": "srid", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " srid = property(_get_include_srid, _set_include_srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L199_C0", "label": "ThreadLocalIO", "type": "class", "loc": [199, 205], "level": 0, "parent": null, "vector": [3, 0, 0.8347, 0.0289, 0, 0.66, 0.8923, 215, 0, 0, 0, 0, 771, 0, 0], "semantic": {"name": "ThreadLocalIO", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ThreadLocalIO(threading.local):\n wkt_r = None\n wkt_w = None\n wkb_r = None\n wkb_w = None\n ewkb_w = None\n ewkb_w3d = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L200_C4", "label": "wkt_r =", "type": "assigned_variable", "loc": [200, 200], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L199_C0", "vector": [14, 1, 0.8264, 0.0041, 1, 0.76, 0.0, 808, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "wkt_r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wkt_r = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L201_C4", "label": "wkt_w =", "type": "assigned_variable", "loc": [201, 201], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L199_C0", "vector": [14, 1, 0.8306, 0.0041, 1, 0.76, 0.2, 284, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "wkt_w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wkt_w = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L202_C4", "label": "wkb_r =", "type": "assigned_variable", "loc": [202, 202], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L199_C0", "vector": [14, 1, 0.8347, 0.0041, 1, 0.76, 0.4, 944, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "wkb_r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wkb_r = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L203_C4", "label": "wkb_w =", "type": "assigned_variable", "loc": [203, 203], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L199_C0", "vector": [14, 1, 0.8388, 0.0041, 1, 0.76, 0.6, 723, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "wkb_w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wkb_w = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L204_C4", "label": "ewkb_w =", "type": "assigned_variable", "loc": [204, 204], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L199_C0", "vector": [14, 1, 0.843, 0.0041, 1, 0.76, 0.8, 298, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "ewkb_w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ewkb_w = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L205_C4", "label": "ewkb_w3d =", "type": "assigned_variable", "loc": [205, 205], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L199_C0", "vector": [14, 1, 0.8471, 0.0041, 1, 0.76, 1.0, 71, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "ewkb_w3d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ewkb_w3d = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L207_C0", "label": "thread_context = ThreadLocalIO()", "type": "assigned_variable", "loc": [207, 207], "level": 0, "parent": null, "vector": [14, 0, 0.8554, 0.0041, 0, 0.66, 0.9077, 60, 3, 0, 0, 0, 215, 10, 1], "semantic": {"name": "thread_context", "arg_names": [], "import_names": [], "rhs_call_name": "ThreadLocalIO", "annotation": ""}, "snippet": "thread_context = ThreadLocalIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L211_C0", "label": "wkt_r", "type": "function", "loc": [211, 214], "level": 0, "parent": null, "vector": [2, 0, 0.8781, 0.0165, 0, 0.66, 0.9231, 808, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "wkt_r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def wkt_r():\n if not thread_context.wkt_r:\n thread_context.wkt_r = _WKTReader()\n return thread_context.wkt_r"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L212_C4", "label": "if", "type": "if", "loc": [212, 213], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L211_C0", "vector": [4, 1, 0.8781, 0.0083, 1, 0.23, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not thread_context.wkt_r:\n thread_context.wkt_r = _WKTReader()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L213_C8", "label": "thread_context.wkt_r = _WKTReader()", "type": "assigned_variable", "loc": [213, 213], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L212_C4", "vector": [14, 2, 0.8802, 0.0041, 2, 0.97, 0.0, 429, 3, 0, 0, 0, 784, 10, 1], "semantic": {"name": "thread_context.wkt_r", "arg_names": [], "import_names": [], "rhs_call_name": "_WKTReader", "annotation": ""}, "snippet": " thread_context.wkt_r = _WKTReader()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L214_C4", "label": "return", "type": "return", "loc": [214, 214], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L211_C0", "vector": [13, 1, 0.8843, 0.0041, 1, 0.23, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return thread_context.wkt_r"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L216_C0", "label": "wkt_w", "type": "function", "loc": [216, 219], "level": 0, "parent": null, "vector": [2, 0, 0.8988, 0.0165, 0, 0.66, 0.9385, 284, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "wkt_w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def wkt_w():\n if not thread_context.wkt_w:\n thread_context.wkt_w = WKTWriter()\n return thread_context.wkt_w"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L217_C4", "label": "if", "type": "if", "loc": [217, 218], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L216_C0", "vector": [4, 1, 0.8988, 0.0083, 1, 0.16, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not thread_context.wkt_w:\n thread_context.wkt_w = WKTWriter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L218_C8", "label": "thread_context.wkt_w = WKTWriter()", "type": "assigned_variable", "loc": [218, 218], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L217_C4", "vector": [14, 2, 0.9008, 0.0041, 2, 0.41, 0.0, 695, 3, 0, 0, 0, 905, 10, 1], "semantic": {"name": "thread_context.wkt_w", "arg_names": [], "import_names": [], "rhs_call_name": "WKTWriter", "annotation": ""}, "snippet": " thread_context.wkt_w = WKTWriter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L219_C4", "label": "return", "type": "return", "loc": [219, 219], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L216_C0", "vector": [13, 1, 0.905, 0.0041, 1, 0.16, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return thread_context.wkt_w"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L221_C0", "label": "wkb_r", "type": "function", "loc": [221, 224], "level": 0, "parent": null, "vector": [2, 0, 0.9194, 0.0165, 0, 0.66, 0.9538, 944, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "wkb_r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def wkb_r():\n if not thread_context.wkb_r:\n thread_context.wkb_r = _WKBReader()\n return thread_context.wkb_r"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L222_C4", "label": "if", "type": "if", "loc": [222, 223], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L221_C0", "vector": [4, 1, 0.9194, 0.0083, 1, 0.43, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not thread_context.wkb_r:\n thread_context.wkb_r = _WKBReader()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L223_C8", "label": "thread_context.wkb_r = _WKBReader()", "type": "assigned_variable", "loc": [223, 223], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L222_C4", "vector": [14, 2, 0.9215, 0.0041, 2, 0.31, 0.0, 541, 3, 0, 0, 0, 522, 10, 1], "semantic": {"name": "thread_context.wkb_r", "arg_names": [], "import_names": [], "rhs_call_name": "_WKBReader", "annotation": ""}, "snippet": " thread_context.wkb_r = _WKBReader()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L224_C4", "label": "return", "type": "return", "loc": [224, 224], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L221_C0", "vector": [13, 1, 0.9256, 0.0041, 1, 0.43, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return thread_context.wkb_r"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L226_C0", "label": "wkb_w", "type": "function", "loc": [226, 229], "level": 0, "parent": null, "vector": [2, 0, 0.9401, 0.0165, 0, 0.66, 0.9692, 723, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "wkb_w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def wkb_w():\n if not thread_context.wkb_w:\n thread_context.wkb_w = WKBWriter()\n return thread_context.wkb_w"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L227_C3", "label": "if", "type": "if", "loc": [227, 228], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L226_C0", "vector": [4, 1, 0.9401, 0.0083, 1, 0.74, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not thread_context.wkb_w:\n thread_context.wkb_w = WKBWriter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L228_C7", "label": "thread_context.wkb_w = WKBWriter()", "type": "assigned_variable", "loc": [228, 228], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L227_C3", "vector": [14, 2, 0.9421, 0.0041, 2, 0.33, 0.0, 361, 3, 0, 0, 0, 96, 10, 1], "semantic": {"name": "thread_context.wkb_w", "arg_names": [], "import_names": [], "rhs_call_name": "WKBWriter", "annotation": ""}, "snippet": " thread_context.wkb_w = WKBWriter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L229_C3", "label": "return", "type": "return", "loc": [229, 229], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L226_C0", "vector": [13, 1, 0.9463, 0.0041, 1, 0.74, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return thread_context.wkb_w"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L231_C0", "label": "ewkb_w", "type": "function", "loc": [231, 235], "level": 0, "parent": null, "vector": [2, 0, 0.9628, 0.0207, 0, 0.66, 0.9846, 298, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "ewkb_w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def ewkb_w():\n if not thread_context.ewkb_w:\n thread_context.ewkb_w = WKBWriter()\n thread_context.ewkb_w.srid = True\n return thread_context.ewkb_w"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L232_C4", "label": "if", "type": "if", "loc": [232, 234], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L231_C0", "vector": [4, 1, 0.9628, 0.0124, 1, 0.94, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not thread_context.ewkb_w:\n thread_context.ewkb_w = WKBWriter()\n thread_context.ewkb_w.srid = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L233_C8", "label": "thread_context.ewkb_w = WKBWriter()", "type": "assigned_variable", "loc": [233, 233], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L232_C4", "vector": [14, 2, 0.9628, 0.0041, 2, 0.08, 0.0, 750, 3, 0, 0, 0, 96, 10, 1], "semantic": {"name": "thread_context.ewkb_w", "arg_names": [], "import_names": [], "rhs_call_name": "WKBWriter", "annotation": ""}, "snippet": " thread_context.ewkb_w = WKBWriter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L234_C8", "label": "thread_context.ewkb_w.srid =", "type": "assigned_variable", "loc": [234, 234], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L232_C4", "vector": [14, 2, 0.9669, 0.0041, 2, 0.08, 1.0, 754, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "thread_context.ewkb_w.srid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " thread_context.ewkb_w.srid = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L235_C4", "label": "return", "type": "return", "loc": [235, 235], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L231_C0", "vector": [13, 1, 0.9711, 0.0041, 1, 0.94, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return thread_context.ewkb_w"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L237_C0", "label": "ewkb_w3d", "type": "function", "loc": [237, 242], "level": 0, "parent": null, "vector": [2, 0, 0.9897, 0.0248, 0, 0.66, 1.0, 71, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "ewkb_w3d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def ewkb_w3d():\n if not thread_context.ewkb_w3d:\n thread_context.ewkb_w3d = WKBWriter()\n thread_context.ewkb_w3d.srid = True\n thread_context.ewkb_w3d.outdim = 3\n return thread_context.ewkb_w3d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L238_C4", "label": "if", "type": "if", "loc": [238, 241], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L237_C0", "vector": [4, 1, 0.9897, 0.0165, 1, 0.87, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not thread_context.ewkb_w3d:\n thread_context.ewkb_w3d = WKBWriter()\n thread_context.ewkb_w3d.srid = True\n thread_context.ewkb_w3d.outdim = 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L239_C8", "label": "thread_context.ewkb_w3d = WKBWriter()", "type": "assigned_variable", "loc": [239, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L238_C4", "vector": [14, 2, 0.9876, 0.0041, 2, 0.52, 0.0, 479, 3, 0, 0, 0, 96, 10, 1], "semantic": {"name": "thread_context.ewkb_w3d", "arg_names": [], "import_names": [], "rhs_call_name": "WKBWriter", "annotation": ""}, "snippet": " thread_context.ewkb_w3d = WKBWriter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L240_C8", "label": "thread_context.ewkb_w3d.srid =", "type": "assigned_variable", "loc": [240, 240], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L238_C4", "vector": [14, 2, 0.9917, 0.0041, 2, 0.52, 0.5, 496, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "thread_context.ewkb_w3d.srid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " thread_context.ewkb_w3d.srid = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L241_C8", "label": "thread_context.ewkb_w3d.outdim =", "type": "assigned_variable", "loc": [241, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L238_C4", "vector": [14, 2, 0.9959, 0.0041, 2, 0.52, 1.0, 515, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "thread_context.ewkb_w3d.outdim", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " thread_context.ewkb_w3d.outdim = 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L242_C4", "label": "return", "type": "return", "loc": [242, 242], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L237_C0", "vector": [13, 1, 1.0, 0.0041, 1, 0.87, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return thread_context.ewkb_w3d"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Expr_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L108_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Expr_L108_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L118_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L120_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L120_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Expr_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L131_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L132_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L131_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L133_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L131_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L134_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L135_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L140_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L140_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L140_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L140_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Expr_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L151_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Expr_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L158_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L158_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Expr_L159_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L158_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L165_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L165_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Expr_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L175_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Expr_L180_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L185_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L186_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L189_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L189_C26"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L189_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L190_C14"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Expr_L191_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L149_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L193_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L199_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L200_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L199_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L201_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L199_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L199_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L203_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L199_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L204_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:ClassDef_L199_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L205_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L211_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L212_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L212_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L213_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L211_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L214_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L216_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L217_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L217_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L218_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L216_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L219_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L221_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L222_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L223_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L221_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L224_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L226_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L227_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L227_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L228_C7"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L226_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L229_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L231_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L232_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L232_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L233_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L232_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L234_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L231_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L235_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L237_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L238_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L238_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L239_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L238_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:If_L238_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L241_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L237_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Return_L242_C4"}] |
"""
Error checking functions for GEOS ctypes prototype functions.
"""
import os
from ctypes import c_void_p, string_at, CDLL
from django.contrib.gis.geos.error import GEOSException
from django.contrib.gis.geos.libgeos import GEOS_VERSION
from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc
# Getting the `free` routine used to free the memory allocated for
# string pointers returned by GEOS.
if GEOS_VERSION >= (3, 1, 1):
# In versions 3.1.1 and above, `GEOSFree` was added to the C API
# because `free` isn't always available on all platforms.
free = GEOSFunc('GEOSFree')
free.argtypes = [c_void_p]
free.restype = None
else:
# Getting the `free` routine from the C library of the platform.
if os.name == 'nt':
# On NT, use the MS C library.
libc = CDLL('msvcrt')
else:
# On POSIX platforms C library is obtained by passing None into `CDLL`.
libc = CDLL(None)
free = libc.free
### ctypes error checking routines ###
def last_arg_byref(args):
"Returns the last C argument's value by reference."
return args[-1]._obj.value
def check_dbl(result, func, cargs):
"Checks the status code and returns the double value passed in by reference."
# Checking the status code
if result != 1: return None
# Double passed in by reference, return its value.
return last_arg_byref(cargs)
def check_geom(result, func, cargs):
"Error checking on routines that return Geometries."
if not result:
raise GEOSException('Error encountered checking Geometry returned from GEOS C function "%s".' % func.__name__)
return result
def check_minus_one(result, func, cargs):
"Error checking on routines that should not return -1."
if result == -1:
raise GEOSException('Error encountered in GEOS C function "%s".' % func.__name__)
else:
return result
def check_predicate(result, func, cargs):
"Error checking for unary/binary predicate functions."
val = ord(result) # getting the ordinal from the character
if val == 1: return True
elif val == 0: return False
else:
raise GEOSException('Error encountered on GEOS C predicate function "%s".' % func.__name__)
def check_sized_string(result, func, cargs):
"""
Error checking for routines that return explicitly sized strings.
This frees the memory allocated by GEOS at the result pointer.
"""
if not result:
raise GEOSException('Invalid string pointer returned by GEOS C function "%s"' % func.__name__)
# A c_size_t object is passed in by reference for the second
# argument on these routines, and its needed to determine the
# correct size.
s = string_at(result, last_arg_byref(cargs))
# Freeing the memory allocated within GEOS
free(result)
return s
def check_string(result, func, cargs):
"""
Error checking for routines that return strings.
This frees the memory allocated by GEOS at the result pointer.
"""
if not result: raise GEOSException('Error encountered checking string return value in GEOS C function "%s".' % func.__name__)
# Getting the string value at the pointer address.
s = string_at(result)
# Freeing the memory allocated within GEOS
free(result)
return s
def check_zero(result, func, cargs):
"Error checking on routines that should not return 0."
if result == 0:
raise GEOSException('Error encountered in GEOS C function "%s".' % func.__name__)
else:
return result
| ajibawa-2023/Python-Code-Large/train/row_98725 | 53 | 95 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0211, 0.0316, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n Error checking functions for GEOS ctypes prototype functions.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Import_L4_C0", "label": "os import os", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0421, 0.0105, 0, 0.66, 0.0714, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:ImportFrom_L5_C0", "label": "from ctypes import c_void_p, string_at, CDLL", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0105, 0, 0.66, 0.1429, 182, 0, 3, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_void_p", "string_at", "CDLL"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import c_void_p, string_at, CDLL"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:ImportFrom_L6_C0", "label": "from django.contrib.gis.geos.error import GEOSException", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0632, 0.0105, 0, 0.66, 0.2143, 827, 0, 1, 0, 0, 827, 0, 0], "semantic": {"name": "django.contrib.gis.geos.error", "arg_names": [], "import_names": ["GEOSException"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.error import GEOSException"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:ImportFrom_L7_C0", "label": "from django.contrib.gis.geos.libgeos import GEOS_VERSION", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0737, 0.0105, 0, 0.66, 0.2857, 64, 0, 1, 0, 0, 64, 0, 0], "semantic": {"name": "django.contrib.gis.geos.libgeos", "arg_names": [], "import_names": ["GEOS_VERSION"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.libgeos import GEOS_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:ImportFrom_L8_C0", "label": "from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0842, 0.0105, 0, 0.66, 0.3571, 130, 0, 1, 0, 0, 130, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes.threadsafe", "arg_names": [], "import_names": ["GEOSFunc"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L12_C0", "label": "if", "type": "if", "loc": [12, 26], "level": 0, "parent": null, "vector": [4, 0, 0.2, 0.1579, 0, 0.66, 0.4286, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if GEOS_VERSION >= (3, 1, 1):\n # In versions 3.1.1 and above, `GEOSFree` was added to the C API\n # because `free` isn't always available on all platforms.\n free = GEOSFunc('GEOSFree')\n free.argtypes = [c_void_p]\n free.restype = None\nelse:\n # Getting the `free` routine from the C library of the platform."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Assign_L15_C4", "label": "free = GEOSFunc()", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L12_C0", "vector": [14, 1, 0.1579, 0.0105, 1, 0.39, 0.0, 920, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "free", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSFunc", "annotation": ""}, "snippet": " free = GEOSFunc('GEOSFree')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Assign_L16_C4", "label": "free.argtypes =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L12_C0", "vector": [14, 1, 0.1684, 0.0105, 1, 0.39, 0.25, 750, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "free.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " free.argtypes = [c_void_p]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Assign_L17_C4", "label": "free.restype =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L12_C0", "vector": [14, 1, 0.1789, 0.0105, 1, 0.39, 0.5, 649, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "free.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " free.restype = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L20_C4", "label": "if", "type": "if", "loc": [20, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L12_C0", "vector": [4, 1, 0.2368, 0.0632, 1, 0.39, 0.75, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.name == 'nt':\n # On NT, use the MS C library.\n libc = CDLL('msvcrt')\n else:\n # On POSIX platforms C library is obtained by passing None into `CDLL`.\n libc = CDLL(None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Assign_L22_C8", "label": "libc = CDLL()", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L20_C4", "vector": [14, 2, 0.2316, 0.0105, 2, 0.45, 0.0, 501, 3, 1, 0, 0, 453, 10, 1], "semantic": {"name": "libc", "arg_names": [], "import_names": [], "rhs_call_name": "CDLL", "annotation": ""}, "snippet": " libc = CDLL('msvcrt')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Assign_L25_C8", "label": "libc = CDLL()", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L20_C4", "vector": [14, 2, 0.2632, 0.0105, 2, 0.45, 1.0, 501, 3, 1, 0, 0, 453, 10, 1], "semantic": {"name": "libc", "arg_names": [], "import_names": [], "rhs_call_name": "CDLL", "annotation": ""}, "snippet": " libc = CDLL(None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Assign_L26_C4", "label": "free =", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L12_C0", "vector": [14, 1, 0.2737, 0.0105, 1, 0.39, 1.0, 920, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "free", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " free = libc.free"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L29_C0", "label": "last_arg_byref", "type": "function", "loc": [29, 31], "level": 0, "parent": null, "vector": [2, 0, 0.3158, 0.0316, 0, 0.66, 0.5, 732, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "last_arg_byref", "arg_names": ["args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def last_arg_byref(args):\n \"Returns the last C argument's value by reference.\"\n return args[-1]._obj.value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Expr_L30_C4", "label": "expression", "type": "expression", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L29_C0", "vector": [8, 1, 0.3158, 0.0105, 1, 0.08, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the last C argument's value by reference.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Return_L31_C4", "label": "return", "type": "return", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L29_C0", "vector": [13, 1, 0.3263, 0.0105, 1, 0.08, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return args[-1]._obj.value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L33_C0", "label": "check_dbl", "type": "function", "loc": [33, 38], "level": 0, "parent": null, "vector": [2, 0, 0.3737, 0.0632, 0, 0.66, 0.5714, 797, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "check_dbl", "arg_names": ["result", "func", "cargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_dbl(result, func, cargs):\n \"Checks the status code and returns the double value passed in by reference.\"\n # Checking the status code\n if result != 1: return None\n # Double passed in by reference, return its value.\n return last_arg_byref(cargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Expr_L34_C4", "label": "expression", "type": "expression", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L33_C0", "vector": [8, 1, 0.3579, 0.0105, 1, 0.77, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Checks the status code and returns the double value passed in by reference.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L36_C4", "label": "if", "type": "if", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L33_C0", "vector": [4, 1, 0.3789, 0.0105, 1, 0.77, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if result != 1: return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Return_L36_C20", "label": "return", "type": "return", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L36_C4", "vector": [13, 2, 0.3789, 0.0105, 2, 0.26, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if result != 1: return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Return_L38_C4", "label": "return", "type": "return", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L33_C0", "vector": [13, 1, 0.4, 0.0105, 1, 0.77, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return last_arg_byref(cargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L40_C0", "label": "check_geom", "type": "function", "loc": [40, 44], "level": 0, "parent": null, "vector": [2, 0, 0.4421, 0.0526, 0, 0.66, 0.6429, 261, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "check_geom", "arg_names": ["result", "func", "cargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_geom(result, func, cargs):\n \"Error checking on routines that return Geometries.\"\n if not result:\n raise GEOSException('Error encountered checking Geometry returned from GEOS C function \"%s\".' % func.__name__)\n return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Expr_L41_C4", "label": "expression", "type": "expression", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L40_C0", "vector": [8, 1, 0.4316, 0.0105, 1, 0.11, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Error checking on routines that return Geometries.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L42_C4", "label": "if", "type": "if", "loc": [42, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L40_C0", "vector": [4, 1, 0.4474, 0.0211, 1, 0.11, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not result:\n raise GEOSException('Error encountered checking Geometry returned from GEOS C function \"%s\".' % func.__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Return_L44_C4", "label": "return", "type": "return", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L40_C0", "vector": [13, 1, 0.4632, 0.0105, 1, 0.11, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L46_C0", "label": "check_minus_one", "type": "function", "loc": [46, 51], "level": 0, "parent": null, "vector": [2, 0, 0.5105, 0.0632, 0, 0.66, 0.7143, 973, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "check_minus_one", "arg_names": ["result", "func", "cargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_minus_one(result, func, cargs):\n \"Error checking on routines that should not return -1.\"\n if result == -1:\n raise GEOSException('Error encountered in GEOS C function \"%s\".' % func.__name__)\n else:\n return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Expr_L47_C4", "label": "expression", "type": "expression", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L46_C0", "vector": [8, 1, 0.4947, 0.0105, 1, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Error checking on routines that should not return -1.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L48_C4", "label": "if", "type": "if", "loc": [48, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L46_C0", "vector": [4, 1, 0.5211, 0.0421, 1, 0.15, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if result == -1:\n raise GEOSException('Error encountered in GEOS C function \"%s\".' % func.__name__)\n else:\n return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Return_L51_C8", "label": "return", "type": "return", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L48_C4", "vector": [13, 2, 0.5368, 0.0105, 2, 0.87, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L53_C0", "label": "check_predicate", "type": "function", "loc": [53, 59], "level": 0, "parent": null, "vector": [2, 0, 0.5895, 0.0737, 0, 0.66, 0.7857, 930, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "check_predicate", "arg_names": ["result", "func", "cargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_predicate(result, func, cargs):\n \"Error checking for unary/binary predicate functions.\"\n val = ord(result) # getting the ordinal from the character\n if val == 1: return True\n elif val == 0: return False\n else:\n raise GEOSException('Error encountered on GEOS C predicate function \"%s\".' % func.__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Expr_L54_C4", "label": "expression", "type": "expression", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L53_C0", "vector": [8, 1, 0.5684, 0.0105, 1, 0.99, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Error checking for unary/binary predicate functions.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Assign_L55_C4", "label": "val = ord()", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L53_C0", "vector": [14, 1, 0.5789, 0.0105, 1, 0.99, 0.5, 618, 3, 1, 0, 0, 171, 10, 1], "semantic": {"name": "val", "arg_names": [], "import_names": [], "rhs_call_name": "ord", "annotation": ""}, "snippet": " val = ord(result) # getting the ordinal from the character"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L56_C4", "label": "if", "type": "if", "loc": [56, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L53_C0", "vector": [4, 1, 0.6053, 0.0421, 1, 0.99, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if val == 1: return True\n elif val == 0: return False\n else:\n raise GEOSException('Error encountered on GEOS C predicate function \"%s\".' % func.__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Return_L56_C17", "label": "return", "type": "return", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L56_C4", "vector": [13, 2, 0.5895, 0.0105, 2, 0.08, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if val == 1: return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L57_C4", "label": "if", "type": "if", "loc": [57, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L56_C4", "vector": [4, 2, 0.6105, 0.0316, 2, 0.08, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif val == 0: return False\n else:\n raise GEOSException('Error encountered on GEOS C predicate function \"%s\".' % func.__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Return_L57_C19", "label": "return", "type": "return", "loc": [57, 57], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L57_C4", "vector": [13, 3, 0.6, 0.0105, 3, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif val == 0: return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L61_C0", "label": "check_sized_string", "type": "function", "loc": [61, 75], "level": 0, "parent": null, "vector": [2, 0, 0.7158, 0.1579, 0, 0.66, 0.8571, 539, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "check_sized_string", "arg_names": ["result", "func", "cargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_sized_string(result, func, cargs):\n \"\"\"\n Error checking for routines that return explicitly sized strings.\n\n This frees the memory allocated by GEOS at the result pointer.\n \"\"\"\n if not result:\n raise GEOSException('Invalid string pointer returned by GEOS C function \"%s\"' % func.__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Expr_L62_C4", "label": "expression", "type": "expression", "loc": [62, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L61_C0", "vector": [8, 1, 0.6737, 0.0526, 1, 0.56, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Error checking for routines that return explicitly sized strings.\n\n This frees the memory allocated by GEOS at the result pointer.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L67_C4", "label": "if", "type": "if", "loc": [67, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L61_C0", "vector": [4, 1, 0.7105, 0.0211, 1, 0.56, 0.25, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not result:\n raise GEOSException('Invalid string pointer returned by GEOS C function \"%s\"' % func.__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Assign_L72_C4", "label": "s = string_at()", "type": "assigned_variable", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L61_C0", "vector": [14, 1, 0.7579, 0.0105, 1, 0.56, 0.5, 553, 3, 2, 0, 0, 714, 10, 2], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "string_at", "annotation": ""}, "snippet": " s = string_at(result, last_arg_byref(cargs))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Expr_L74_C4", "label": "free()", "type": "expression", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L61_C0", "vector": [8, 1, 0.7789, 0.0105, 1, 0.56, 0.75, 920, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "free", "arg_names": [], "import_names": [], "rhs_call_name": "free", "annotation": ""}, "snippet": " free(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Return_L75_C4", "label": "return", "type": "return", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L61_C0", "vector": [13, 1, 0.7895, 0.0105, 1, 0.56, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return s"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L77_C0", "label": "check_string", "type": "function", "loc": [77, 88], "level": 0, "parent": null, "vector": [2, 0, 0.8684, 0.1263, 0, 0.66, 0.9286, 148, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "check_string", "arg_names": ["result", "func", "cargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_string(result, func, cargs):\n \"\"\"\n Error checking for routines that return strings.\n\n This frees the memory allocated by GEOS at the result pointer.\n \"\"\"\n if not result: raise GEOSException('Error encountered checking string return value in GEOS C function \"%s\".' % func.__name__)\n # Getting the string value at the pointer address."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Expr_L78_C4", "label": "expression", "type": "expression", "loc": [78, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L77_C0", "vector": [8, 1, 0.8421, 0.0526, 1, 0.55, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Error checking for routines that return strings.\n\n This frees the memory allocated by GEOS at the result pointer.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L83_C4", "label": "if", "type": "if", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L77_C0", "vector": [4, 1, 0.8737, 0.0105, 1, 0.55, 0.25, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not result: raise GEOSException('Error encountered checking string return value in GEOS C function \"%s\".' % func.__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Assign_L85_C4", "label": "s = string_at()", "type": "assigned_variable", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L77_C0", "vector": [14, 1, 0.8947, 0.0105, 1, 0.55, 0.5, 553, 3, 1, 0, 0, 714, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "string_at", "annotation": ""}, "snippet": " s = string_at(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Expr_L87_C4", "label": "free()", "type": "expression", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L77_C0", "vector": [8, 1, 0.9158, 0.0105, 1, 0.55, 0.75, 920, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "free", "arg_names": [], "import_names": [], "rhs_call_name": "free", "annotation": ""}, "snippet": " free(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Return_L88_C4", "label": "return", "type": "return", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L77_C0", "vector": [13, 1, 0.9263, 0.0105, 1, 0.55, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return s"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L90_C0", "label": "check_zero", "type": "function", "loc": [90, 95], "level": 0, "parent": null, "vector": [2, 0, 0.9737, 0.0632, 0, 0.66, 1.0, 836, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "check_zero", "arg_names": ["result", "func", "cargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_zero(result, func, cargs):\n \"Error checking on routines that should not return 0.\"\n if result == 0:\n raise GEOSException('Error encountered in GEOS C function \"%s\".' % func.__name__)\n else:\n return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Expr_L91_C4", "label": "expression", "type": "expression", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L90_C0", "vector": [8, 1, 0.9579, 0.0105, 1, 0.04, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Error checking on routines that should not return 0.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L92_C4", "label": "if", "type": "if", "loc": [92, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L90_C0", "vector": [4, 1, 0.9842, 0.0421, 1, 0.04, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if result == 0:\n raise GEOSException('Error encountered in GEOS C function \"%s\".' % func.__name__)\n else:\n return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98725:Return_L95_C8", "label": "return", "type": "return", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L92_C4", "vector": [13, 2, 1.0, 0.0105, 2, 0.35, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return result"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Assign_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Expr_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Return_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Return_L36_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Return_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Expr_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Return_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Return_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Return_L56_C17"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Return_L57_C19"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Expr_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Assign_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Return_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Expr_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Assign_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Expr_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Return_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Expr_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:FunctionDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Return_L95_C8"}] |
"""
This module houses the GEOS ctypes prototype functions for the
topological operations on geometries.
"""
__all__ = ['geos_boundary', 'geos_buffer', 'geos_centroid', 'geos_convexhull',
'geos_difference', 'geos_envelope', 'geos_intersection',
'geos_linemerge', 'geos_pointonsurface', 'geos_preservesimplify',
'geos_simplify', 'geos_symdifference', 'geos_union', 'geos_relate']
from ctypes import c_char_p, c_double, c_int
from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOS_PREPARE
from django.contrib.gis.geos.prototypes.errcheck import check_geom, check_string
from django.contrib.gis.geos.prototypes.geom import geos_char_p
from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc
def topology(func, *args):
"For GEOS unary topology functions."
argtypes = [GEOM_PTR]
if args: argtypes += args
func.argtypes = argtypes
func.restype = GEOM_PTR
func.errcheck = check_geom
return func
### Topology Routines ###
geos_boundary = topology(GEOSFunc('GEOSBoundary'))
geos_buffer = topology(GEOSFunc('GEOSBuffer'), c_double, c_int)
geos_centroid = topology(GEOSFunc('GEOSGetCentroid'))
geos_convexhull = topology(GEOSFunc('GEOSConvexHull'))
geos_difference = topology(GEOSFunc('GEOSDifference'), GEOM_PTR)
geos_envelope = topology(GEOSFunc('GEOSEnvelope'))
geos_intersection = topology(GEOSFunc('GEOSIntersection'), GEOM_PTR)
geos_linemerge = topology(GEOSFunc('GEOSLineMerge'))
geos_pointonsurface = topology(GEOSFunc('GEOSPointOnSurface'))
geos_preservesimplify = topology(GEOSFunc('GEOSTopologyPreserveSimplify'), c_double)
geos_simplify = topology(GEOSFunc('GEOSSimplify'), c_double)
geos_symdifference = topology(GEOSFunc('GEOSSymDifference'), GEOM_PTR)
geos_union = topology(GEOSFunc('GEOSUnion'), GEOM_PTR)
# GEOSRelate returns a string, not a geometry.
geos_relate = GEOSFunc('GEOSRelate')
geos_relate.argtypes = [GEOM_PTR, GEOM_PTR]
geos_relate.restype = geos_char_p
geos_relate.errcheck = check_string
# Routines only in GEOS 3.1+
if GEOS_PREPARE:
geos_cascaded_union = GEOSFunc('GEOSUnionCascaded')
geos_cascaded_union.argtypes = [GEOM_PTR]
geos_cascaded_union.restype = GEOM_PTR
__all__.append('geos_cascaded_union')
| ajibawa-2023/Python-Code-Large/train/row_98726 | 37 | 51 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.049, 0.0784, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n This module houses the GEOS ctypes prototype functions for the\n topological operations on geometries.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L5_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [5, 8], "level": 0, "parent": null, "vector": [14, 0, 0.1275, 0.0784, 0, 0.66, 0.04, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = ['geos_boundary', 'geos_buffer', 'geos_centroid', 'geos_convexhull',\n 'geos_difference', 'geos_envelope', 'geos_intersection', \n 'geos_linemerge', 'geos_pointonsurface', 'geos_preservesimplify',\n 'geos_simplify', 'geos_symdifference', 'geos_union', 'geos_relate']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:ImportFrom_L10_C0", "label": "from ctypes import c_char_p, c_double, c_int", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1961, 0.0196, 0, 0.66, 0.08, 182, 0, 3, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_char_p", "c_double", "c_int"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import c_char_p, c_double, c_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:ImportFrom_L11_C0", "label": "from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOS_PREPARE", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.2157, 0.0196, 0, 0.66, 0.12, 64, 0, 2, 0, 0, 64, 0, 0], "semantic": {"name": "django.contrib.gis.geos.libgeos", "arg_names": [], "import_names": ["GEOM_PTR", "GEOS_PREPARE"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOS_PREPARE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:ImportFrom_L12_C0", "label": "from django.contrib.gis.geos.prototypes.errcheck import check_geom, check_string", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.2353, 0.0196, 0, 0.66, 0.16, 104, 0, 2, 0, 0, 104, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes.errcheck", "arg_names": [], "import_names": ["check_geom", "check_string"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes.errcheck import check_geom, check_string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:ImportFrom_L13_C0", "label": "from django.contrib.gis.geos.prototypes.geom import geos_char_p", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.2549, 0.0196, 0, 0.66, 0.2, 589, 0, 1, 0, 0, 589, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes.geom", "arg_names": [], "import_names": ["geos_char_p"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes.geom import geos_char_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:ImportFrom_L14_C0", "label": "from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.2745, 0.0196, 0, 0.66, 0.24, 130, 0, 1, 0, 0, 130, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes.threadsafe", "arg_names": [], "import_names": ["GEOSFunc"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:FunctionDef_L16_C0", "label": "topology", "type": "function", "loc": [16, 23], "level": 0, "parent": null, "vector": [2, 0, 0.3824, 0.1569, 0, 0.66, 0.28, 495, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "topology", "arg_names": ["func", "args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def topology(func, *args):\n \"For GEOS unary topology functions.\"\n argtypes = [GEOM_PTR]\n if args: argtypes += args\n func.argtypes = argtypes\n func.restype = GEOM_PTR\n func.errcheck = check_geom\n return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Expr_L17_C4", "label": "expression", "type": "expression", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98726:FunctionDef_L16_C0", "vector": [8, 1, 0.3333, 0.0196, 1, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"For GEOS unary topology functions.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L18_C4", "label": "argtypes =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98726:FunctionDef_L16_C0", "vector": [14, 1, 0.3529, 0.0196, 1, 0.43, 0.1667, 105, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " argtypes = [GEOM_PTR]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:If_L19_C4", "label": "if", "type": "if", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98726:FunctionDef_L16_C0", "vector": [4, 1, 0.3725, 0.0196, 1, 0.43, 0.3333, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if args: argtypes += args"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L20_C4", "label": "func.argtypes =", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98726:FunctionDef_L16_C0", "vector": [14, 1, 0.3922, 0.0196, 1, 0.43, 0.5, 441, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.argtypes = argtypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L21_C4", "label": "func.restype =", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98726:FunctionDef_L16_C0", "vector": [14, 1, 0.4118, 0.0196, 1, 0.43, 0.6667, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = GEOM_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L22_C4", "label": "func.errcheck =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98726:FunctionDef_L16_C0", "vector": [14, 1, 0.4314, 0.0196, 1, 0.43, 0.8333, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.errcheck = check_geom"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Return_L23_C4", "label": "return", "type": "return", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98726:FunctionDef_L16_C0", "vector": [13, 1, 0.451, 0.0196, 1, 0.43, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L26_C0", "label": "geos_boundary = topology()", "type": "assigned_variable", "loc": [26, 26], "level": 0, "parent": null, "vector": [14, 0, 0.5098, 0.0196, 0, 0.66, 0.32, 708, 3, 1, 0, 0, 495, 10, 2], "semantic": {"name": "geos_boundary", "arg_names": [], "import_names": [], "rhs_call_name": "topology", "annotation": ""}, "snippet": "geos_boundary = topology(GEOSFunc('GEOSBoundary'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L27_C0", "label": "geos_buffer = topology()", "type": "assigned_variable", "loc": [27, 27], "level": 0, "parent": null, "vector": [14, 0, 0.5294, 0.0196, 0, 0.66, 0.36, 71, 3, 3, 0, 0, 495, 10, 2], "semantic": {"name": "geos_buffer", "arg_names": [], "import_names": [], "rhs_call_name": "topology", "annotation": ""}, "snippet": "geos_buffer = topology(GEOSFunc('GEOSBuffer'), c_double, c_int)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L28_C0", "label": "geos_centroid = topology()", "type": "assigned_variable", "loc": [28, 28], "level": 0, "parent": null, "vector": [14, 0, 0.549, 0.0196, 0, 0.66, 0.4, 729, 3, 1, 0, 0, 495, 10, 2], "semantic": {"name": "geos_centroid", "arg_names": [], "import_names": [], "rhs_call_name": "topology", "annotation": ""}, "snippet": "geos_centroid = topology(GEOSFunc('GEOSGetCentroid'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L29_C0", "label": "geos_convexhull = topology()", "type": "assigned_variable", "loc": [29, 29], "level": 0, "parent": null, "vector": [14, 0, 0.5686, 0.0196, 0, 0.66, 0.44, 687, 3, 1, 0, 0, 495, 10, 2], "semantic": {"name": "geos_convexhull", "arg_names": [], "import_names": [], "rhs_call_name": "topology", "annotation": ""}, "snippet": "geos_convexhull = topology(GEOSFunc('GEOSConvexHull'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L30_C0", "label": "geos_difference = topology()", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.5882, 0.0196, 0, 0.66, 0.48, 617, 3, 2, 0, 0, 495, 10, 2], "semantic": {"name": "geos_difference", "arg_names": [], "import_names": [], "rhs_call_name": "topology", "annotation": ""}, "snippet": "geos_difference = topology(GEOSFunc('GEOSDifference'), GEOM_PTR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L31_C0", "label": "geos_envelope = topology()", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.6078, 0.0196, 0, 0.66, 0.52, 419, 3, 1, 0, 0, 495, 10, 2], "semantic": {"name": "geos_envelope", "arg_names": [], "import_names": [], "rhs_call_name": "topology", "annotation": ""}, "snippet": "geos_envelope = topology(GEOSFunc('GEOSEnvelope'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L32_C0", "label": "geos_intersection = topology()", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.6275, 0.0196, 0, 0.66, 0.56, 943, 3, 2, 0, 0, 495, 10, 2], "semantic": {"name": "geos_intersection", "arg_names": [], "import_names": [], "rhs_call_name": "topology", "annotation": ""}, "snippet": "geos_intersection = topology(GEOSFunc('GEOSIntersection'), GEOM_PTR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L33_C0", "label": "geos_linemerge = topology()", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 0.6471, 0.0196, 0, 0.66, 0.6, 115, 3, 1, 0, 0, 495, 10, 2], "semantic": {"name": "geos_linemerge", "arg_names": [], "import_names": [], "rhs_call_name": "topology", "annotation": ""}, "snippet": "geos_linemerge = topology(GEOSFunc('GEOSLineMerge'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L34_C0", "label": "geos_pointonsurface = topology()", "type": "assigned_variable", "loc": [34, 34], "level": 0, "parent": null, "vector": [14, 0, 0.6667, 0.0196, 0, 0.66, 0.64, 666, 3, 1, 0, 0, 495, 10, 2], "semantic": {"name": "geos_pointonsurface", "arg_names": [], "import_names": [], "rhs_call_name": "topology", "annotation": ""}, "snippet": "geos_pointonsurface = topology(GEOSFunc('GEOSPointOnSurface'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L35_C0", "label": "geos_preservesimplify = topology()", "type": "assigned_variable", "loc": [35, 35], "level": 0, "parent": null, "vector": [14, 0, 0.6863, 0.0196, 0, 0.66, 0.68, 915, 3, 2, 0, 0, 495, 10, 2], "semantic": {"name": "geos_preservesimplify", "arg_names": [], "import_names": [], "rhs_call_name": "topology", "annotation": ""}, "snippet": "geos_preservesimplify = topology(GEOSFunc('GEOSTopologyPreserveSimplify'), c_double)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L36_C0", "label": "geos_simplify = topology()", "type": "assigned_variable", "loc": [36, 36], "level": 0, "parent": null, "vector": [14, 0, 0.7059, 0.0196, 0, 0.66, 0.72, 312, 3, 2, 0, 0, 495, 10, 2], "semantic": {"name": "geos_simplify", "arg_names": [], "import_names": [], "rhs_call_name": "topology", "annotation": ""}, "snippet": "geos_simplify = topology(GEOSFunc('GEOSSimplify'), c_double)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L37_C0", "label": "geos_symdifference = topology()", "type": "assigned_variable", "loc": [37, 37], "level": 0, "parent": null, "vector": [14, 0, 0.7255, 0.0196, 0, 0.66, 0.76, 92, 3, 2, 0, 0, 495, 10, 2], "semantic": {"name": "geos_symdifference", "arg_names": [], "import_names": [], "rhs_call_name": "topology", "annotation": ""}, "snippet": "geos_symdifference = topology(GEOSFunc('GEOSSymDifference'), GEOM_PTR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L38_C0", "label": "geos_union = topology()", "type": "assigned_variable", "loc": [38, 38], "level": 0, "parent": null, "vector": [14, 0, 0.7451, 0.0196, 0, 0.66, 0.8, 599, 3, 2, 0, 0, 495, 10, 2], "semantic": {"name": "geos_union", "arg_names": [], "import_names": [], "rhs_call_name": "topology", "annotation": ""}, "snippet": "geos_union = topology(GEOSFunc('GEOSUnion'), GEOM_PTR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L41_C0", "label": "geos_relate = GEOSFunc()", "type": "assigned_variable", "loc": [41, 41], "level": 0, "parent": null, "vector": [14, 0, 0.8039, 0.0196, 0, 0.66, 0.84, 636, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "geos_relate", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSFunc", "annotation": ""}, "snippet": "geos_relate = GEOSFunc('GEOSRelate')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L42_C0", "label": "geos_relate.argtypes =", "type": "assigned_variable", "loc": [42, 42], "level": 0, "parent": null, "vector": [14, 0, 0.8235, 0.0196, 0, 0.66, 0.88, 518, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "geos_relate.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "geos_relate.argtypes = [GEOM_PTR, GEOM_PTR]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L43_C0", "label": "geos_relate.restype =", "type": "assigned_variable", "loc": [43, 43], "level": 0, "parent": null, "vector": [14, 0, 0.8431, 0.0196, 0, 0.66, 0.92, 806, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geos_relate.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "geos_relate.restype = geos_char_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L44_C0", "label": "geos_relate.errcheck =", "type": "assigned_variable", "loc": [44, 44], "level": 0, "parent": null, "vector": [14, 0, 0.8627, 0.0196, 0, 0.66, 0.96, 56, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geos_relate.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "geos_relate.errcheck = check_string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:If_L47_C0", "label": "if", "type": "if", "loc": [47, 51], "level": 0, "parent": null, "vector": [4, 0, 0.9608, 0.098, 0, 0.66, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if GEOS_PREPARE:\n geos_cascaded_union = GEOSFunc('GEOSUnionCascaded')\n geos_cascaded_union.argtypes = [GEOM_PTR]\n geos_cascaded_union.restype = GEOM_PTR\n __all__.append('geos_cascaded_union')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L48_C4", "label": "geos_cascaded_union = GEOSFunc()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98726:If_L47_C0", "vector": [14, 1, 0.9412, 0.0196, 1, 0.08, 0.0, 712, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "geos_cascaded_union", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSFunc", "annotation": ""}, "snippet": " geos_cascaded_union = GEOSFunc('GEOSUnionCascaded')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L49_C4", "label": "geos_cascaded_union.argtypes =", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98726:If_L47_C0", "vector": [14, 1, 0.9608, 0.0196, 1, 0.08, 0.3333, 112, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "geos_cascaded_union.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geos_cascaded_union.argtypes = [GEOM_PTR]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L50_C4", "label": "geos_cascaded_union.restype =", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98726:If_L47_C0", "vector": [14, 1, 0.9804, 0.0196, 1, 0.08, 0.6667, 724, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geos_cascaded_union.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geos_cascaded_union.restype = GEOM_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98726:Expr_L51_C4", "label": "append()", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98726:If_L47_C0", "vector": [8, 1, 1.0, 0.0196, 1, 0.08, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " __all__.append('geos_cascaded_union')"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98726:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98726:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98726:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98726:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98726:If_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98726:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98726:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98726:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98726:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98726:Return_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98726:If_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98726:If_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98726:If_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98726:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98726:If_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98726:Expr_L51_C4"}] |
import threading
from django.contrib.gis.geos.libgeos import lgeos, notice_h, error_h, CONTEXT_PTR
class GEOSContextHandle(object):
"""
Python object representing a GEOS context handle.
"""
def __init__(self):
# Initializing the context handler for this thread with
# the notice and error handler.
self.ptr = lgeos.initGEOS_r(notice_h, error_h)
def __del__(self):
if self.ptr: lgeos.finishGEOS_r(self.ptr)
# Defining a thread-local object and creating an instance
# to hold a reference to GEOSContextHandle for this thread.
class GEOSContext(threading.local):
handle = None
thread_context = GEOSContext()
def call_geos_threaded(cfunc, args):
"""
This module-level routine calls the specified GEOS C thread-safe
function with the context for this current thread.
"""
# If a context handle does not exist for this thread, initialize one.
if not thread_context.handle:
thread_context.handle = GEOSContextHandle()
# Call the threaded GEOS routine with pointer of the context handle
# as the first argument.
return cfunc(thread_context.handle.ptr, *args)
class GEOSFunc(object):
"""
Class that serves as a wrapper for GEOS C Functions, and will
use thread-safe function variants when available.
"""
def __init__(self, func_name):
try:
# GEOS thread-safe function signatures end with '_r', and
# take an additional context handle parameter.
self.cfunc = getattr(lgeos, func_name + '_r')
self.threaded = True
except AttributeError:
# Otherwise, use usual function.
self.cfunc = getattr(lgeos, func_name)
self.threaded = False
def __call__(self, *args):
if self.threaded:
return call_geos_threaded(self.cfunc, args)
else:
return self.cfunc(*args)
def __str__(self):
return self.cfunc.__name__
# argtypes property
def _get_argtypes(self):
return self.cfunc.argtypes
def _set_argtypes(self, argtypes):
if self.threaded:
new_argtypes = [CONTEXT_PTR]
new_argtypes.extend(argtypes)
self.cfunc.argtypes = new_argtypes
else:
self.cfunc.argtypes = argtypes
argtypes = property(_get_argtypes, _set_argtypes)
# restype property
def _get_restype(self):
return self.cfunc.restype
def _set_restype(self, restype):
self.cfunc.restype = restype
restype = property(_get_restype, _set_restype)
# errcheck property
def _get_errcheck(self):
return self.cfunc.errcheck
def _set_errcheck(self, errcheck):
self.cfunc.errcheck = errcheck
errcheck = property(_get_errcheck, _set_errcheck)
| ajibawa-2023/Python-Code-Large/train/row_98727 | 50 | 90 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Import_L1_C0", "label": "threading import threading", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0111, 0.0111, 0, 0.66, 0.0, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["threading"], "rhs_call_name": "", "annotation": ""}, "snippet": "import threading"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:ImportFrom_L2_C0", "label": "from django.contrib.gis.geos.libgeos import lgeos, notice_h, error_h\u2026", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0222, 0.0111, 0, 0.66, 0.1667, 64, 0, 4, 0, 0, 64, 0, 0], "semantic": {"name": "django.contrib.gis.geos.libgeos", "arg_names": [], "import_names": ["lgeos", "notice_h", "error_h", "CONTEXT_PTR"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.libgeos import lgeos, notice_h, error_h, CONTEXT_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L4_C0", "label": "GEOSContextHandle", "type": "class", "loc": [4, 14], "level": 0, "parent": null, "vector": [3, 0, 0.1, 0.1222, 0, 0.66, 0.3333, 604, 0, 2, 0, 0, 186, 0, 2], "semantic": {"name": "GEOSContextHandle", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GEOSContextHandle(object):\n \"\"\"\n Python object representing a GEOS context handle.\n \"\"\"\n def __init__(self):\n # Initializing the context handler for this thread with\n # the notice and error handler.\n self.ptr = lgeos.initGEOS_r(notice_h, error_h)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Expr_L5_C4", "label": "expression", "type": "expression", "loc": [5, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L4_C0", "vector": [8, 1, 0.0667, 0.0333, 1, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Python object representing a GEOS context handle.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L8_C4", "label": "__init__", "type": "function", "loc": [8, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L4_C0", "vector": [2, 1, 0.1056, 0.0444, 1, 0.91, 0.5, 555, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n # Initializing the context handler for this thread with\n # the notice and error handler.\n self.ptr = lgeos.initGEOS_r(notice_h, error_h)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L11_C8", "label": "self.ptr = initGEOS_r()", "type": "assigned_variable", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L8_C4", "vector": [14, 2, 0.1222, 0.0111, 2, 0.82, 0.0, 386, 3, 2, 0, 0, 865, 10, 1], "semantic": {"name": "self.ptr", "arg_names": [], "import_names": [], "rhs_call_name": "initGEOS_r", "annotation": ""}, "snippet": " self.ptr = lgeos.initGEOS_r(notice_h, error_h)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L13_C4", "label": "__del__", "type": "function", "loc": [13, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L4_C0", "vector": [2, 1, 0.15, 0.0222, 1, 0.91, 1.0, 258, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__del__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __del__(self):\n if self.ptr: lgeos.finishGEOS_r(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:If_L14_C8", "label": "if", "type": "if", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L13_C4", "vector": [4, 2, 0.1556, 0.0111, 2, 0.64, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.ptr: lgeos.finishGEOS_r(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Expr_L14_C21", "label": "finishGEOS_r()", "type": "expression", "loc": [14, 14], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:If_L14_C8", "vector": [8, 3, 0.1556, 0.0111, 3, 0.77, 0.0, 703, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "finishGEOS_r", "arg_names": [], "import_names": [], "rhs_call_name": "finishGEOS_r", "annotation": ""}, "snippet": " if self.ptr: lgeos.finishGEOS_r(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L18_C0", "label": "GEOSContext", "type": "class", "loc": [18, 19], "level": 0, "parent": null, "vector": [3, 0, 0.2056, 0.0222, 0, 0.66, 0.5, 523, 0, 0, 0, 0, 771, 0, 0], "semantic": {"name": "GEOSContext", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GEOSContext(threading.local):\n handle = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L19_C4", "label": "handle =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L18_C0", "vector": [14, 1, 0.2111, 0.0111, 1, 0.02, 0.0, 346, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "handle", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " handle = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L21_C0", "label": "thread_context = GEOSContext()", "type": "assigned_variable", "loc": [21, 21], "level": 0, "parent": null, "vector": [14, 0, 0.2333, 0.0111, 0, 0.66, 0.6667, 60, 3, 0, 0, 0, 523, 10, 1], "semantic": {"name": "thread_context", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSContext", "annotation": ""}, "snippet": "thread_context = GEOSContext()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L23_C0", "label": "call_geos_threaded", "type": "function", "loc": [23, 33], "level": 0, "parent": null, "vector": [2, 0, 0.3111, 0.1222, 0, 0.66, 0.8333, 790, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "call_geos_threaded", "arg_names": ["cfunc", "args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def call_geos_threaded(cfunc, args):\n \"\"\"\n This module-level routine calls the specified GEOS C thread-safe\n function with the context for this current thread.\n \"\"\"\n # If a context handle does not exist for this thread, initialize one.\n if not thread_context.handle:\n thread_context.handle = GEOSContextHandle()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Expr_L24_C4", "label": "expression", "type": "expression", "loc": [24, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L23_C0", "vector": [8, 1, 0.2833, 0.0444, 1, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n This module-level routine calls the specified GEOS C thread-safe\n function with the context for this current thread.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:If_L29_C4", "label": "if", "type": "if", "loc": [29, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L23_C0", "vector": [4, 1, 0.3278, 0.0222, 1, 0.67, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not thread_context.handle:\n thread_context.handle = GEOSContextHandle()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L30_C8", "label": "thread_context.handle = GEOSContextHandle()", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:If_L29_C4", "vector": [14, 2, 0.3333, 0.0111, 2, 0.45, 0.0, 702, 3, 0, 0, 0, 604, 10, 1], "semantic": {"name": "thread_context.handle", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSContextHandle", "annotation": ""}, "snippet": " thread_context.handle = GEOSContextHandle()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Return_L33_C4", "label": "return", "type": "return", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L23_C0", "vector": [13, 1, 0.3667, 0.0111, 1, 0.67, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return cfunc(thread_context.handle.ptr, *args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "label": "GEOSFunc", "type": "class", "loc": [35, 90], "level": 0, "parent": null, "vector": [3, 0, 0.6944, 0.6222, 0, 0.66, 1.0, 140, 0, 9, 0, 0, 186, 0, 8], "semantic": {"name": "GEOSFunc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GEOSFunc(object):\n \"\"\"\n Class that serves as a wrapper for GEOS C Functions, and will\n use thread-safe function variants when available.\n \"\"\"\n def __init__(self, func_name):\n try:\n # GEOS thread-safe function signatures end with '_r', and"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Expr_L36_C4", "label": "expression", "type": "expression", "loc": [36, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "vector": [8, 1, 0.4167, 0.0444, 1, 0.61, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Class that serves as a wrapper for GEOS C Functions, and will\n use thread-safe function variants when available.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L40_C4", "label": "__init__", "type": "function", "loc": [40, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "vector": [2, 1, 0.4944, 0.1111, 1, 0.61, 0.0833, 555, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "func_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, func_name):\n try:\n # GEOS thread-safe function signatures end with '_r', and\n # take an additional context handle parameter.\n self.cfunc = getattr(lgeos, func_name + '_r')\n self.threaded = True\n except AttributeError:\n # Otherwise, use usual function."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Try_L41_C8", "label": "try", "type": "try", "loc": [41, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L40_C4", "vector": [7, 2, 0.5, 0.1, 2, 0.52, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # GEOS thread-safe function signatures end with '_r', and\n # take an additional context handle parameter.\n self.cfunc = getattr(lgeos, func_name + '_r')\n self.threaded = True\n except AttributeError:\n # Otherwise, use usual function.\n self.cfunc = getattr(lgeos, func_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L44_C12", "label": "self.cfunc = getattr()", "type": "assigned_variable", "loc": [44, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:Try_L41_C8", "vector": [14, 3, 0.4889, 0.0111, 3, 0.44, 0.0, 589, 3, 2, 0, 0, 121, 10, 1], "semantic": {"name": "self.cfunc", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " self.cfunc = getattr(lgeos, func_name + '_r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L45_C12", "label": "self.threaded =", "type": "assigned_variable", "loc": [45, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:Try_L41_C8", "vector": [14, 3, 0.5, 0.0111, 3, 0.44, 1.0, 333, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.threaded", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.threaded = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L48_C12", "label": "self.cfunc = getattr()", "type": "assigned_variable", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:Try_L41_C8", "vector": [14, 3, 0.5333, 0.0111, 3, 0.44, 0.0, 589, 3, 2, 0, 0, 121, 10, 1], "semantic": {"name": "self.cfunc", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " self.cfunc = getattr(lgeos, func_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L49_C12", "label": "self.threaded =", "type": "assigned_variable", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:Try_L41_C8", "vector": [14, 3, 0.5444, 0.0111, 3, 0.44, 1.0, 333, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.threaded", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.threaded = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L51_C4", "label": "__call__", "type": "function", "loc": [51, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "vector": [2, 1, 0.5889, 0.0556, 1, 0.61, 0.1667, 319, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__call__", "arg_names": ["self", "args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __call__(self, *args):\n if self.threaded:\n return call_geos_threaded(self.cfunc, args)\n else:\n return self.cfunc(*args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:If_L52_C8", "label": "if", "type": "if", "loc": [52, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L51_C4", "vector": [4, 2, 0.5944, 0.0444, 2, 0.65, 0.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.threaded:\n return call_geos_threaded(self.cfunc, args)\n else:\n return self.cfunc(*args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Return_L53_C12", "label": "return", "type": "return", "loc": [53, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:If_L52_C8", "vector": [13, 3, 0.5889, 0.0111, 3, 0.64, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return call_geos_threaded(self.cfunc, args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Return_L55_C12", "label": "return", "type": "return", "loc": [55, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:If_L52_C8", "vector": [13, 3, 0.6111, 0.0111, 3, 0.64, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.cfunc(*args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L57_C4", "label": "__str__", "type": "function", "loc": [57, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "vector": [2, 1, 0.6389, 0.0222, 1, 0.61, 0.25, 527, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n return self.cfunc.__name__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Return_L58_C8", "label": "return", "type": "return", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L57_C4", "vector": [13, 2, 0.6444, 0.0111, 2, 0.3, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.cfunc.__name__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L61_C4", "label": "_get_argtypes", "type": "function", "loc": [61, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "vector": [2, 1, 0.6833, 0.0222, 1, 0.61, 0.3333, 265, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "_get_argtypes", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_argtypes(self):\n return self.cfunc.argtypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Return_L62_C8", "label": "return", "type": "return", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L61_C4", "vector": [13, 2, 0.6889, 0.0111, 2, 0.39, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.cfunc.argtypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L64_C4", "label": "_set_argtypes", "type": "function", "loc": [64, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "vector": [2, 1, 0.7444, 0.0778, 1, 0.61, 0.4167, 470, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_set_argtypes", "arg_names": ["self", "argtypes"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_argtypes(self, argtypes):\n if self.threaded:\n new_argtypes = [CONTEXT_PTR]\n new_argtypes.extend(argtypes)\n self.cfunc.argtypes = new_argtypes\n else:\n self.cfunc.argtypes = argtypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:If_L65_C8", "label": "if", "type": "if", "loc": [65, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L64_C4", "vector": [4, 2, 0.75, 0.0667, 2, 0.74, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.threaded:\n new_argtypes = [CONTEXT_PTR]\n new_argtypes.extend(argtypes)\n self.cfunc.argtypes = new_argtypes\n else:\n self.cfunc.argtypes = argtypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L66_C12", "label": "new_argtypes =", "type": "assigned_variable", "loc": [66, 66], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:If_L65_C8", "vector": [14, 3, 0.7333, 0.0111, 3, 0.16, 0.0, 441, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "new_argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_argtypes = [CONTEXT_PTR]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Expr_L67_C12", "label": "extend()", "type": "expression", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:If_L65_C8", "vector": [8, 3, 0.7444, 0.0111, 3, 0.16, 0.3333, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " new_argtypes.extend(argtypes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L68_C12", "label": "self.cfunc.argtypes =", "type": "assigned_variable", "loc": [68, 68], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:If_L65_C8", "vector": [14, 3, 0.7556, 0.0111, 3, 0.16, 0.6667, 427, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.cfunc.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cfunc.argtypes = new_argtypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L70_C12", "label": "self.cfunc.argtypes =", "type": "assigned_variable", "loc": [70, 70], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:If_L65_C8", "vector": [14, 3, 0.7778, 0.0111, 3, 0.16, 1.0, 427, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.cfunc.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cfunc.argtypes = argtypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L72_C4", "label": "argtypes = property()", "type": "assigned_variable", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "vector": [14, 1, 0.8, 0.0111, 1, 0.61, 0.5, 105, 3, 2, 0, 0, 244, 10, 1], "semantic": {"name": "argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " argtypes = property(_get_argtypes, _set_argtypes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L75_C4", "label": "_get_restype", "type": "function", "loc": [75, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "vector": [2, 1, 0.8389, 0.0222, 1, 0.61, 0.5833, 543, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "_get_restype", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_restype(self):\n return self.cfunc.restype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Return_L76_C8", "label": "return", "type": "return", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L75_C4", "vector": [13, 2, 0.8444, 0.0111, 2, 0.06, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.cfunc.restype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L78_C4", "label": "_set_restype", "type": "function", "loc": [78, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "vector": [2, 1, 0.8722, 0.0222, 1, 0.61, 0.6667, 126, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "_set_restype", "arg_names": ["self", "restype"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_restype(self, restype):\n self.cfunc.restype = restype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L79_C8", "label": "self.cfunc.restype =", "type": "assigned_variable", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L78_C4", "vector": [14, 2, 0.8778, 0.0111, 2, 0.09, 0.0, 572, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.cfunc.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cfunc.restype = restype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L81_C4", "label": "restype = property()", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "vector": [14, 1, 0.9, 0.0111, 1, 0.61, 0.75, 176, 3, 2, 0, 0, 244, 10, 1], "semantic": {"name": "restype", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " restype = property(_get_restype, _set_restype)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L84_C4", "label": "_get_errcheck", "type": "function", "loc": [84, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "vector": [2, 1, 0.9389, 0.0222, 1, 0.61, 0.8333, 266, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "_get_errcheck", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_errcheck(self):\n return self.cfunc.errcheck"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Return_L85_C8", "label": "return", "type": "return", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L84_C4", "vector": [13, 2, 0.9444, 0.0111, 2, 0.6, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.cfunc.errcheck"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L87_C4", "label": "_set_errcheck", "type": "function", "loc": [87, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "vector": [2, 1, 0.9722, 0.0222, 1, 0.61, 0.9167, 68, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "_set_errcheck", "arg_names": ["self", "errcheck"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_errcheck(self, errcheck):\n self.cfunc.errcheck = errcheck"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L88_C8", "label": "self.cfunc.errcheck =", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L87_C4", "vector": [14, 2, 0.9778, 0.0111, 2, 0.09, 0.0, 710, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.cfunc.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cfunc.errcheck = errcheck"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L90_C4", "label": "errcheck = property()", "type": "assigned_variable", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "vector": [14, 1, 1.0, 0.0111, 1, 0.61, 1.0, 274, 3, 2, 0, 0, 244, 10, 1], "semantic": {"name": "errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " errcheck = property(_get_errcheck, _set_errcheck)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:If_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:If_L14_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Expr_L14_C21"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:If_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:If_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Return_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Expr_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Try_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:Try_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L44_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:Try_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L45_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:Try_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:Try_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:If_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:If_L52_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Return_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:If_L52_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Return_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Return_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Return_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:If_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:If_L65_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L66_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:If_L65_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Expr_L67_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:If_L65_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L68_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:If_L65_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L70_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Return_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Return_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Assign_L90_C4"}] |
from ctypes import c_char
from django.contrib.gis.geos.libgeos import GEOM_PTR, PREPGEOM_PTR
from django.contrib.gis.geos.prototypes.errcheck import check_predicate
from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc
# Prepared geometry constructor and destructors.
geos_prepare = GEOSFunc('GEOSPrepare')
geos_prepare.argtypes = [GEOM_PTR]
geos_prepare.restype = PREPGEOM_PTR
prepared_destroy = GEOSFunc('GEOSPreparedGeom_destroy')
prepared_destroy.argtpes = [PREPGEOM_PTR]
prepared_destroy.restype = None
# Prepared geometry binary predicate support.
def prepared_predicate(func):
func.argtypes= [PREPGEOM_PTR, GEOM_PTR]
func.restype = c_char
func.errcheck = check_predicate
return func
prepared_contains = prepared_predicate(GEOSFunc('GEOSPreparedContains'))
prepared_contains_properly = prepared_predicate(GEOSFunc('GEOSPreparedContainsProperly'))
prepared_covers = prepared_predicate(GEOSFunc('GEOSPreparedCovers'))
prepared_intersects = prepared_predicate(GEOSFunc('GEOSPreparedIntersects'))
| ajibawa-2023/Python-Code-Large/train/row_98728 | 19 | 25 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98728:ImportFrom_L1_C0", "label": "from ctypes import c_char", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.04, 0.04, 0, 0.66, 0.0, 182, 0, 1, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_char"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import c_char"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98728:ImportFrom_L2_C0", "label": "from django.contrib.gis.geos.libgeos import GEOM_PTR, PREPGEOM_PTR", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.08, 0.04, 0, 0.66, 0.0714, 64, 0, 2, 0, 0, 64, 0, 0], "semantic": {"name": "django.contrib.gis.geos.libgeos", "arg_names": [], "import_names": ["GEOM_PTR", "PREPGEOM_PTR"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.libgeos import GEOM_PTR, PREPGEOM_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98728:ImportFrom_L3_C0", "label": "from django.contrib.gis.geos.prototypes.errcheck import check_predicate", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.12, 0.04, 0, 0.66, 0.1429, 104, 0, 1, 0, 0, 104, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes.errcheck", "arg_names": [], "import_names": ["check_predicate"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes.errcheck import check_predicate"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98728:ImportFrom_L4_C0", "label": "from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.16, 0.04, 0, 0.66, 0.2143, 130, 0, 1, 0, 0, 130, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes.threadsafe", "arg_names": [], "import_names": ["GEOSFunc"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98728:Assign_L7_C0", "label": "geos_prepare = GEOSFunc()", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.28, 0.04, 0, 0.66, 0.2857, 524, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "geos_prepare", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSFunc", "annotation": ""}, "snippet": "geos_prepare = GEOSFunc('GEOSPrepare')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98728:Assign_L8_C0", "label": "geos_prepare.argtypes =", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.32, 0.04, 0, 0.66, 0.3571, 287, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "geos_prepare.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "geos_prepare.argtypes = [GEOM_PTR]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98728:Assign_L9_C0", "label": "geos_prepare.restype =", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.36, 0.04, 0, 0.66, 0.4286, 601, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geos_prepare.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "geos_prepare.restype = PREPGEOM_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98728:Assign_L11_C0", "label": "prepared_destroy = GEOSFunc()", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.44, 0.04, 0, 0.66, 0.5, 17, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "prepared_destroy", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSFunc", "annotation": ""}, "snippet": "prepared_destroy = GEOSFunc('GEOSPreparedGeom_destroy')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98728:Assign_L12_C0", "label": "prepared_destroy.argtpes =", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.48, 0.04, 0, 0.66, 0.5714, 74, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "prepared_destroy.argtpes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "prepared_destroy.argtpes = [PREPGEOM_PTR]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98728:Assign_L13_C0", "label": "prepared_destroy.restype =", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.52, 0.04, 0, 0.66, 0.6429, 925, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "prepared_destroy.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "prepared_destroy.restype = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98728:FunctionDef_L16_C0", "label": "prepared_predicate", "type": "function", "loc": [16, 20], "level": 0, "parent": null, "vector": [2, 0, 0.72, 0.2, 0, 0.66, 0.7143, 639, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "prepared_predicate", "arg_names": ["func"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def prepared_predicate(func):\n func.argtypes= [PREPGEOM_PTR, GEOM_PTR]\n func.restype = c_char\n func.errcheck = check_predicate\n return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98728:Assign_L17_C4", "label": "func.argtypes =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98728:FunctionDef_L16_C0", "vector": [14, 1, 0.68, 0.04, 1, 0.56, 0.0, 441, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.argtypes= [PREPGEOM_PTR, GEOM_PTR]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98728:Assign_L18_C4", "label": "func.restype =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98728:FunctionDef_L16_C0", "vector": [14, 1, 0.72, 0.04, 1, 0.56, 0.3333, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = c_char"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98728:Assign_L19_C4", "label": "func.errcheck =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98728:FunctionDef_L16_C0", "vector": [14, 1, 0.76, 0.04, 1, 0.56, 0.6667, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.errcheck = check_predicate"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98728:Return_L20_C4", "label": "return", "type": "return", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98728:FunctionDef_L16_C0", "vector": [13, 1, 0.8, 0.04, 1, 0.56, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98728:Assign_L22_C0", "label": "prepared_contains = prepared_predicate()", "type": "assigned_variable", "loc": [22, 22], "level": 0, "parent": null, "vector": [14, 0, 0.88, 0.04, 0, 0.66, 0.7857, 37, 3, 1, 0, 0, 639, 10, 2], "semantic": {"name": "prepared_contains", "arg_names": [], "import_names": [], "rhs_call_name": "prepared_predicate", "annotation": ""}, "snippet": "prepared_contains = prepared_predicate(GEOSFunc('GEOSPreparedContains'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98728:Assign_L23_C0", "label": "prepared_contains_properly = prepared_predicate()", "type": "assigned_variable", "loc": [23, 23], "level": 0, "parent": null, "vector": [14, 0, 0.92, 0.04, 0, 0.66, 0.8571, 886, 3, 1, 0, 0, 639, 10, 2], "semantic": {"name": "prepared_contains_properly", "arg_names": [], "import_names": [], "rhs_call_name": "prepared_predicate", "annotation": ""}, "snippet": "prepared_contains_properly = prepared_predicate(GEOSFunc('GEOSPreparedContainsProperly'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98728:Assign_L24_C0", "label": "prepared_covers = prepared_predicate()", "type": "assigned_variable", "loc": [24, 24], "level": 0, "parent": null, "vector": [14, 0, 0.96, 0.04, 0, 0.66, 0.9286, 822, 3, 1, 0, 0, 639, 10, 2], "semantic": {"name": "prepared_covers", "arg_names": [], "import_names": [], "rhs_call_name": "prepared_predicate", "annotation": ""}, "snippet": "prepared_covers = prepared_predicate(GEOSFunc('GEOSPreparedCovers'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98728:Assign_L25_C0", "label": "prepared_intersects = prepared_predicate()", "type": "assigned_variable", "loc": [25, 25], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.04, 0, 0.66, 1.0, 96, 3, 1, 0, 0, 639, 10, 2], "semantic": {"name": "prepared_intersects", "arg_names": [], "import_names": [], "rhs_call_name": "prepared_predicate", "annotation": ""}, "snippet": "prepared_intersects = prepared_predicate(GEOSFunc('GEOSPreparedIntersects'))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98728:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98728:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98728:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98728:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98728:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98728:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98728:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98728:Return_L20_C4"}] |
from ctypes import c_double, c_int, c_uint, POINTER
from django.contrib.gis.geos.libgeos import GEOM_PTR, CS_PTR
from django.contrib.gis.geos.prototypes.errcheck import last_arg_byref, GEOSException
from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc
## Error-checking routines specific to coordinate sequences. ##
def check_cs_ptr(result, func, cargs):
"Error checking on routines that return Geometries."
if not result:
raise GEOSException('Error encountered checking Coordinate Sequence returned from GEOS C function "%s".' % func.__name__)
return result
def check_cs_op(result, func, cargs):
"Checks the status code of a coordinate sequence operation."
if result == 0:
raise GEOSException('Could not set value on coordinate sequence')
else:
return result
def check_cs_get(result, func, cargs):
"Checking the coordinate sequence retrieval."
check_cs_op(result, func, cargs)
# Object in by reference, return its value.
return last_arg_byref(cargs)
## Coordinate sequence prototype generation functions. ##
def cs_int(func):
"For coordinate sequence routines that return an integer."
func.argtypes = [CS_PTR, POINTER(c_uint)]
func.restype = c_int
func.errcheck = check_cs_get
return func
def cs_operation(func, ordinate=False, get=False):
"For coordinate sequence operations."
if get:
# Get routines get double parameter passed-in by reference.
func.errcheck = check_cs_get
dbl_param = POINTER(c_double)
else:
func.errcheck = check_cs_op
dbl_param = c_double
if ordinate:
# Get/Set ordinate routines have an extra uint parameter.
func.argtypes = [CS_PTR, c_uint, c_uint, dbl_param]
else:
func.argtypes = [CS_PTR, c_uint, dbl_param]
func.restype = c_int
return func
def cs_output(func, argtypes):
"For routines that return a coordinate sequence."
func.argtypes = argtypes
func.restype = CS_PTR
func.errcheck = check_cs_ptr
return func
## Coordinate Sequence ctypes prototypes ##
# Coordinate Sequence constructors & cloning.
cs_clone = cs_output(GEOSFunc('GEOSCoordSeq_clone'), [CS_PTR])
create_cs = cs_output(GEOSFunc('GEOSCoordSeq_create'), [c_uint, c_uint])
get_cs = cs_output(GEOSFunc('GEOSGeom_getCoordSeq'), [GEOM_PTR])
# Getting, setting ordinate
cs_getordinate = cs_operation(GEOSFunc('GEOSCoordSeq_getOrdinate'), ordinate=True, get=True)
cs_setordinate = cs_operation(GEOSFunc('GEOSCoordSeq_setOrdinate'), ordinate=True)
# For getting, x, y, z
cs_getx = cs_operation(GEOSFunc('GEOSCoordSeq_getX'), get=True)
cs_gety = cs_operation(GEOSFunc('GEOSCoordSeq_getY'), get=True)
cs_getz = cs_operation(GEOSFunc('GEOSCoordSeq_getZ'), get=True)
# For setting, x, y, z
cs_setx = cs_operation(GEOSFunc('GEOSCoordSeq_setX'))
cs_sety = cs_operation(GEOSFunc('GEOSCoordSeq_setY'))
cs_setz = cs_operation(GEOSFunc('GEOSCoordSeq_setZ'))
# These routines return size & dimensions.
cs_getsize = cs_int(GEOSFunc('GEOSCoordSeq_getSize'))
cs_getdims = cs_int(GEOSFunc('GEOSCoordSeq_getDimensions'))
| ajibawa-2023/Python-Code-Large/train/row_98729 | 53 | 83 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98729:ImportFrom_L1_C0", "label": "from ctypes import c_double, c_int, c_uint\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.012, 0.012, 0, 0.66, 0.0, 182, 0, 4, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_double", "c_int", "c_uint", "POINTER"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import c_double, c_int, c_uint, POINTER"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:ImportFrom_L2_C0", "label": "from django.contrib.gis.geos.libgeos import GEOM_PTR, CS_PTR", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0241, 0.012, 0, 0.66, 0.0455, 64, 0, 2, 0, 0, 64, 0, 0], "semantic": {"name": "django.contrib.gis.geos.libgeos", "arg_names": [], "import_names": ["GEOM_PTR", "CS_PTR"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.libgeos import GEOM_PTR, CS_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:ImportFrom_L3_C0", "label": "from django.contrib.gis.geos.prototypes.errcheck import last_arg_byref, GEOSException", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0361, 0.012, 0, 0.66, 0.0909, 104, 0, 2, 0, 0, 104, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes.errcheck", "arg_names": [], "import_names": ["last_arg_byref", "GEOSException"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes.errcheck import last_arg_byref, GEOSException"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:ImportFrom_L4_C0", "label": "from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0482, 0.012, 0, 0.66, 0.1364, 130, 0, 1, 0, 0, 130, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes.threadsafe", "arg_names": [], "import_names": ["GEOSFunc"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L7_C0", "label": "check_cs_ptr", "type": "function", "loc": [7, 11], "level": 0, "parent": null, "vector": [2, 0, 0.1084, 0.0602, 0, 0.66, 0.1818, 60, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "check_cs_ptr", "arg_names": ["result", "func", "cargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_cs_ptr(result, func, cargs):\n \"Error checking on routines that return Geometries.\"\n if not result:\n raise GEOSException('Error encountered checking Coordinate Sequence returned from GEOS C function \"%s\".' % func.__name__)\n return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Expr_L8_C4", "label": "expression", "type": "expression", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L7_C0", "vector": [8, 1, 0.0964, 0.012, 1, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Error checking on routines that return Geometries.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:If_L9_C4", "label": "if", "type": "if", "loc": [9, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L7_C0", "vector": [4, 1, 0.1145, 0.0241, 1, 0.72, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not result:\n raise GEOSException('Error encountered checking Coordinate Sequence returned from GEOS C function \"%s\".' % func.__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Return_L11_C4", "label": "return", "type": "return", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L7_C0", "vector": [13, 1, 0.1325, 0.012, 1, 0.72, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L13_C0", "label": "check_cs_op", "type": "function", "loc": [13, 18], "level": 0, "parent": null, "vector": [2, 0, 0.1867, 0.0723, 0, 0.66, 0.2273, 630, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "check_cs_op", "arg_names": ["result", "func", "cargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_cs_op(result, func, cargs):\n \"Checks the status code of a coordinate sequence operation.\"\n if result == 0:\n raise GEOSException('Could not set value on coordinate sequence')\n else:\n return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Expr_L14_C4", "label": "expression", "type": "expression", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L13_C0", "vector": [8, 1, 0.1687, 0.012, 1, 0.2, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Checks the status code of a coordinate sequence operation.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:If_L15_C4", "label": "if", "type": "if", "loc": [15, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L13_C0", "vector": [4, 1, 0.1988, 0.0482, 1, 0.2, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if result == 0:\n raise GEOSException('Could not set value on coordinate sequence')\n else:\n return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Return_L18_C8", "label": "return", "type": "return", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:If_L15_C4", "vector": [13, 2, 0.2169, 0.012, 2, 0.48, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L20_C0", "label": "check_cs_get", "type": "function", "loc": [20, 24], "level": 0, "parent": null, "vector": [2, 0, 0.2651, 0.0602, 0, 0.66, 0.2727, 900, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "check_cs_get", "arg_names": ["result", "func", "cargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_cs_get(result, func, cargs):\n \"Checking the coordinate sequence retrieval.\"\n check_cs_op(result, func, cargs)\n # Object in by reference, return its value.\n return last_arg_byref(cargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Expr_L21_C4", "label": "expression", "type": "expression", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L20_C0", "vector": [8, 1, 0.253, 0.012, 1, 0.69, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Checking the coordinate sequence retrieval.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Expr_L22_C4", "label": "check_cs_op()", "type": "expression", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L20_C0", "vector": [8, 1, 0.2651, 0.012, 1, 0.69, 0.5, 630, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "check_cs_op", "arg_names": [], "import_names": [], "rhs_call_name": "check_cs_op", "annotation": ""}, "snippet": " check_cs_op(result, func, cargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Return_L24_C4", "label": "return", "type": "return", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L20_C0", "vector": [13, 1, 0.2892, 0.012, 1, 0.69, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return last_arg_byref(cargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L27_C0", "label": "cs_int", "type": "function", "loc": [27, 32], "level": 0, "parent": null, "vector": [2, 0, 0.3554, 0.0723, 0, 0.66, 0.3182, 520, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "cs_int", "arg_names": ["func"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def cs_int(func):\n \"For coordinate sequence routines that return an integer.\"\n func.argtypes = [CS_PTR, POINTER(c_uint)]\n func.restype = c_int\n func.errcheck = check_cs_get\n return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Expr_L28_C4", "label": "expression", "type": "expression", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L27_C0", "vector": [8, 1, 0.3373, 0.012, 1, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"For coordinate sequence routines that return an integer.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L29_C4", "label": "func.argtypes =", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L27_C0", "vector": [14, 1, 0.3494, 0.012, 1, 0.05, 0.25, 441, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.argtypes = [CS_PTR, POINTER(c_uint)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L30_C4", "label": "func.restype =", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L27_C0", "vector": [14, 1, 0.3614, 0.012, 1, 0.05, 0.5, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = c_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L31_C4", "label": "func.errcheck =", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L27_C0", "vector": [14, 1, 0.3735, 0.012, 1, 0.05, 0.75, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.errcheck = check_cs_get"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Return_L32_C4", "label": "return", "type": "return", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L27_C0", "vector": [13, 1, 0.3855, 0.012, 1, 0.05, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L34_C0", "label": "cs_operation", "type": "function", "loc": [34, 51], "level": 0, "parent": null, "vector": [2, 0, 0.512, 0.2169, 0, 0.66, 0.3636, 621, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "cs_operation", "arg_names": ["func", "ordinate", "get"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def cs_operation(func, ordinate=False, get=False):\n \"For coordinate sequence operations.\"\n if get:\n # Get routines get double parameter passed-in by reference.\n func.errcheck = check_cs_get\n dbl_param = POINTER(c_double)\n else:\n func.errcheck = check_cs_op"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Expr_L35_C4", "label": "expression", "type": "expression", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L34_C0", "vector": [8, 1, 0.4217, 0.012, 1, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"For coordinate sequence operations.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:If_L36_C4", "label": "if", "type": "if", "loc": [36, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L34_C0", "vector": [4, 1, 0.4699, 0.0843, 1, 0.43, 0.25, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if get:\n # Get routines get double parameter passed-in by reference.\n func.errcheck = check_cs_get\n dbl_param = POINTER(c_double)\n else:\n func.errcheck = check_cs_op\n dbl_param = c_double"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L38_C8", "label": "func.errcheck =", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:If_L36_C4", "vector": [14, 2, 0.4578, 0.012, 2, 0.3, 0.0, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.errcheck = check_cs_get"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L39_C8", "label": "dbl_param = POINTER()", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:If_L36_C4", "vector": [14, 2, 0.4699, 0.012, 2, 0.3, 0.3333, 146, 3, 1, 0, 0, 785, 10, 1], "semantic": {"name": "dbl_param", "arg_names": [], "import_names": [], "rhs_call_name": "POINTER", "annotation": ""}, "snippet": " dbl_param = POINTER(c_double)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L41_C8", "label": "func.errcheck =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:If_L36_C4", "vector": [14, 2, 0.494, 0.012, 2, 0.3, 0.6667, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.errcheck = check_cs_op"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L42_C8", "label": "dbl_param =", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:If_L36_C4", "vector": [14, 2, 0.506, 0.012, 2, 0.3, 1.0, 146, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dbl_param", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dbl_param = c_double"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:If_L44_C4", "label": "if", "type": "if", "loc": [44, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L34_C0", "vector": [4, 1, 0.5542, 0.0602, 1, 0.43, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ordinate:\n # Get/Set ordinate routines have an extra uint parameter.\n func.argtypes = [CS_PTR, c_uint, c_uint, dbl_param]\n else:\n func.argtypes = [CS_PTR, c_uint, dbl_param]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L46_C8", "label": "func.argtypes =", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:If_L44_C4", "vector": [14, 2, 0.5542, 0.012, 2, 0.91, 0.0, 441, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.argtypes = [CS_PTR, c_uint, c_uint, dbl_param]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L48_C8", "label": "func.argtypes =", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:If_L44_C4", "vector": [14, 2, 0.5783, 0.012, 2, 0.91, 1.0, 441, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.argtypes = [CS_PTR, c_uint, dbl_param]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L50_C4", "label": "func.restype =", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L34_C0", "vector": [14, 1, 0.6024, 0.012, 1, 0.43, 0.75, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = c_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Return_L51_C4", "label": "return", "type": "return", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L34_C0", "vector": [13, 1, 0.6145, 0.012, 1, 0.43, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L53_C0", "label": "cs_output", "type": "function", "loc": [53, 58], "level": 0, "parent": null, "vector": [2, 0, 0.6687, 0.0723, 0, 0.66, 0.4091, 854, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "cs_output", "arg_names": ["func", "argtypes"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def cs_output(func, argtypes):\n \"For routines that return a coordinate sequence.\"\n func.argtypes = argtypes\n func.restype = CS_PTR\n func.errcheck = check_cs_ptr\n return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Expr_L54_C4", "label": "expression", "type": "expression", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L53_C0", "vector": [8, 1, 0.6506, 0.012, 1, 0.9, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"For routines that return a coordinate sequence.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L55_C4", "label": "func.argtypes =", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L53_C0", "vector": [14, 1, 0.6627, 0.012, 1, 0.9, 0.25, 441, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.argtypes = argtypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L56_C4", "label": "func.restype =", "type": "assigned_variable", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L53_C0", "vector": [14, 1, 0.6747, 0.012, 1, 0.9, 0.5, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = CS_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L57_C4", "label": "func.errcheck =", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L53_C0", "vector": [14, 1, 0.6867, 0.012, 1, 0.9, 0.75, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.errcheck = check_cs_ptr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Return_L58_C4", "label": "return", "type": "return", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L53_C0", "vector": [13, 1, 0.6988, 0.012, 1, 0.9, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L63_C0", "label": "cs_clone = cs_output()", "type": "assigned_variable", "loc": [63, 63], "level": 0, "parent": null, "vector": [14, 0, 0.759, 0.012, 0, 0.66, 0.4545, 355, 3, 2, 0, 0, 854, 10, 2], "semantic": {"name": "cs_clone", "arg_names": [], "import_names": [], "rhs_call_name": "cs_output", "annotation": ""}, "snippet": "cs_clone = cs_output(GEOSFunc('GEOSCoordSeq_clone'), [CS_PTR])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L64_C0", "label": "create_cs = cs_output()", "type": "assigned_variable", "loc": [64, 64], "level": 0, "parent": null, "vector": [14, 0, 0.7711, 0.012, 0, 0.66, 0.5, 360, 3, 2, 0, 0, 854, 10, 2], "semantic": {"name": "create_cs", "arg_names": [], "import_names": [], "rhs_call_name": "cs_output", "annotation": ""}, "snippet": "create_cs = cs_output(GEOSFunc('GEOSCoordSeq_create'), [c_uint, c_uint])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L65_C0", "label": "get_cs = cs_output()", "type": "assigned_variable", "loc": [65, 65], "level": 0, "parent": null, "vector": [14, 0, 0.7831, 0.012, 0, 0.66, 0.5455, 696, 3, 2, 0, 0, 854, 10, 2], "semantic": {"name": "get_cs", "arg_names": [], "import_names": [], "rhs_call_name": "cs_output", "annotation": ""}, "snippet": "get_cs = cs_output(GEOSFunc('GEOSGeom_getCoordSeq'), [GEOM_PTR])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L68_C0", "label": "cs_getordinate = cs_operation()", "type": "assigned_variable", "loc": [68, 68], "level": 0, "parent": null, "vector": [14, 0, 0.8193, 0.012, 0, 0.66, 0.5909, 708, 3, 3, 0, 0, 621, 10, 2], "semantic": {"name": "cs_getordinate", "arg_names": [], "import_names": [], "rhs_call_name": "cs_operation", "annotation": ""}, "snippet": "cs_getordinate = cs_operation(GEOSFunc('GEOSCoordSeq_getOrdinate'), ordinate=True, get=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L69_C0", "label": "cs_setordinate = cs_operation()", "type": "assigned_variable", "loc": [69, 69], "level": 0, "parent": null, "vector": [14, 0, 0.8313, 0.012, 0, 0.66, 0.6364, 204, 3, 2, 0, 0, 621, 10, 2], "semantic": {"name": "cs_setordinate", "arg_names": [], "import_names": [], "rhs_call_name": "cs_operation", "annotation": ""}, "snippet": "cs_setordinate = cs_operation(GEOSFunc('GEOSCoordSeq_setOrdinate'), ordinate=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L72_C0", "label": "cs_getx = cs_operation()", "type": "assigned_variable", "loc": [72, 72], "level": 0, "parent": null, "vector": [14, 0, 0.8675, 0.012, 0, 0.66, 0.6818, 454, 3, 2, 0, 0, 621, 10, 2], "semantic": {"name": "cs_getx", "arg_names": [], "import_names": [], "rhs_call_name": "cs_operation", "annotation": ""}, "snippet": "cs_getx = cs_operation(GEOSFunc('GEOSCoordSeq_getX'), get=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L73_C0", "label": "cs_gety = cs_operation()", "type": "assigned_variable", "loc": [73, 73], "level": 0, "parent": null, "vector": [14, 0, 0.8795, 0.012, 0, 0.66, 0.7273, 343, 3, 2, 0, 0, 621, 10, 2], "semantic": {"name": "cs_gety", "arg_names": [], "import_names": [], "rhs_call_name": "cs_operation", "annotation": ""}, "snippet": "cs_gety = cs_operation(GEOSFunc('GEOSCoordSeq_getY'), get=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L74_C0", "label": "cs_getz = cs_operation()", "type": "assigned_variable", "loc": [74, 74], "level": 0, "parent": null, "vector": [14, 0, 0.8916, 0.012, 0, 0.66, 0.7727, 984, 3, 2, 0, 0, 621, 10, 2], "semantic": {"name": "cs_getz", "arg_names": [], "import_names": [], "rhs_call_name": "cs_operation", "annotation": ""}, "snippet": "cs_getz = cs_operation(GEOSFunc('GEOSCoordSeq_getZ'), get=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L77_C0", "label": "cs_setx = cs_operation()", "type": "assigned_variable", "loc": [77, 77], "level": 0, "parent": null, "vector": [14, 0, 0.9277, 0.012, 0, 0.66, 0.8182, 344, 3, 1, 0, 0, 621, 10, 2], "semantic": {"name": "cs_setx", "arg_names": [], "import_names": [], "rhs_call_name": "cs_operation", "annotation": ""}, "snippet": "cs_setx = cs_operation(GEOSFunc('GEOSCoordSeq_setX'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L78_C0", "label": "cs_sety = cs_operation()", "type": "assigned_variable", "loc": [78, 78], "level": 0, "parent": null, "vector": [14, 0, 0.9398, 0.012, 0, 0.66, 0.8636, 300, 3, 1, 0, 0, 621, 10, 2], "semantic": {"name": "cs_sety", "arg_names": [], "import_names": [], "rhs_call_name": "cs_operation", "annotation": ""}, "snippet": "cs_sety = cs_operation(GEOSFunc('GEOSCoordSeq_setY'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L79_C0", "label": "cs_setz = cs_operation()", "type": "assigned_variable", "loc": [79, 79], "level": 0, "parent": null, "vector": [14, 0, 0.9518, 0.012, 0, 0.66, 0.9091, 952, 3, 1, 0, 0, 621, 10, 2], "semantic": {"name": "cs_setz", "arg_names": [], "import_names": [], "rhs_call_name": "cs_operation", "annotation": ""}, "snippet": "cs_setz = cs_operation(GEOSFunc('GEOSCoordSeq_setZ'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L82_C0", "label": "cs_getsize = cs_int()", "type": "assigned_variable", "loc": [82, 82], "level": 0, "parent": null, "vector": [14, 0, 0.988, 0.012, 0, 0.66, 0.9545, 153, 3, 1, 0, 0, 520, 10, 2], "semantic": {"name": "cs_getsize", "arg_names": [], "import_names": [], "rhs_call_name": "cs_int", "annotation": ""}, "snippet": "cs_getsize = cs_int(GEOSFunc('GEOSCoordSeq_getSize'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L83_C0", "label": "cs_getdims = cs_int()", "type": "assigned_variable", "loc": [83, 83], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.012, 0, 0.66, 1.0, 139, 3, 1, 0, 0, 520, 10, 2], "semantic": {"name": "cs_getdims", "arg_names": [], "import_names": [], "rhs_call_name": "cs_int", "annotation": ""}, "snippet": "cs_getdims = cs_int(GEOSFunc('GEOSCoordSeq_getDimensions'))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:If_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Return_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:If_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:If_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Return_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Return_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Expr_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Return_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Expr_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:If_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:If_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:If_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:If_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:If_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:If_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:If_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:If_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Return_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Return_L58_C4"}] |
"""
This module is for the miscellaneous GEOS routines, particularly the
ones that return the area, distance, and length.
"""
from ctypes import c_int, c_double, POINTER
from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOS_PREPARE
from django.contrib.gis.geos.prototypes.errcheck import check_dbl, check_string
from django.contrib.gis.geos.prototypes.geom import geos_char_p
from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc
__all__ = ['geos_area', 'geos_distance', 'geos_length']
### ctypes generator function ###
def dbl_from_geom(func, num_geom=1):
"""
Argument is a Geometry, return type is double that is passed
in by reference as the last argument.
"""
argtypes = [GEOM_PTR for i in xrange(num_geom)]
argtypes += [POINTER(c_double)]
func.argtypes = argtypes
func.restype = c_int # Status code returned
func.errcheck = check_dbl
return func
### ctypes prototypes ###
# Area, distance, and length prototypes.
geos_area = dbl_from_geom(GEOSFunc('GEOSArea'))
geos_distance = dbl_from_geom(GEOSFunc('GEOSDistance'), num_geom=2)
geos_length = dbl_from_geom(GEOSFunc('GEOSLength'))
# Validity reason; only in GEOS 3.1+
if GEOS_PREPARE:
geos_isvalidreason = GEOSFunc('GEOSisValidReason')
geos_isvalidreason.argtypes = [GEOM_PTR]
geos_isvalidreason.restype = geos_char_p
geos_isvalidreason.errcheck = check_string
__all__.append('geos_isvalidreason')
| ajibawa-2023/Python-Code-Large/train/row_98730 | 23 | 39 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98730:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0641, 0.1026, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n This module is for the miscellaneous GEOS routines, particularly the\n ones that return the area, distance, and length.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98730:ImportFrom_L5_C0", "label": "from ctypes import c_int, c_double, POINTER", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1282, 0.0256, 0, 0.66, 0.0909, 182, 0, 3, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_int", "c_double", "POINTER"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import c_int, c_double, POINTER"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98730:ImportFrom_L6_C0", "label": "from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOS_PREPARE", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1538, 0.0256, 0, 0.66, 0.1818, 64, 0, 2, 0, 0, 64, 0, 0], "semantic": {"name": "django.contrib.gis.geos.libgeos", "arg_names": [], "import_names": ["GEOM_PTR", "GEOS_PREPARE"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOS_PREPARE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98730:ImportFrom_L7_C0", "label": "from django.contrib.gis.geos.prototypes.errcheck import check_dbl, check_string", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1795, 0.0256, 0, 0.66, 0.2727, 104, 0, 2, 0, 0, 104, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes.errcheck", "arg_names": [], "import_names": ["check_dbl", "check_string"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes.errcheck import check_dbl, check_string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98730:ImportFrom_L8_C0", "label": "from django.contrib.gis.geos.prototypes.geom import geos_char_p", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.2051, 0.0256, 0, 0.66, 0.3636, 589, 0, 1, 0, 0, 589, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes.geom", "arg_names": [], "import_names": ["geos_char_p"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes.geom import geos_char_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98730:ImportFrom_L9_C0", "label": "from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.2308, 0.0256, 0, 0.66, 0.4545, 130, 0, 1, 0, 0, 130, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes.threadsafe", "arg_names": [], "import_names": ["GEOSFunc"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98730:Assign_L11_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.2821, 0.0256, 0, 0.66, 0.5455, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = ['geos_area', 'geos_distance', 'geos_length']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98730:FunctionDef_L14_C0", "label": "dbl_from_geom", "type": "function", "loc": [14, 24], "level": 0, "parent": null, "vector": [2, 0, 0.4872, 0.2821, 0, 0.66, 0.6364, 335, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "dbl_from_geom", "arg_names": ["func", "num_geom"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def dbl_from_geom(func, num_geom=1):\n \"\"\"\n Argument is a Geometry, return type is double that is passed\n in by reference as the last argument.\n \"\"\"\n argtypes = [GEOM_PTR for i in xrange(num_geom)]\n argtypes += [POINTER(c_double)]\n func.argtypes = argtypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98730:Expr_L15_C4", "label": "expression", "type": "expression", "loc": [15, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98730:FunctionDef_L14_C0", "vector": [8, 1, 0.4231, 0.1026, 1, 0.58, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Argument is a Geometry, return type is double that is passed\n in by reference as the last argument.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98730:Assign_L19_C4", "label": "argtypes =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98730:FunctionDef_L14_C0", "vector": [14, 1, 0.4872, 0.0256, 1, 0.58, 0.2, 105, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " argtypes = [GEOM_PTR for i in xrange(num_geom)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98730:Assign_L21_C4", "label": "func.argtypes =", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98730:FunctionDef_L14_C0", "vector": [14, 1, 0.5385, 0.0256, 1, 0.58, 0.4, 441, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.argtypes = argtypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98730:Assign_L22_C4", "label": "func.restype =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98730:FunctionDef_L14_C0", "vector": [14, 1, 0.5641, 0.0256, 1, 0.58, 0.6, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = c_int # Status code returned"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98730:Assign_L23_C4", "label": "func.errcheck =", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98730:FunctionDef_L14_C0", "vector": [14, 1, 0.5897, 0.0256, 1, 0.58, 0.8, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.errcheck = check_dbl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98730:Return_L24_C4", "label": "return", "type": "return", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98730:FunctionDef_L14_C0", "vector": [13, 1, 0.6154, 0.0256, 1, 0.58, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98730:Assign_L29_C0", "label": "geos_area = dbl_from_geom()", "type": "assigned_variable", "loc": [29, 29], "level": 0, "parent": null, "vector": [14, 0, 0.7436, 0.0256, 0, 0.66, 0.7273, 424, 3, 1, 0, 0, 335, 10, 2], "semantic": {"name": "geos_area", "arg_names": [], "import_names": [], "rhs_call_name": "dbl_from_geom", "annotation": ""}, "snippet": "geos_area = dbl_from_geom(GEOSFunc('GEOSArea'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98730:Assign_L30_C0", "label": "geos_distance = dbl_from_geom()", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.7692, 0.0256, 0, 0.66, 0.8182, 832, 3, 2, 0, 0, 335, 10, 2], "semantic": {"name": "geos_distance", "arg_names": [], "import_names": [], "rhs_call_name": "dbl_from_geom", "annotation": ""}, "snippet": "geos_distance = dbl_from_geom(GEOSFunc('GEOSDistance'), num_geom=2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98730:Assign_L31_C0", "label": "geos_length = dbl_from_geom()", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.7949, 0.0256, 0, 0.66, 0.9091, 155, 3, 1, 0, 0, 335, 10, 2], "semantic": {"name": "geos_length", "arg_names": [], "import_names": [], "rhs_call_name": "dbl_from_geom", "annotation": ""}, "snippet": "geos_length = dbl_from_geom(GEOSFunc('GEOSLength'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98730:If_L34_C0", "label": "if", "type": "if", "loc": [34, 39], "level": 0, "parent": null, "vector": [4, 0, 0.9359, 0.1538, 0, 0.66, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if GEOS_PREPARE:\n geos_isvalidreason = GEOSFunc('GEOSisValidReason')\n geos_isvalidreason.argtypes = [GEOM_PTR]\n geos_isvalidreason.restype = geos_char_p\n geos_isvalidreason.errcheck = check_string\n __all__.append('geos_isvalidreason')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98730:Assign_L35_C4", "label": "geos_isvalidreason = GEOSFunc()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98730:If_L34_C0", "vector": [14, 1, 0.8974, 0.0256, 1, 0.47, 0.0, 733, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "geos_isvalidreason", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSFunc", "annotation": ""}, "snippet": " geos_isvalidreason = GEOSFunc('GEOSisValidReason')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98730:Assign_L36_C4", "label": "geos_isvalidreason.argtypes =", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98730:If_L34_C0", "vector": [14, 1, 0.9231, 0.0256, 1, 0.47, 0.25, 915, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "geos_isvalidreason.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geos_isvalidreason.argtypes = [GEOM_PTR]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98730:Assign_L37_C4", "label": "geos_isvalidreason.restype =", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98730:If_L34_C0", "vector": [14, 1, 0.9487, 0.0256, 1, 0.47, 0.5, 761, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geos_isvalidreason.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geos_isvalidreason.restype = geos_char_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98730:Assign_L38_C4", "label": "geos_isvalidreason.errcheck =", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98730:If_L34_C0", "vector": [14, 1, 0.9744, 0.0256, 1, 0.47, 0.75, 530, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geos_isvalidreason.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geos_isvalidreason.errcheck = check_string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98730:Expr_L39_C4", "label": "append()", "type": "expression", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98730:If_L34_C0", "vector": [8, 1, 1.0, 0.0256, 1, 0.47, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " __all__.append('geos_isvalidreason')"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98730:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98730:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98730:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98730:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98730:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98730:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98730:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98730:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98730:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98730:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98730:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98730:Return_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98730:If_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98730:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98730:If_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98730:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98730:If_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98730:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98730:If_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98730:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98730:If_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98730:Expr_L39_C4"}] |
"""
This module contains all of the GEOS ctypes function prototypes. Each
prototype handles the interaction between the GEOS library and Python
via ctypes.
"""
# Coordinate sequence routines.
from django.contrib.gis.geos.prototypes.coordseq import create_cs, get_cs, \
cs_clone, cs_getordinate, cs_setordinate, cs_getx, cs_gety, cs_getz, \
cs_setx, cs_sety, cs_setz, cs_getsize, cs_getdims
# Geometry routines.
from django.contrib.gis.geos.prototypes.geom import from_hex, from_wkb, from_wkt, \
create_point, create_linestring, create_linearring, create_polygon, create_collection, \
destroy_geom, get_extring, get_intring, get_nrings, get_geomn, geom_clone, \
geos_normalize, geos_type, geos_typeid, geos_get_srid, geos_set_srid, \
get_dims, get_num_coords, get_num_geoms, \
to_hex, to_wkb, to_wkt
# Miscellaneous routines.
from django.contrib.gis.geos.prototypes.misc import *
# Predicates
from django.contrib.gis.geos.prototypes.predicates import geos_hasz, geos_isempty, \
geos_isring, geos_issimple, geos_isvalid, geos_contains, geos_crosses, \
geos_disjoint, geos_equals, geos_equalsexact, geos_intersects, \
geos_intersects, geos_overlaps, geos_relatepattern, geos_touches, geos_within
# Topology routines
from django.contrib.gis.geos.prototypes.topology import *
| ajibawa-2023/Python-Code-Large/train/row_98731 | 6 | 30 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98731:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.1, 0.1667, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n This module contains all of the GEOS ctypes function prototypes. Each\n prototype handles the interaction between the GEOS library and Python\n via ctypes.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98731:ImportFrom_L8_C0", "label": "from django.contrib.gis.geos.prototypes.coordseq import create_cs, get_cs, cs_clone\u2026", "type": "import", "loc": [8, 10], "level": 0, "parent": null, "vector": [1, 0, 0.3, 0.1, 0, 0.66, 0.2, 928, 0, 13, 0, 0, 928, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes.coordseq", "arg_names": [], "import_names": ["create_cs", "get_cs", "cs_clone", "cs_getordinate", "cs_setordinate", "cs_getx", "cs_gety", "cs_getz", "cs_setx", "cs_sety", "cs_setz", "cs_getsize", "cs_getdims"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes.coordseq import create_cs, get_cs, \\\n cs_clone, cs_getordinate, cs_setordinate, cs_getx, cs_gety, cs_getz, \\\n cs_setx, cs_sety, cs_setz, cs_getsize, cs_getdims"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98731:ImportFrom_L13_C0", "label": "from django.contrib.gis.geos.prototypes.geom import from_hex, from_wkb, from_wkt\u2026", "type": "import", "loc": [13, 18], "level": 0, "parent": null, "vector": [1, 0, 0.5167, 0.2, 0, 0.66, 0.4, 589, 0, 25, 0, 0, 589, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes.geom", "arg_names": [], "import_names": ["from_hex", "from_wkb", "from_wkt", "create_point", "create_linestring", "create_linearring", "create_polygon", "create_collection", "destroy_geom", "get_extring", "get_intring", "get_nrings", "get_geomn", "geom_clone", "geos_normalize", "geos_type", "geos_typeid", "geos_get_srid", "geos_set_srid", "get_dims", "get_num_coords", "get_num_geoms", "to_hex", "to_wkb", "to_wkt"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes.geom import from_hex, from_wkb, from_wkt, \\\n create_point, create_linestring, create_linearring, create_polygon, create_collection, \\\n destroy_geom, get_extring, get_intring, get_nrings, get_geomn, geom_clone, \\\n geos_normalize, geos_type, geos_typeid, geos_get_srid, geos_set_srid, \\\n get_dims, get_num_coords, get_num_geoms, \\\n to_hex, to_wkb, to_wkt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98731:ImportFrom_L21_C0", "label": "from django.contrib.gis.geos.prototypes.misc import *", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.7, 0.0333, 0, 0.66, 0.6, 56, 0, 1, 0, 0, 56, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes.misc", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes.misc import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98731:ImportFrom_L24_C0", "label": "from django.contrib.gis.geos.prototypes.predicates import geos_hasz, geos_isempty, geos_isring\u2026", "type": "import", "loc": [24, 27], "level": 0, "parent": null, "vector": [1, 0, 0.85, 0.1333, 0, 0.66, 0.8, 685, 0, 16, 0, 0, 685, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes.predicates", "arg_names": [], "import_names": ["geos_hasz", "geos_isempty", "geos_isring", "geos_issimple", "geos_isvalid", "geos_contains", "geos_crosses", "geos_disjoint", "geos_equals", "geos_equalsexact", "geos_intersects", "geos_intersects", "geos_overlaps", "geos_relatepattern", "geos_touches", "geos_within"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes.predicates import geos_hasz, geos_isempty, \\\n geos_isring, geos_issimple, geos_isvalid, geos_contains, geos_crosses, \\\n geos_disjoint, geos_equals, geos_equalsexact, geos_intersects, \\\n geos_intersects, geos_overlaps, geos_relatepattern, geos_touches, geos_within"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98731:ImportFrom_L30_C0", "label": "from django.contrib.gis.geos.prototypes.topology import *", "type": "import", "loc": [30, 30], "level": 0, "parent": null, "vector": [1, 0, 1.0, 0.0333, 0, 0.66, 1.0, 158, 0, 1, 0, 0, 158, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes.topology", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes.topology import *"}] | [] |
"""
This module houses the GEOS ctypes prototype functions for the
unary and binary predicate operations on geometries.
"""
from ctypes import c_char, c_char_p, c_double
from django.contrib.gis.geos.libgeos import GEOM_PTR
from django.contrib.gis.geos.prototypes.errcheck import check_predicate
from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc
## Binary & unary predicate functions ##
def binary_predicate(func, *args):
"For GEOS binary predicate functions."
argtypes = [GEOM_PTR, GEOM_PTR]
if args: argtypes += args
func.argtypes = argtypes
func.restype = c_char
func.errcheck = check_predicate
return func
def unary_predicate(func):
"For GEOS unary predicate functions."
func.argtypes = [GEOM_PTR]
func.restype = c_char
func.errcheck = check_predicate
return func
## Unary Predicates ##
geos_hasz = unary_predicate(GEOSFunc('GEOSHasZ'))
geos_isempty = unary_predicate(GEOSFunc('GEOSisEmpty'))
geos_isring = unary_predicate(GEOSFunc('GEOSisRing'))
geos_issimple = unary_predicate(GEOSFunc('GEOSisSimple'))
geos_isvalid = unary_predicate(GEOSFunc('GEOSisValid'))
## Binary Predicates ##
geos_contains = binary_predicate(GEOSFunc('GEOSContains'))
geos_crosses = binary_predicate(GEOSFunc('GEOSCrosses'))
geos_disjoint = binary_predicate(GEOSFunc('GEOSDisjoint'))
geos_equals = binary_predicate(GEOSFunc('GEOSEquals'))
geos_equalsexact = binary_predicate(GEOSFunc('GEOSEqualsExact'), c_double)
geos_intersects = binary_predicate(GEOSFunc('GEOSIntersects'))
geos_overlaps = binary_predicate(GEOSFunc('GEOSOverlaps'))
geos_relatepattern = binary_predicate(GEOSFunc('GEOSRelatePattern'), c_char_p)
geos_touches = binary_predicate(GEOSFunc('GEOSTouches'))
geos_within = binary_predicate(GEOSFunc('GEOSWithin'))
| ajibawa-2023/Python-Code-Large/train/row_98732 | 34 | 44 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0568, 0.0909, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n This module houses the GEOS ctypes prototype functions for the\n unary and binary predicate operations on geometries.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:ImportFrom_L5_C0", "label": "from ctypes import c_char, c_char_p, c_double", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1136, 0.0227, 0, 0.66, 0.0476, 182, 0, 3, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_char", "c_char_p", "c_double"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import c_char, c_char_p, c_double"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:ImportFrom_L6_C0", "label": "from django.contrib.gis.geos.libgeos import GEOM_PTR", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1364, 0.0227, 0, 0.66, 0.0952, 64, 0, 1, 0, 0, 64, 0, 0], "semantic": {"name": "django.contrib.gis.geos.libgeos", "arg_names": [], "import_names": ["GEOM_PTR"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.libgeos import GEOM_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:ImportFrom_L7_C0", "label": "from django.contrib.gis.geos.prototypes.errcheck import check_predicate", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1591, 0.0227, 0, 0.66, 0.1429, 104, 0, 1, 0, 0, 104, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes.errcheck", "arg_names": [], "import_names": ["check_predicate"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes.errcheck import check_predicate"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:ImportFrom_L8_C0", "label": "from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.1818, 0.0227, 0, 0.66, 0.1905, 130, 0, 1, 0, 0, 130, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes.threadsafe", "arg_names": [], "import_names": ["GEOSFunc"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L11_C0", "label": "binary_predicate", "type": "function", "loc": [11, 18], "level": 0, "parent": null, "vector": [2, 0, 0.3295, 0.1818, 0, 0.66, 0.2381, 566, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "binary_predicate", "arg_names": ["func", "args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def binary_predicate(func, *args):\n \"For GEOS binary predicate functions.\"\n argtypes = [GEOM_PTR, GEOM_PTR]\n if args: argtypes += args\n func.argtypes = argtypes\n func.restype = c_char\n func.errcheck = check_predicate\n return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Expr_L12_C4", "label": "expression", "type": "expression", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L11_C0", "vector": [8, 1, 0.2727, 0.0227, 1, 0.16, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"For GEOS binary predicate functions.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L13_C4", "label": "argtypes =", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L11_C0", "vector": [14, 1, 0.2955, 0.0227, 1, 0.16, 0.1667, 105, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " argtypes = [GEOM_PTR, GEOM_PTR]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:If_L14_C4", "label": "if", "type": "if", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L11_C0", "vector": [4, 1, 0.3182, 0.0227, 1, 0.16, 0.3333, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if args: argtypes += args"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L15_C4", "label": "func.argtypes =", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L11_C0", "vector": [14, 1, 0.3409, 0.0227, 1, 0.16, 0.5, 441, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.argtypes = argtypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L16_C4", "label": "func.restype =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L11_C0", "vector": [14, 1, 0.3636, 0.0227, 1, 0.16, 0.6667, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = c_char"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L17_C4", "label": "func.errcheck =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L11_C0", "vector": [14, 1, 0.3864, 0.0227, 1, 0.16, 0.8333, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.errcheck = check_predicate"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Return_L18_C4", "label": "return", "type": "return", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L11_C0", "vector": [13, 1, 0.4091, 0.0227, 1, 0.16, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L20_C0", "label": "unary_predicate", "type": "function", "loc": [20, 25], "level": 0, "parent": null, "vector": [2, 0, 0.5114, 0.1364, 0, 0.66, 0.2857, 293, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "unary_predicate", "arg_names": ["func"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def unary_predicate(func):\n \"For GEOS unary predicate functions.\"\n func.argtypes = [GEOM_PTR]\n func.restype = c_char\n func.errcheck = check_predicate\n return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Expr_L21_C4", "label": "expression", "type": "expression", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L20_C0", "vector": [8, 1, 0.4773, 0.0227, 1, 0.64, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"For GEOS unary predicate functions.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L22_C4", "label": "func.argtypes =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L20_C0", "vector": [14, 1, 0.5, 0.0227, 1, 0.64, 0.25, 441, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "func.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.argtypes = [GEOM_PTR]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L23_C4", "label": "func.restype =", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L20_C0", "vector": [14, 1, 0.5227, 0.0227, 1, 0.64, 0.5, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.restype = c_char"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L24_C4", "label": "func.errcheck =", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L20_C0", "vector": [14, 1, 0.5455, 0.0227, 1, 0.64, 0.75, 212, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func.errcheck", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.errcheck = check_predicate"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Return_L25_C4", "label": "return", "type": "return", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L20_C0", "vector": [13, 1, 0.5682, 0.0227, 1, 0.64, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L28_C0", "label": "geos_hasz = unary_predicate()", "type": "assigned_variable", "loc": [28, 28], "level": 0, "parent": null, "vector": [14, 0, 0.6364, 0.0227, 0, 0.66, 0.3333, 351, 3, 1, 0, 0, 293, 10, 2], "semantic": {"name": "geos_hasz", "arg_names": [], "import_names": [], "rhs_call_name": "unary_predicate", "annotation": ""}, "snippet": "geos_hasz = unary_predicate(GEOSFunc('GEOSHasZ'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L29_C0", "label": "geos_isempty = unary_predicate()", "type": "assigned_variable", "loc": [29, 29], "level": 0, "parent": null, "vector": [14, 0, 0.6591, 0.0227, 0, 0.66, 0.381, 585, 3, 1, 0, 0, 293, 10, 2], "semantic": {"name": "geos_isempty", "arg_names": [], "import_names": [], "rhs_call_name": "unary_predicate", "annotation": ""}, "snippet": "geos_isempty = unary_predicate(GEOSFunc('GEOSisEmpty'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L30_C0", "label": "geos_isring = unary_predicate()", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.6818, 0.0227, 0, 0.66, 0.4286, 802, 3, 1, 0, 0, 293, 10, 2], "semantic": {"name": "geos_isring", "arg_names": [], "import_names": [], "rhs_call_name": "unary_predicate", "annotation": ""}, "snippet": "geos_isring = unary_predicate(GEOSFunc('GEOSisRing'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L31_C0", "label": "geos_issimple = unary_predicate()", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.7045, 0.0227, 0, 0.66, 0.4762, 346, 3, 1, 0, 0, 293, 10, 2], "semantic": {"name": "geos_issimple", "arg_names": [], "import_names": [], "rhs_call_name": "unary_predicate", "annotation": ""}, "snippet": "geos_issimple = unary_predicate(GEOSFunc('GEOSisSimple'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L32_C0", "label": "geos_isvalid = unary_predicate()", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.7273, 0.0227, 0, 0.66, 0.5238, 492, 3, 1, 0, 0, 293, 10, 2], "semantic": {"name": "geos_isvalid", "arg_names": [], "import_names": [], "rhs_call_name": "unary_predicate", "annotation": ""}, "snippet": "geos_isvalid = unary_predicate(GEOSFunc('GEOSisValid'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L35_C0", "label": "geos_contains = binary_predicate()", "type": "assigned_variable", "loc": [35, 35], "level": 0, "parent": null, "vector": [14, 0, 0.7955, 0.0227, 0, 0.66, 0.5714, 584, 3, 1, 0, 0, 566, 10, 2], "semantic": {"name": "geos_contains", "arg_names": [], "import_names": [], "rhs_call_name": "binary_predicate", "annotation": ""}, "snippet": "geos_contains = binary_predicate(GEOSFunc('GEOSContains'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L36_C0", "label": "geos_crosses = binary_predicate()", "type": "assigned_variable", "loc": [36, 36], "level": 0, "parent": null, "vector": [14, 0, 0.8182, 0.0227, 0, 0.66, 0.619, 297, 3, 1, 0, 0, 566, 10, 2], "semantic": {"name": "geos_crosses", "arg_names": [], "import_names": [], "rhs_call_name": "binary_predicate", "annotation": ""}, "snippet": "geos_crosses = binary_predicate(GEOSFunc('GEOSCrosses'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L37_C0", "label": "geos_disjoint = binary_predicate()", "type": "assigned_variable", "loc": [37, 37], "level": 0, "parent": null, "vector": [14, 0, 0.8409, 0.0227, 0, 0.66, 0.6667, 684, 3, 1, 0, 0, 566, 10, 2], "semantic": {"name": "geos_disjoint", "arg_names": [], "import_names": [], "rhs_call_name": "binary_predicate", "annotation": ""}, "snippet": "geos_disjoint = binary_predicate(GEOSFunc('GEOSDisjoint'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L38_C0", "label": "geos_equals = binary_predicate()", "type": "assigned_variable", "loc": [38, 38], "level": 0, "parent": null, "vector": [14, 0, 0.8636, 0.0227, 0, 0.66, 0.7143, 784, 3, 1, 0, 0, 566, 10, 2], "semantic": {"name": "geos_equals", "arg_names": [], "import_names": [], "rhs_call_name": "binary_predicate", "annotation": ""}, "snippet": "geos_equals = binary_predicate(GEOSFunc('GEOSEquals'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L39_C0", "label": "geos_equalsexact = binary_predicate()", "type": "assigned_variable", "loc": [39, 39], "level": 0, "parent": null, "vector": [14, 0, 0.8864, 0.0227, 0, 0.66, 0.7619, 791, 3, 2, 0, 0, 566, 10, 2], "semantic": {"name": "geos_equalsexact", "arg_names": [], "import_names": [], "rhs_call_name": "binary_predicate", "annotation": ""}, "snippet": "geos_equalsexact = binary_predicate(GEOSFunc('GEOSEqualsExact'), c_double)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L40_C0", "label": "geos_intersects = binary_predicate()", "type": "assigned_variable", "loc": [40, 40], "level": 0, "parent": null, "vector": [14, 0, 0.9091, 0.0227, 0, 0.66, 0.8095, 749, 3, 1, 0, 0, 566, 10, 2], "semantic": {"name": "geos_intersects", "arg_names": [], "import_names": [], "rhs_call_name": "binary_predicate", "annotation": ""}, "snippet": "geos_intersects = binary_predicate(GEOSFunc('GEOSIntersects'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L41_C0", "label": "geos_overlaps = binary_predicate()", "type": "assigned_variable", "loc": [41, 41], "level": 0, "parent": null, "vector": [14, 0, 0.9318, 0.0227, 0, 0.66, 0.8571, 921, 3, 1, 0, 0, 566, 10, 2], "semantic": {"name": "geos_overlaps", "arg_names": [], "import_names": [], "rhs_call_name": "binary_predicate", "annotation": ""}, "snippet": "geos_overlaps = binary_predicate(GEOSFunc('GEOSOverlaps'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L42_C0", "label": "geos_relatepattern = binary_predicate()", "type": "assigned_variable", "loc": [42, 42], "level": 0, "parent": null, "vector": [14, 0, 0.9545, 0.0227, 0, 0.66, 0.9048, 731, 3, 2, 0, 0, 566, 10, 2], "semantic": {"name": "geos_relatepattern", "arg_names": [], "import_names": [], "rhs_call_name": "binary_predicate", "annotation": ""}, "snippet": "geos_relatepattern = binary_predicate(GEOSFunc('GEOSRelatePattern'), c_char_p)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L43_C0", "label": "geos_touches = binary_predicate()", "type": "assigned_variable", "loc": [43, 43], "level": 0, "parent": null, "vector": [14, 0, 0.9773, 0.0227, 0, 0.66, 0.9524, 275, 3, 1, 0, 0, 566, 10, 2], "semantic": {"name": "geos_touches", "arg_names": [], "import_names": [], "rhs_call_name": "binary_predicate", "annotation": ""}, "snippet": "geos_touches = binary_predicate(GEOSFunc('GEOSTouches'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L44_C0", "label": "geos_within = binary_predicate()", "type": "assigned_variable", "loc": [44, 44], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.0227, 0, 0.66, 1.0, 497, 3, 1, 0, 0, 566, 10, 2], "semantic": {"name": "geos_within", "arg_names": [], "import_names": [], "rhs_call_name": "binary_predicate", "annotation": ""}, "snippet": "geos_within = binary_predicate(GEOSFunc('GEOSWithin'))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98732:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98732:If_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98732:Return_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98732:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98732:Return_L25_C4"}] |
# Copyright (c) 2008-2009 Aryeh Leib Taurog, all rights reserved.
# Released under the New BSD license.
"""
This module contains a base type which provides list-style mutations
without specific data storage methods.
See also http://www.aryehleib.com/MutableLists.html
Author: Aryeh Leib Taurog.
"""
class ListMixin(object):
"""
A base class which provides complete list interface.
Derived classes must call ListMixin's __init__() function
and implement the following:
function _get_single_external(self, i):
Return single item with index i for general use.
The index i will always satisfy 0 <= i < len(self).
function _get_single_internal(self, i):
Same as above, but for use within the class [Optional]
Note that if _get_single_internal and _get_single_internal return
different types of objects, _set_list must distinguish
between the two and handle each appropriately.
function _set_list(self, length, items):
Recreate the entire object.
NOTE: items may be a generator which calls _get_single_internal.
Therefore, it is necessary to cache the values in a temporary:
temp = list(items)
before clobbering the original storage.
function _set_single(self, i, value):
Set the single item at index i to value [Optional]
If left undefined, all mutations will result in rebuilding
the object using _set_list.
function __len__(self):
Return the length
int _minlength:
The minimum legal length [Optional]
int _maxlength:
The maximum legal length [Optional]
type or tuple _allowed:
A type or tuple of allowed item types [Optional]
class _IndexError:
The type of exception to be raise on invalid index [Optional]
"""
_minlength = 0
_maxlength = None
_IndexError = IndexError
### Python initialization and special list interface methods ###
def __init__(self, *args, **kwargs):
if not hasattr(self, '_get_single_internal'):
self._get_single_internal = self._get_single_external
if not hasattr(self, '_set_single'):
self._set_single = self._set_single_rebuild
self._assign_extended_slice = self._assign_extended_slice_rebuild
super(ListMixin, self).__init__(*args, **kwargs)
def __getitem__(self, index):
"Get the item(s) at the specified index/slice."
if isinstance(index, slice):
return [self._get_single_external(i) for i in xrange(*index.indices(len(self)))]
else:
index = self._checkindex(index)
return self._get_single_external(index)
def __delitem__(self, index):
"Delete the item(s) at the specified index/slice."
if not isinstance(index, (int, long, slice)):
raise TypeError("%s is not a legal index" % index)
# calculate new length and dimensions
origLen = len(self)
if isinstance(index, (int, long)):
index = self._checkindex(index)
indexRange = [index]
else:
indexRange = range(*index.indices(origLen))
newLen = origLen - len(indexRange)
newItems = ( self._get_single_internal(i)
for i in xrange(origLen)
if i not in indexRange )
self._rebuild(newLen, newItems)
def __setitem__(self, index, val):
"Set the item(s) at the specified index/slice."
if isinstance(index, slice):
self._set_slice(index, val)
else:
index = self._checkindex(index)
self._check_allowed((val,))
self._set_single(index, val)
def __iter__(self):
"Iterate over the items in the list"
for i in xrange(len(self)):
yield self[i]
### Special methods for arithmetic operations ###
def __add__(self, other):
'add another list-like object'
return self.__class__(list(self) + list(other))
def __radd__(self, other):
'add to another list-like object'
return other.__class__(list(other) + list(self))
def __iadd__(self, other):
'add another list-like object to self'
self.extend(list(other))
return self
def __mul__(self, n):
'multiply'
return self.__class__(list(self) * n)
def __rmul__(self, n):
'multiply'
return self.__class__(list(self) * n)
def __imul__(self, n):
'multiply'
if n <= 0:
del self[:]
else:
cache = list(self)
for i in range(n-1):
self.extend(cache)
return self
def __cmp__(self, other):
'cmp'
slen = len(self)
for i in range(slen):
try:
c = cmp(self[i], other[i])
except IndexError:
# must be other is shorter
return 1
else:
# elements not equal
if c: return c
return cmp(slen, len(other))
### Public list interface Methods ###
## Non-mutating ##
def count(self, val):
"Standard list count method"
count = 0
for i in self:
if val == i: count += 1
return count
def index(self, val):
"Standard list index method"
for i in xrange(0, len(self)):
if self[i] == val: return i
raise ValueError('%s not found in object' % str(val))
## Mutating ##
def append(self, val):
"Standard list append method"
self[len(self):] = [val]
def extend(self, vals):
"Standard list extend method"
self[len(self):] = vals
def insert(self, index, val):
"Standard list insert method"
if not isinstance(index, (int, long)):
raise TypeError("%s is not a legal index" % index)
self[index:index] = [val]
def pop(self, index=-1):
"Standard list pop method"
result = self[index]
del self[index]
return result
def remove(self, val):
"Standard list remove method"
del self[self.index(val)]
def reverse(self):
"Standard list reverse method"
self[:] = self[-1::-1]
def sort(self, cmp=cmp, key=None, reverse=False):
"Standard list sort method"
if key:
temp = [(key(v),v) for v in self]
temp.sort(cmp=cmp, key=lambda x: x[0], reverse=reverse)
self[:] = [v[1] for v in temp]
else:
temp = list(self)
temp.sort(cmp=cmp, reverse=reverse)
self[:] = temp
### Private routines ###
def _rebuild(self, newLen, newItems):
if newLen < self._minlength:
raise ValueError('Must have at least %d items' % self._minlength)
if self._maxlength is not None and newLen > self._maxlength:
raise ValueError('Cannot have more than %d items' % self._maxlength)
self._set_list(newLen, newItems)
def _set_single_rebuild(self, index, value):
self._set_slice(slice(index, index + 1, 1), [value])
def _checkindex(self, index, correct=True):
length = len(self)
if 0 <= index < length:
return index
if correct and -length <= index < 0:
return index + length
raise self._IndexError('invalid index: %s' % str(index))
def _check_allowed(self, items):
if hasattr(self, '_allowed'):
if False in [isinstance(val, self._allowed) for val in items]:
raise TypeError('Invalid type encountered in the arguments.')
def _set_slice(self, index, values):
"Assign values to a slice of the object"
try:
iter(values)
except TypeError:
raise TypeError('can only assign an iterable to a slice')
self._check_allowed(values)
origLen = len(self)
valueList = list(values)
start, stop, step = index.indices(origLen)
# CAREFUL: index.step and step are not the same!
# step will never be None
if index.step is None:
self._assign_simple_slice(start, stop, valueList)
else:
self._assign_extended_slice(start, stop, step, valueList)
def _assign_extended_slice_rebuild(self, start, stop, step, valueList):
'Assign an extended slice by rebuilding entire list'
indexList = range(start, stop, step)
# extended slice, only allow assigning slice of same size
if len(valueList) != len(indexList):
raise ValueError('attempt to assign sequence of size %d '
'to extended slice of size %d'
% (len(valueList), len(indexList)))
# we're not changing the length of the sequence
newLen = len(self)
newVals = dict(zip(indexList, valueList))
def newItems():
for i in xrange(newLen):
if i in newVals:
yield newVals[i]
else:
yield self._get_single_internal(i)
self._rebuild(newLen, newItems())
def _assign_extended_slice(self, start, stop, step, valueList):
'Assign an extended slice by re-assigning individual items'
indexList = range(start, stop, step)
# extended slice, only allow assigning slice of same size
if len(valueList) != len(indexList):
raise ValueError('attempt to assign sequence of size %d '
'to extended slice of size %d'
% (len(valueList), len(indexList)))
for i, val in zip(indexList, valueList):
self._set_single(i, val)
def _assign_simple_slice(self, start, stop, valueList):
'Assign a simple slice; Can assign slice of any length'
origLen = len(self)
stop = max(start, stop)
newLen = origLen - stop + start + len(valueList)
def newItems():
for i in xrange(origLen + 1):
if i == start:
for val in valueList:
yield val
if i < origLen:
if i < start or i >= stop:
yield self._get_single_internal(i)
self._rebuild(newLen, newItems())
| ajibawa-2023/Python-Code-Large/train/row_98733 | 171 | 309 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L3_C0", "label": "expression", "type": "expression", "loc": [3, 10], "level": 0, "parent": null, "vector": [8, 0, 0.021, 0.0259, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis module contains a base type which provides list-style mutations\nwithout specific data storage methods.\n\nSee also http://www.aryehleib.com/MutableLists.html\n\nAuthor: Aryeh Leib Taurog.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "label": "ListMixin", "type": "class", "loc": [11, 309], "level": 0, "parent": null, "vector": [3, 0, 0.5178, 0.9676, 0, 0.66, 1.0, 514, 0, 31, 0, 0, 186, 0, 99], "semantic": {"name": "ListMixin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ListMixin(object):\n \"\"\"\n A base class which provides complete list interface.\n Derived classes must call ListMixin's __init__() function\n and implement the following:\n\n function _get_single_external(self, i):\n Return single item with index i for general use."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L12_C4", "label": "expression", "type": "expression", "loc": [12, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [8, 1, 0.1068, 0.1392, 1, 0.4, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n A base class which provides complete list interface.\n Derived classes must call ListMixin's __init__() function\n and implement the following:\n\n function _get_single_external(self, i):\n Return single item with index i for general use.\n The index i will always satisfy 0 <= i < len(self)."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L56_C4", "label": "_minlength =", "type": "assigned_variable", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [14, 1, 0.1812, 0.0032, 1, 0.4, 0.0312, 990, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "_minlength", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _minlength = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L57_C4", "label": "_maxlength =", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [14, 1, 0.1845, 0.0032, 1, 0.4, 0.0625, 385, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "_maxlength", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _maxlength = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L58_C4", "label": "_IndexError =", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [14, 1, 0.1877, 0.0032, 1, 0.4, 0.0938, 868, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_IndexError", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _IndexError = IndexError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L62_C4", "label": "__init__", "type": "function", "loc": [62, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.2136, 0.0291, 1, 0.4, 0.125, 555, 0, 3, 0, 0, 0, 0, 4], "semantic": {"name": "__init__", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, *args, **kwargs):\n if not hasattr(self, '_get_single_internal'):\n self._get_single_internal = self._get_single_external\n\n if not hasattr(self, '_set_single'):\n self._set_single = self._set_single_rebuild\n self._assign_extended_slice = self._assign_extended_slice_rebuild\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L63_C8", "label": "if", "type": "if", "loc": [63, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L62_C4", "vector": [4, 2, 0.2055, 0.0065, 2, 0.82, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not hasattr(self, '_get_single_internal'):\n self._get_single_internal = self._get_single_external"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L64_C12", "label": "self._get_single_internal =", "type": "assigned_variable", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L63_C8", "vector": [14, 3, 0.2071, 0.0032, 3, 0.24, 0.0, 321, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._get_single_internal", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._get_single_internal = self._get_single_external"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L66_C8", "label": "if", "type": "if", "loc": [66, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L62_C4", "vector": [4, 2, 0.2168, 0.0097, 2, 0.82, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not hasattr(self, '_set_single'):\n self._set_single = self._set_single_rebuild\n self._assign_extended_slice = self._assign_extended_slice_rebuild"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L67_C12", "label": "self._set_single =", "type": "assigned_variable", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L66_C8", "vector": [14, 3, 0.2168, 0.0032, 3, 0.9, 0.0, 110, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._set_single", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._set_single = self._set_single_rebuild"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L68_C12", "label": "self._assign_extended_slice =", "type": "assigned_variable", "loc": [68, 68], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L66_C8", "vector": [14, 3, 0.2201, 0.0032, 3, 0.9, 1.0, 420, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._assign_extended_slice", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._assign_extended_slice = self._assign_extended_slice_rebuild"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L70_C8", "label": "__init__()", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L62_C4", "vector": [8, 2, 0.2265, 0.0032, 2, 0.82, 1.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(ListMixin, self).__init__(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L72_C4", "label": "__getitem__", "type": "function", "loc": [72, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.2427, 0.0227, 1, 0.4, 0.1562, 698, 0, 2, 1, 0, 0, 0, 7], "semantic": {"name": "__getitem__", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getitem__(self, index):\n \"Get the item(s) at the specified index/slice.\"\n if isinstance(index, slice):\n return [self._get_single_external(i) for i in xrange(*index.indices(len(self)))]\n else:\n index = self._checkindex(index)\n return self._get_single_external(index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L73_C8", "label": "expression", "type": "expression", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L72_C4", "vector": [8, 2, 0.2362, 0.0032, 2, 0.26, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Get the item(s) at the specified index/slice.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L74_C8", "label": "if", "type": "if", "loc": [74, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L72_C4", "vector": [4, 2, 0.246, 0.0162, 2, 0.26, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(index, slice):\n return [self._get_single_external(i) for i in xrange(*index.indices(len(self)))]\n else:\n index = self._checkindex(index)\n return self._get_single_external(index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L75_C12", "label": "return", "type": "return", "loc": [75, 75], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L74_C8", "vector": [13, 3, 0.2427, 0.0032, 3, 0.28, 0.0, 0, 5, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [self._get_single_external(i) for i in xrange(*index.indices(len(self)))]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L77_C12", "label": "index = _checkindex()", "type": "assigned_variable", "loc": [77, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L74_C8", "vector": [14, 3, 0.2492, 0.0032, 3, 0.28, 0.5, 780, 3, 1, 0, 0, 679, 10, 1], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "_checkindex", "annotation": ""}, "snippet": " index = self._checkindex(index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L78_C12", "label": "return", "type": "return", "loc": [78, 78], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L74_C8", "vector": [13, 3, 0.2524, 0.0032, 3, 0.28, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._get_single_external(index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L80_C4", "label": "__delitem__", "type": "function", "loc": [80, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.288, 0.0615, 1, 0.4, 0.1875, 66, 0, 2, 0, 0, 0, 0, 11], "semantic": {"name": "__delitem__", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __delitem__(self, index):\n \"Delete the item(s) at the specified index/slice.\"\n if not isinstance(index, (int, long, slice)):\n raise TypeError(\"%s is not a legal index\" % index)\n\n # calculate new length and dimensions\n origLen = len(self)\n if isinstance(index, (int, long)):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L81_C8", "label": "expression", "type": "expression", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L80_C4", "vector": [8, 2, 0.2621, 0.0032, 2, 0.4, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Delete the item(s) at the specified index/slice.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L82_C8", "label": "if", "type": "if", "loc": [82, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L80_C4", "vector": [4, 2, 0.267, 0.0065, 2, 0.4, 0.1667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(index, (int, long, slice)):\n raise TypeError(\"%s is not a legal index\" % index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L86_C8", "label": "origLen = len()", "type": "assigned_variable", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L80_C4", "vector": [14, 2, 0.2783, 0.0032, 2, 0.4, 0.3333, 165, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "origLen", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " origLen = len(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L87_C8", "label": "if", "type": "if", "loc": [87, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L80_C4", "vector": [4, 2, 0.288, 0.0162, 2, 0.4, 0.5, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(index, (int, long)):\n index = self._checkindex(index)\n indexRange = [index]\n else:\n indexRange = range(*index.indices(origLen))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L88_C12", "label": "index = _checkindex()", "type": "assigned_variable", "loc": [88, 88], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L87_C8", "vector": [14, 3, 0.2848, 0.0032, 3, 0.2, 0.0, 780, 3, 1, 0, 0, 679, 10, 1], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "_checkindex", "annotation": ""}, "snippet": " index = self._checkindex(index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L89_C12", "label": "indexRange =", "type": "assigned_variable", "loc": [89, 89], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L87_C8", "vector": [14, 3, 0.288, 0.0032, 3, 0.2, 0.5, 787, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "indexRange", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " indexRange = [index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L91_C12", "label": "indexRange = range()", "type": "assigned_variable", "loc": [91, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L87_C8", "vector": [14, 3, 0.2945, 0.0032, 3, 0.2, 1.0, 787, 3, 1, 0, 0, 816, 10, 2], "semantic": {"name": "indexRange", "arg_names": [], "import_names": [], "rhs_call_name": "range", "annotation": ""}, "snippet": " indexRange = range(*index.indices(origLen))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L93_C8", "label": "newLen =", "type": "assigned_variable", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L80_C4", "vector": [14, 2, 0.301, 0.0032, 2, 0.4, 0.6667, 689, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "newLen", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newLen = origLen - len(indexRange)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L94_C8", "label": "newItems =", "type": "assigned_variable", "loc": [94, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L80_C4", "vector": [14, 2, 0.3074, 0.0097, 2, 0.4, 0.8333, 41, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "newItems", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newItems = ( self._get_single_internal(i)\n for i in xrange(origLen)\n if i not in indexRange )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L98_C8", "label": "_rebuild()", "type": "expression", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L80_C4", "vector": [8, 2, 0.3172, 0.0032, 2, 0.4, 1.0, 567, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_rebuild", "arg_names": [], "import_names": [], "rhs_call_name": "_rebuild", "annotation": ""}, "snippet": " self._rebuild(newLen, newItems)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L100_C4", "label": "__setitem__", "type": "function", "loc": [100, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.335, 0.0259, 1, 0.4, 0.2188, 343, 0, 3, 0, 0, 0, 0, 5], "semantic": {"name": "__setitem__", "arg_names": ["self", "index", "val"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __setitem__(self, index, val):\n \"Set the item(s) at the specified index/slice.\"\n if isinstance(index, slice):\n self._set_slice(index, val)\n else:\n index = self._checkindex(index)\n self._check_allowed((val,))\n self._set_single(index, val)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L101_C8", "label": "expression", "type": "expression", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L100_C4", "vector": [8, 2, 0.3269, 0.0032, 2, 0.99, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Set the item(s) at the specified index/slice.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L102_C8", "label": "if", "type": "if", "loc": [102, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L100_C4", "vector": [4, 2, 0.3382, 0.0194, 2, 0.99, 1.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(index, slice):\n self._set_slice(index, val)\n else:\n index = self._checkindex(index)\n self._check_allowed((val,))\n self._set_single(index, val)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L103_C12", "label": "_set_slice()", "type": "expression", "loc": [103, 103], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L102_C8", "vector": [8, 3, 0.3333, 0.0032, 3, 0.71, 0.0, 536, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_set_slice", "arg_names": [], "import_names": [], "rhs_call_name": "_set_slice", "annotation": ""}, "snippet": " self._set_slice(index, val)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L105_C12", "label": "index = _checkindex()", "type": "assigned_variable", "loc": [105, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L102_C8", "vector": [14, 3, 0.3398, 0.0032, 3, 0.71, 0.3333, 780, 3, 1, 0, 0, 679, 10, 1], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "_checkindex", "annotation": ""}, "snippet": " index = self._checkindex(index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L106_C12", "label": "_check_allowed()", "type": "expression", "loc": [106, 106], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L102_C8", "vector": [8, 3, 0.343, 0.0032, 3, 0.71, 0.6667, 582, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_check_allowed", "arg_names": [], "import_names": [], "rhs_call_name": "_check_allowed", "annotation": ""}, "snippet": " self._check_allowed((val,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L107_C12", "label": "_set_single()", "type": "expression", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L102_C8", "vector": [8, 3, 0.3463, 0.0032, 3, 0.71, 1.0, 950, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_set_single", "arg_names": [], "import_names": [], "rhs_call_name": "_set_single", "annotation": ""}, "snippet": " self._set_single(index, val)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L109_C4", "label": "__iter__", "type": "function", "loc": [109, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.3576, 0.0129, 1, 0.4, 0.25, 891, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n \"Iterate over the items in the list\"\n for i in xrange(len(self)):\n yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L110_C8", "label": "expression", "type": "expression", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L109_C4", "vector": [8, 2, 0.356, 0.0032, 2, 0.61, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Iterate over the items in the list\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L111_C8", "label": "for i", "type": "for", "loc": [111, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L109_C4", "vector": [6, 2, 0.3608, 0.0065, 2, 0.61, 1.0, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange(len(self)):\n yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L112_C12", "label": "expression", "type": "expression", "loc": [112, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L111_C8", "vector": [8, 3, 0.3625, 0.0032, 3, 0.12, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L115_C4", "label": "__add__", "type": "function", "loc": [115, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.3754, 0.0097, 1, 0.4, 0.2812, 899, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "__add__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __add__(self, other):\n 'add another list-like object'\n return self.__class__(list(self) + list(other))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L116_C8", "label": "expression", "type": "expression", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L115_C4", "vector": [8, 2, 0.3754, 0.0032, 2, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " 'add another list-like object'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L117_C8", "label": "return", "type": "return", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L115_C4", "vector": [13, 2, 0.3786, 0.0032, 2, 0.75, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.__class__(list(self) + list(other))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L119_C4", "label": "__radd__", "type": "function", "loc": [119, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.3883, 0.0097, 1, 0.4, 0.3125, 241, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "__radd__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __radd__(self, other):\n 'add to another list-like object'\n return other.__class__(list(other) + list(self))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L120_C8", "label": "expression", "type": "expression", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L119_C4", "vector": [8, 2, 0.3883, 0.0032, 2, 0.92, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " 'add to another list-like object'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L121_C8", "label": "return", "type": "return", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L119_C4", "vector": [13, 2, 0.3916, 0.0032, 2, 0.92, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return other.__class__(list(other) + list(self))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L123_C4", "label": "__iadd__", "type": "function", "loc": [123, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.4029, 0.0129, 1, 0.4, 0.3438, 944, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__iadd__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iadd__(self, other):\n 'add another list-like object to self'\n self.extend(list(other))\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L124_C8", "label": "expression", "type": "expression", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L123_C4", "vector": [8, 2, 0.4013, 0.0032, 2, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " 'add another list-like object to self'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L125_C8", "label": "extend()", "type": "expression", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L123_C4", "vector": [8, 2, 0.4045, 0.0032, 2, 0.67, 0.5, 660, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " self.extend(list(other))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L126_C8", "label": "return", "type": "return", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L123_C4", "vector": [13, 2, 0.4078, 0.0032, 2, 0.67, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L128_C4", "label": "__mul__", "type": "function", "loc": [128, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.4175, 0.0097, 1, 0.4, 0.375, 215, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__mul__", "arg_names": ["self", "n"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __mul__(self, n):\n 'multiply'\n return self.__class__(list(self) * n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L129_C8", "label": "expression", "type": "expression", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L128_C4", "vector": [8, 2, 0.4175, 0.0032, 2, 0.1, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " 'multiply'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L130_C8", "label": "return", "type": "return", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L128_C4", "vector": [13, 2, 0.4207, 0.0032, 2, 0.1, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.__class__(list(self) * n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L132_C4", "label": "__rmul__", "type": "function", "loc": [132, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.4304, 0.0097, 1, 0.4, 0.4062, 612, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__rmul__", "arg_names": ["self", "n"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __rmul__(self, n):\n 'multiply'\n return self.__class__(list(self) * n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L133_C8", "label": "expression", "type": "expression", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L132_C4", "vector": [8, 2, 0.4304, 0.0032, 2, 0.1, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " 'multiply'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L134_C8", "label": "return", "type": "return", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L132_C4", "vector": [13, 2, 0.4337, 0.0032, 2, 0.1, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.__class__(list(self) * n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L136_C4", "label": "__imul__", "type": "function", "loc": [136, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.4531, 0.0291, 1, 0.4, 0.4375, 845, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "__imul__", "arg_names": ["self", "n"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __imul__(self, n):\n 'multiply'\n if n <= 0:\n del self[:]\n else:\n cache = list(self)\n for i in range(n-1):\n self.extend(cache)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L137_C8", "label": "expression", "type": "expression", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L136_C4", "vector": [8, 2, 0.4434, 0.0032, 2, 0.22, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " 'multiply'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L138_C8", "label": "if", "type": "if", "loc": [138, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L136_C4", "vector": [4, 2, 0.4547, 0.0194, 2, 0.22, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if n <= 0:\n del self[:]\n else:\n cache = list(self)\n for i in range(n-1):\n self.extend(cache)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L141_C12", "label": "cache = list()", "type": "assigned_variable", "loc": [141, 141], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L138_C8", "vector": [14, 3, 0.4563, 0.0032, 3, 0.83, 0.0, 419, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "cache", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " cache = list(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L142_C12", "label": "for i", "type": "for", "loc": [142, 143], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L138_C8", "vector": [6, 3, 0.4612, 0.0065, 3, 0.83, 1.0, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(n-1):\n self.extend(cache)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L143_C16", "label": "extend()", "type": "expression", "loc": [143, 143], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L142_C12", "vector": [8, 4, 0.4628, 0.0032, 4, 0.57, 0.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " self.extend(cache)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L144_C8", "label": "return", "type": "return", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L136_C4", "vector": [13, 2, 0.466, 0.0032, 2, 0.22, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L146_C4", "label": "__cmp__", "type": "function", "loc": [146, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.4935, 0.0453, 1, 0.4, 0.4688, 271, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "__cmp__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __cmp__(self, other):\n 'cmp'\n slen = len(self)\n for i in range(slen):\n try:\n c = cmp(self[i], other[i])\n except IndexError:\n # must be other is shorter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L147_C8", "label": "expression", "type": "expression", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L146_C4", "vector": [8, 2, 0.4757, 0.0032, 2, 0.48, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " 'cmp'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L148_C8", "label": "slen = len()", "type": "assigned_variable", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L146_C4", "vector": [14, 2, 0.479, 0.0032, 2, 0.48, 0.3333, 617, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "slen", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " slen = len(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L149_C8", "label": "for i", "type": "for", "loc": [149, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L146_C4", "vector": [6, 2, 0.4951, 0.0291, 2, 0.48, 0.6667, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(slen):\n try:\n c = cmp(self[i], other[i])\n except IndexError:\n # must be other is shorter\n return 1\n else:\n # elements not equal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Try_L150_C12", "label": "try", "type": "try", "loc": [150, 157], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L149_C8", "vector": [7, 3, 0.4968, 0.0259, 3, 0.43, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n c = cmp(self[i], other[i])\n except IndexError:\n # must be other is shorter\n return 1\n else:\n # elements not equal\n if c: return c"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L151_C16", "label": "c = cmp()", "type": "assigned_variable", "loc": [151, 151], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:Try_L150_C12", "vector": [14, 4, 0.4887, 0.0032, 4, 0.35, 0.0, 411, 3, 2, 0, 0, 275, 10, 1], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "cmp", "annotation": ""}, "snippet": " c = cmp(self[i], other[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L154_C16", "label": "return", "type": "return", "loc": [154, 154], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:Try_L150_C12", "vector": [13, 4, 0.4984, 0.0032, 4, 0.35, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L157_C16", "label": "if", "type": "if", "loc": [157, 157], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:Try_L150_C12", "vector": [4, 4, 0.5081, 0.0032, 4, 0.35, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if c: return c"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L157_C22", "label": "return", "type": "return", "loc": [157, 157], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L157_C16", "vector": [13, 5, 0.5081, 0.0032, 5, 0.19, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if c: return c"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L159_C8", "label": "return", "type": "return", "loc": [159, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L146_C4", "vector": [13, 2, 0.5146, 0.0032, 2, 0.48, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return cmp(slen, len(other))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L163_C4", "label": "count", "type": "function", "loc": [163, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.5356, 0.0194, 1, 0.4, 0.5, 778, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "count", "arg_names": ["self", "val"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def count(self, val):\n \"Standard list count method\"\n count = 0\n for i in self:\n if val == i: count += 1\n return count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L164_C8", "label": "expression", "type": "expression", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L163_C4", "vector": [8, 2, 0.5307, 0.0032, 2, 0.22, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Standard list count method\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L165_C8", "label": "count =", "type": "assigned_variable", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L163_C4", "vector": [14, 2, 0.534, 0.0032, 2, 0.22, 0.3333, 778, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L166_C8", "label": "for i", "type": "for", "loc": [166, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L163_C4", "vector": [6, 2, 0.5388, 0.0065, 2, 0.22, 0.6667, 826, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in self:\n if val == i: count += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L167_C12", "label": "if", "type": "if", "loc": [167, 167], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L166_C8", "vector": [4, 3, 0.5405, 0.0032, 3, 0.03, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if val == i: count += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L168_C8", "label": "return", "type": "return", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L163_C4", "vector": [13, 2, 0.5437, 0.0032, 2, 0.22, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L170_C4", "label": "index", "type": "function", "loc": [170, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.5566, 0.0162, 1, 0.4, 0.5312, 780, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "index", "arg_names": ["self", "val"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def index(self, val):\n \"Standard list index method\"\n for i in xrange(0, len(self)):\n if self[i] == val: return i\n raise ValueError('%s not found in object' % str(val))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L171_C8", "label": "expression", "type": "expression", "loc": [171, 171], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L170_C4", "vector": [8, 2, 0.5534, 0.0032, 2, 0.47, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Standard list index method\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L172_C8", "label": "for i", "type": "for", "loc": [172, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L170_C4", "vector": [6, 2, 0.5583, 0.0065, 2, 0.47, 1.0, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange(0, len(self)):\n if self[i] == val: return i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L173_C12", "label": "if", "type": "if", "loc": [173, 173], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L172_C8", "vector": [4, 3, 0.5599, 0.0032, 3, 0.75, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self[i] == val: return i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L173_C31", "label": "return", "type": "return", "loc": [173, 173], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L173_C12", "vector": [13, 4, 0.5599, 0.0032, 4, 0.01, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self[i] == val: return i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L177_C4", "label": "append", "type": "function", "loc": [177, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.5761, 0.0097, 1, 0.4, 0.5625, 243, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": ["self", "val"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def append(self, val):\n \"Standard list append method\"\n self[len(self):] = [val]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L178_C8", "label": "expression", "type": "expression", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L177_C4", "vector": [8, 2, 0.5761, 0.0032, 2, 0.21, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Standard list append method\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L179_C8", "label": "assign", "type": "assigned_variable", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L177_C4", "vector": [14, 2, 0.5793, 0.0032, 2, 0.21, 1.0, 0, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self[len(self):] = [val]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L181_C4", "label": "extend", "type": "function", "loc": [181, 183], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.589, 0.0097, 1, 0.4, 0.5938, 660, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": ["self", "vals"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def extend(self, vals):\n \"Standard list extend method\"\n self[len(self):] = vals"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L182_C8", "label": "expression", "type": "expression", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L181_C4", "vector": [8, 2, 0.589, 0.0032, 2, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Standard list extend method\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L183_C8", "label": "assign", "type": "assigned_variable", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L181_C4", "vector": [14, 2, 0.5922, 0.0032, 2, 0.66, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self[len(self):] = vals"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L185_C4", "label": "insert", "type": "function", "loc": [185, 189], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.6052, 0.0162, 1, 0.4, 0.625, 368, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "insert", "arg_names": ["self", "index", "val"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def insert(self, index, val):\n \"Standard list insert method\"\n if not isinstance(index, (int, long)):\n raise TypeError(\"%s is not a legal index\" % index)\n self[index:index] = [val]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L186_C8", "label": "expression", "type": "expression", "loc": [186, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L185_C4", "vector": [8, 2, 0.6019, 0.0032, 2, 0.26, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Standard list insert method\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L187_C8", "label": "if", "type": "if", "loc": [187, 188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L185_C4", "vector": [4, 2, 0.6068, 0.0065, 2, 0.26, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(index, (int, long)):\n raise TypeError(\"%s is not a legal index\" % index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L189_C8", "label": "assign", "type": "assigned_variable", "loc": [189, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L185_C4", "vector": [14, 2, 0.6117, 0.0032, 2, 0.26, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self[index:index] = [val]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L191_C4", "label": "pop", "type": "function", "loc": [191, 195], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.6246, 0.0162, 1, 0.4, 0.6562, 969, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "pop", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def pop(self, index=-1):\n \"Standard list pop method\"\n result = self[index]\n del self[index]\n return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L192_C8", "label": "expression", "type": "expression", "loc": [192, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L191_C4", "vector": [8, 2, 0.6214, 0.0032, 2, 0.19, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Standard list pop method\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L193_C8", "label": "result =", "type": "assigned_variable", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L191_C4", "vector": [14, 2, 0.6246, 0.0032, 2, 0.19, 0.5, 51, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " result = self[index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L195_C8", "label": "return", "type": "return", "loc": [195, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L191_C4", "vector": [13, 2, 0.6311, 0.0032, 2, 0.19, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L197_C4", "label": "remove", "type": "function", "loc": [197, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.6408, 0.0097, 1, 0.4, 0.6875, 185, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": ["self", "val"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def remove(self, val):\n \"Standard list remove method\"\n del self[self.index(val)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L198_C8", "label": "expression", "type": "expression", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L197_C4", "vector": [8, 2, 0.6408, 0.0032, 2, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Standard list remove method\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L201_C4", "label": "reverse", "type": "function", "loc": [201, 203], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.6537, 0.0097, 1, 0.4, 0.7188, 109, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "reverse", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def reverse(self):\n \"Standard list reverse method\"\n self[:] = self[-1::-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L202_C8", "label": "expression", "type": "expression", "loc": [202, 202], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L201_C4", "vector": [8, 2, 0.6537, 0.0032, 2, 0.31, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Standard list reverse method\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L203_C8", "label": "assign", "type": "assigned_variable", "loc": [203, 203], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L201_C4", "vector": [14, 2, 0.657, 0.0032, 2, 0.31, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self[:] = self[-1::-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L205_C4", "label": "sort", "type": "function", "loc": [205, 214], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.678, 0.0324, 1, 0.4, 0.75, 489, 0, 4, 0, 0, 0, 0, 4], "semantic": {"name": "sort", "arg_names": ["self", "cmp", "key", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def sort(self, cmp=cmp, key=None, reverse=False):\n \"Standard list sort method\"\n if key:\n temp = [(key(v),v) for v in self]\n temp.sort(cmp=cmp, key=lambda x: x[0], reverse=reverse)\n self[:] = [v[1] for v in temp]\n else:\n temp = list(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L206_C8", "label": "expression", "type": "expression", "loc": [206, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L205_C4", "vector": [8, 2, 0.6667, 0.0032, 2, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Standard list sort method\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L207_C8", "label": "if", "type": "if", "loc": [207, 214], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L205_C4", "vector": [4, 2, 0.6812, 0.0259, 2, 0.66, 1.0, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if key:\n temp = [(key(v),v) for v in self]\n temp.sort(cmp=cmp, key=lambda x: x[0], reverse=reverse)\n self[:] = [v[1] for v in temp]\n else:\n temp = list(self)\n temp.sort(cmp=cmp, reverse=reverse)\n self[:] = temp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L208_C12", "label": "temp =", "type": "assigned_variable", "loc": [208, 208], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L207_C8", "vector": [14, 3, 0.6731, 0.0032, 3, 0.04, 0.0, 915, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "temp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " temp = [(key(v),v) for v in self]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L209_C12", "label": "sort()", "type": "expression", "loc": [209, 209], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L207_C8", "vector": [8, 3, 0.6764, 0.0032, 3, 0.04, 0.2, 489, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " temp.sort(cmp=cmp, key=lambda x: x[0], reverse=reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L210_C12", "label": "assign", "type": "assigned_variable", "loc": [210, 210], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L207_C8", "vector": [14, 3, 0.6796, 0.0032, 3, 0.04, 0.4, 0, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self[:] = [v[1] for v in temp]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L212_C12", "label": "temp = list()", "type": "assigned_variable", "loc": [212, 212], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L207_C8", "vector": [14, 3, 0.6861, 0.0032, 3, 0.04, 0.6, 915, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "temp", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " temp = list(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L213_C12", "label": "sort()", "type": "expression", "loc": [213, 213], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L207_C8", "vector": [8, 3, 0.6893, 0.0032, 3, 0.04, 0.8, 489, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " temp.sort(cmp=cmp, reverse=reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L214_C12", "label": "assign", "type": "assigned_variable", "loc": [214, 214], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L207_C8", "vector": [14, 3, 0.6926, 0.0032, 3, 0.04, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self[:] = temp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L217_C4", "label": "_rebuild", "type": "function", "loc": [217, 223], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.712, 0.0227, 1, 0.4, 0.7812, 567, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "_rebuild", "arg_names": ["self", "newLen", "newItems"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _rebuild(self, newLen, newItems):\n if newLen < self._minlength:\n raise ValueError('Must have at least %d items' % self._minlength)\n if self._maxlength is not None and newLen > self._maxlength:\n raise ValueError('Cannot have more than %d items' % self._maxlength)\n\n self._set_list(newLen, newItems)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L218_C8", "label": "if", "type": "if", "loc": [218, 219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L217_C4", "vector": [4, 2, 0.7071, 0.0065, 2, 0.8, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if newLen < self._minlength:\n raise ValueError('Must have at least %d items' % self._minlength)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L220_C8", "label": "if", "type": "if", "loc": [220, 221], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L217_C4", "vector": [4, 2, 0.7136, 0.0065, 2, 0.8, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._maxlength is not None and newLen > self._maxlength:\n raise ValueError('Cannot have more than %d items' % self._maxlength)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L223_C8", "label": "_set_list()", "type": "expression", "loc": [223, 223], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L217_C4", "vector": [8, 2, 0.7217, 0.0032, 2, 0.8, 1.0, 305, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_set_list", "arg_names": [], "import_names": [], "rhs_call_name": "_set_list", "annotation": ""}, "snippet": " self._set_list(newLen, newItems)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L225_C4", "label": "_set_single_rebuild", "type": "function", "loc": [225, 226], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.7298, 0.0065, 1, 0.4, 0.8125, 173, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "_set_single_rebuild", "arg_names": ["self", "index", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_single_rebuild(self, index, value):\n self._set_slice(slice(index, index + 1, 1), [value])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L226_C8", "label": "_set_slice()", "type": "expression", "loc": [226, 226], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L225_C4", "vector": [8, 2, 0.7314, 0.0032, 2, 0.1, 0.0, 536, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_set_slice", "arg_names": [], "import_names": [], "rhs_call_name": "_set_slice", "annotation": ""}, "snippet": " self._set_slice(slice(index, index + 1, 1), [value])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L228_C4", "label": "_checkindex", "type": "function", "loc": [228, 234], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.7476, 0.0227, 1, 0.4, 0.8438, 679, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "_checkindex", "arg_names": ["self", "index", "correct"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _checkindex(self, index, correct=True):\n length = len(self)\n if 0 <= index < length:\n return index\n if correct and -length <= index < 0:\n return index + length\n raise self._IndexError('invalid index: %s' % str(index))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L229_C8", "label": "length = len()", "type": "assigned_variable", "loc": [229, 229], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L228_C4", "vector": [14, 2, 0.7411, 0.0032, 2, 0.73, 0.0, 221, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "length", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " length = len(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L230_C8", "label": "if", "type": "if", "loc": [230, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L228_C4", "vector": [4, 2, 0.746, 0.0065, 2, 0.73, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 0 <= index < length:\n return index"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L231_C12", "label": "return", "type": "return", "loc": [231, 231], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L230_C8", "vector": [13, 3, 0.7476, 0.0032, 3, 0.63, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return index"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L232_C8", "label": "if", "type": "if", "loc": [232, 233], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L228_C4", "vector": [4, 2, 0.7524, 0.0065, 2, 0.73, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if correct and -length <= index < 0:\n return index + length"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L233_C12", "label": "return", "type": "return", "loc": [233, 233], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L232_C8", "vector": [13, 3, 0.754, 0.0032, 3, 0.31, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return index + length"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L236_C4", "label": "_check_allowed", "type": "function", "loc": [236, 239], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.7686, 0.0129, 1, 0.4, 0.875, 582, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "_check_allowed", "arg_names": ["self", "items"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _check_allowed(self, items):\n if hasattr(self, '_allowed'):\n if False in [isinstance(val, self._allowed) for val in items]:\n raise TypeError('Invalid type encountered in the arguments.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L237_C8", "label": "if", "type": "if", "loc": [237, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L236_C4", "vector": [4, 2, 0.7702, 0.0097, 2, 0.45, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(self, '_allowed'):\n if False in [isinstance(val, self._allowed) for val in items]:\n raise TypeError('Invalid type encountered in the arguments.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L238_C12", "label": "if", "type": "if", "loc": [238, 239], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L237_C8", "vector": [4, 3, 0.7718, 0.0065, 3, 0.29, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False in [isinstance(val, self._allowed) for val in items]:\n raise TypeError('Invalid type encountered in the arguments.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L241_C4", "label": "_set_slice", "type": "function", "loc": [241, 259], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.8091, 0.0615, 1, 0.4, 0.9062, 536, 0, 3, 0, 0, 0, 0, 8], "semantic": {"name": "_set_slice", "arg_names": ["self", "index", "values"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_slice(self, index, values):\n \"Assign values to a slice of the object\"\n try:\n iter(values)\n except TypeError:\n raise TypeError('can only assign an iterable to a slice')\n\n self._check_allowed(values)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L242_C8", "label": "expression", "type": "expression", "loc": [242, 242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L241_C4", "vector": [8, 2, 0.7832, 0.0032, 2, 0.61, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Assign values to a slice of the object\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Try_L243_C8", "label": "try", "type": "try", "loc": [243, 246], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L241_C4", "vector": [7, 2, 0.7913, 0.0129, 2, 0.61, 0.1667, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n iter(values)\n except TypeError:\n raise TypeError('can only assign an iterable to a slice')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L244_C12", "label": "iter()", "type": "expression", "loc": [244, 244], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:Try_L243_C8", "vector": [8, 3, 0.7896, 0.0032, 3, 0.59, 0.0, 557, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "iter", "arg_names": [], "import_names": [], "rhs_call_name": "iter", "annotation": ""}, "snippet": " iter(values)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L248_C8", "label": "_check_allowed()", "type": "expression", "loc": [248, 248], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L241_C4", "vector": [8, 2, 0.8026, 0.0032, 2, 0.61, 0.3333, 582, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_check_allowed", "arg_names": [], "import_names": [], "rhs_call_name": "_check_allowed", "annotation": ""}, "snippet": " self._check_allowed(values)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L250_C8", "label": "origLen = len()", "type": "assigned_variable", "loc": [250, 250], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L241_C4", "vector": [14, 2, 0.8091, 0.0032, 2, 0.61, 0.5, 165, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "origLen", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " origLen = len(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L251_C8", "label": "valueList = list()", "type": "assigned_variable", "loc": [251, 251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L241_C4", "vector": [14, 2, 0.8123, 0.0032, 2, 0.61, 0.6667, 703, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "valueList", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " valueList = list(values)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L252_C8", "label": "start, stop, step = indices()", "type": "assigned_variable", "loc": [252, 252], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L241_C4", "vector": [14, 2, 0.8155, 0.0032, 2, 0.61, 0.8333, 393, 3, 1, 0, 0, 478, 10, 1], "semantic": {"name": "start, stop, step", "arg_names": [], "import_names": [], "rhs_call_name": "indices", "annotation": ""}, "snippet": " start, stop, step = index.indices(origLen)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L256_C8", "label": "if", "type": "if", "loc": [256, 259], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L241_C4", "vector": [4, 2, 0.8333, 0.0129, 2, 0.61, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if index.step is None:\n self._assign_simple_slice(start, stop, valueList)\n else:\n self._assign_extended_slice(start, stop, step, valueList)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L257_C12", "label": "_assign_simple_slice()", "type": "expression", "loc": [257, 257], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L256_C8", "vector": [8, 3, 0.8317, 0.0032, 3, 0.8, 0.0, 418, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "_assign_simple_slice", "arg_names": [], "import_names": [], "rhs_call_name": "_assign_simple_slice", "annotation": ""}, "snippet": " self._assign_simple_slice(start, stop, valueList)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L259_C12", "label": "_assign_extended_slice()", "type": "expression", "loc": [259, 259], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L256_C8", "vector": [8, 3, 0.8382, 0.0032, 3, 0.8, 1.0, 725, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "_assign_extended_slice", "arg_names": [], "import_names": [], "rhs_call_name": "_assign_extended_slice", "annotation": ""}, "snippet": " self._assign_extended_slice(start, stop, step, valueList)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L261_C4", "label": "_assign_extended_slice_rebuild", "type": "function", "loc": [261, 280], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.8754, 0.0647, 1, 0.4, 0.9375, 90, 0, 5, 0, 0, 0, 0, 13], "semantic": {"name": "_assign_extended_slice_rebuild", "arg_names": ["self", "start", "stop", "step", "valueList"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _assign_extended_slice_rebuild(self, start, stop, step, valueList):\n 'Assign an extended slice by rebuilding entire list'\n indexList = range(start, stop, step)\n # extended slice, only allow assigning slice of same size\n if len(valueList) != len(indexList):\n raise ValueError('attempt to assign sequence of size %d '\n 'to extended slice of size %d'\n % (len(valueList), len(indexList)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L262_C8", "label": "expression", "type": "expression", "loc": [262, 262], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L261_C4", "vector": [8, 2, 0.8479, 0.0032, 2, 0.16, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " 'Assign an extended slice by rebuilding entire list'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L263_C8", "label": "indexList = range()", "type": "assigned_variable", "loc": [263, 263], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L261_C4", "vector": [14, 2, 0.8511, 0.0032, 2, 0.16, 0.1667, 266, 3, 3, 0, 0, 816, 10, 1], "semantic": {"name": "indexList", "arg_names": [], "import_names": [], "rhs_call_name": "range", "annotation": ""}, "snippet": " indexList = range(start, stop, step)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L265_C8", "label": "if", "type": "if", "loc": [265, 268], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L261_C4", "vector": [4, 2, 0.8625, 0.0129, 2, 0.16, 0.3333, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(valueList) != len(indexList):\n raise ValueError('attempt to assign sequence of size %d '\n 'to extended slice of size %d'\n % (len(valueList), len(indexList)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L271_C8", "label": "newLen = len()", "type": "assigned_variable", "loc": [271, 271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L261_C4", "vector": [14, 2, 0.877, 0.0032, 2, 0.16, 0.5, 689, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "newLen", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " newLen = len(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L272_C8", "label": "newVals = dict()", "type": "assigned_variable", "loc": [272, 272], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L261_C4", "vector": [14, 2, 0.8803, 0.0032, 2, 0.16, 0.6667, 227, 3, 1, 0, 0, 827, 10, 2], "semantic": {"name": "newVals", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " newVals = dict(zip(indexList, valueList))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L273_C8", "label": "newItems", "type": "function", "loc": [273, 278], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L261_C4", "vector": [2, 2, 0.8916, 0.0194, 2, 0.16, 0.8333, 41, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "newItems", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def newItems():\n for i in xrange(newLen):\n if i in newVals:\n yield newVals[i]\n else:\n yield self._get_single_internal(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L274_C12", "label": "for i", "type": "for", "loc": [274, 278], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L273_C8", "vector": [6, 3, 0.8932, 0.0162, 3, 0.61, 0.0, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange(newLen):\n if i in newVals:\n yield newVals[i]\n else:\n yield self._get_single_internal(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L275_C16", "label": "if", "type": "if", "loc": [275, 278], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L274_C12", "vector": [4, 4, 0.8948, 0.0129, 4, 0.05, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i in newVals:\n yield newVals[i]\n else:\n yield self._get_single_internal(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L276_C20", "label": "expression", "type": "expression", "loc": [276, 276], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L275_C16", "vector": [8, 5, 0.8932, 0.0032, 5, 0.43, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield newVals[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L278_C20", "label": "expression", "type": "expression", "loc": [278, 278], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L275_C16", "vector": [8, 5, 0.8997, 0.0032, 5, 0.43, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield self._get_single_internal(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L280_C8", "label": "_rebuild()", "type": "expression", "loc": [280, 280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L261_C4", "vector": [8, 2, 0.9061, 0.0032, 2, 0.16, 1.0, 567, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_rebuild", "arg_names": [], "import_names": [], "rhs_call_name": "_rebuild", "annotation": ""}, "snippet": " self._rebuild(newLen, newItems())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L282_C4", "label": "_assign_extended_slice", "type": "function", "loc": [282, 292], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.9288, 0.0356, 1, 0.4, 0.9688, 725, 0, 5, 0, 0, 0, 0, 8], "semantic": {"name": "_assign_extended_slice", "arg_names": ["self", "start", "stop", "step", "valueList"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _assign_extended_slice(self, start, stop, step, valueList):\n 'Assign an extended slice by re-assigning individual items'\n indexList = range(start, stop, step)\n # extended slice, only allow assigning slice of same size\n if len(valueList) != len(indexList):\n raise ValueError('attempt to assign sequence of size %d '\n 'to extended slice of size %d'\n % (len(valueList), len(indexList)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L283_C8", "label": "expression", "type": "expression", "loc": [283, 283], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L282_C4", "vector": [8, 2, 0.9159, 0.0032, 2, 0.48, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " 'Assign an extended slice by re-assigning individual items'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L284_C8", "label": "indexList = range()", "type": "assigned_variable", "loc": [284, 284], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L282_C4", "vector": [14, 2, 0.9191, 0.0032, 2, 0.48, 0.3333, 266, 3, 3, 0, 0, 816, 10, 1], "semantic": {"name": "indexList", "arg_names": [], "import_names": [], "rhs_call_name": "range", "annotation": ""}, "snippet": " indexList = range(start, stop, step)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L286_C8", "label": "if", "type": "if", "loc": [286, 289], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L282_C4", "vector": [4, 2, 0.9304, 0.0129, 2, 0.48, 0.6667, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(valueList) != len(indexList):\n raise ValueError('attempt to assign sequence of size %d '\n 'to extended slice of size %d'\n % (len(valueList), len(indexList)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L291_C8", "label": "for i, val", "type": "for", "loc": [291, 292], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L282_C4", "vector": [6, 2, 0.9434, 0.0065, 2, 0.48, 1.0, 224, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i, val", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, val in zip(indexList, valueList):\n self._set_single(i, val)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L292_C12", "label": "_set_single()", "type": "expression", "loc": [292, 292], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L291_C8", "vector": [8, 3, 0.945, 0.0032, 3, 0.43, 0.0, 950, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_set_single", "arg_names": [], "import_names": [], "rhs_call_name": "_set_single", "annotation": ""}, "snippet": " self._set_single(i, val)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L294_C4", "label": "_assign_simple_slice", "type": "function", "loc": [294, 309], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "vector": [2, 1, 0.9757, 0.0518, 1, 0.4, 1.0, 418, 0, 4, 0, 0, 0, 0, 7], "semantic": {"name": "_assign_simple_slice", "arg_names": ["self", "start", "stop", "valueList"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _assign_simple_slice(self, start, stop, valueList):\n 'Assign a simple slice; Can assign slice of any length'\n origLen = len(self)\n stop = max(start, stop)\n newLen = origLen - stop + start + len(valueList)\n def newItems():\n for i in xrange(origLen + 1):\n if i == start:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L295_C8", "label": "expression", "type": "expression", "loc": [295, 295], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L294_C4", "vector": [8, 2, 0.9547, 0.0032, 2, 0.78, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " 'Assign a simple slice; Can assign slice of any length'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L296_C8", "label": "origLen = len()", "type": "assigned_variable", "loc": [296, 296], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L294_C4", "vector": [14, 2, 0.9579, 0.0032, 2, 0.78, 0.2, 165, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "origLen", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " origLen = len(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L297_C8", "label": "stop = max()", "type": "assigned_variable", "loc": [297, 297], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L294_C4", "vector": [14, 2, 0.9612, 0.0032, 2, 0.78, 0.4, 343, 3, 2, 0, 0, 442, 10, 1], "semantic": {"name": "stop", "arg_names": [], "import_names": [], "rhs_call_name": "max", "annotation": ""}, "snippet": " stop = max(start, stop)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L298_C8", "label": "newLen =", "type": "assigned_variable", "loc": [298, 298], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L294_C4", "vector": [14, 2, 0.9644, 0.0032, 2, 0.78, 0.6, 689, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "newLen", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newLen = origLen - stop + start + len(valueList)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L299_C8", "label": "newItems", "type": "function", "loc": [299, 307], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L294_C4", "vector": [2, 2, 0.9806, 0.0291, 2, 0.78, 0.8, 41, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "newItems", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def newItems():\n for i in xrange(origLen + 1):\n if i == start:\n for val in valueList:\n yield val\n\n if i < origLen:\n if i < start or i >= stop:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L300_C12", "label": "for i", "type": "for", "loc": [300, 307], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L299_C8", "vector": [6, 3, 0.9822, 0.0259, 3, 0.33, 0.0, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange(origLen + 1):\n if i == start:\n for val in valueList:\n yield val\n\n if i < origLen:\n if i < start or i >= stop:\n yield self._get_single_internal(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L301_C16", "label": "if", "type": "if", "loc": [301, 303], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L300_C12", "vector": [4, 4, 0.9773, 0.0097, 4, 0.08, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i == start:\n for val in valueList:\n yield val"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L302_C20", "label": "for val", "type": "for", "loc": [302, 303], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L301_C16", "vector": [6, 5, 0.979, 0.0065, 5, 0.27, 0.0, 618, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "val", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for val in valueList:\n yield val"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L303_C24", "label": "expression", "type": "expression", "loc": [303, 303], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L302_C20", "vector": [8, 6, 0.9806, 0.0032, 6, 0.89, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield val"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L305_C16", "label": "if", "type": "if", "loc": [305, 307], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L300_C12", "vector": [4, 4, 0.9903, 0.0097, 4, 0.08, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i < origLen:\n if i < start or i >= stop:\n yield self._get_single_internal(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L306_C20", "label": "if", "type": "if", "loc": [306, 307], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L305_C16", "vector": [4, 5, 0.9919, 0.0065, 5, 0.05, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i < start or i >= stop:\n yield self._get_single_internal(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L307_C24", "label": "expression", "type": "expression", "loc": [307, 307], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L306_C20", "vector": [8, 6, 0.9935, 0.0032, 6, 0.76, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield self._get_single_internal(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L309_C8", "label": "_rebuild()", "type": "expression", "loc": [309, 309], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L294_C4", "vector": [8, 2, 1.0, 0.0032, 2, 0.78, 1.0, 567, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_rebuild", "arg_names": [], "import_names": [], "rhs_call_name": "_rebuild", "annotation": ""}, "snippet": " self._rebuild(newLen, newItems())"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L63_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L64_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L67_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L68_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L74_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L75_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L74_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L77_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L74_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L88_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L89_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L91_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L102_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L103_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L102_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L105_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L102_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L106_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L102_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L111_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L112_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L126_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L138_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L141_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L138_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L142_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L142_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L143_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L149_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Try_L150_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:Try_L150_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L151_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:Try_L150_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L154_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:Try_L150_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L157_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L157_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L157_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L159_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L166_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L167_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L170_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L170_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L171_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L170_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L172_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L172_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L173_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L173_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L173_C31"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L177_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L177_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L178_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L177_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L181_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L182_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L181_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L185_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L186_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L185_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L187_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L185_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L191_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L191_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L192_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L191_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L191_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L195_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L197_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L197_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L201_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L202_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L203_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L205_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L205_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L206_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L205_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L207_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L207_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L208_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L207_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L209_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L207_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L210_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L207_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L212_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L207_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L213_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L207_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L214_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L217_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L217_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L218_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L217_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L220_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L217_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L223_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L225_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L225_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L226_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L228_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L228_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L229_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L228_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L230_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L230_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L231_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L228_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L232_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L232_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Return_L233_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L236_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L236_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L237_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L237_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L238_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L241_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L241_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L242_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L241_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Try_L243_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:Try_L243_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L244_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L241_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L248_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L241_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L250_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L241_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L241_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L252_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L241_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L256_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L256_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L257_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L256_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L259_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L261_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L261_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L262_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L261_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L263_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L261_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L265_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L261_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L271_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L261_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L272_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L261_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L273_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L273_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L274_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L274_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L275_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L275_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L276_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L275_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L278_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L261_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L280_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L282_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L283_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L284_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L286_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L291_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L291_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L292_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L294_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L294_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L295_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L294_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L296_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L294_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L297_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L294_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L298_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L294_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L299_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L299_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L300_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L300_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L301_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L301_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L302_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L302_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L303_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:For_L300_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L305_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L305_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L306_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:If_L306_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L307_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:FunctionDef_L294_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L309_C8"}] |
"""
This module houses the ctypes initialization procedures, as well
as the notice and error handler function callbacks (get called
when an error occurs in GEOS).
This module also houses GEOS Pointer utilities, including
get_pointer_arr(), and GEOM_PTR.
"""
import os, re, sys
from ctypes import c_char_p, Structure, CDLL, CFUNCTYPE, POINTER
from ctypes.util import find_library
from django.contrib.gis.geos.error import GEOSException
# Custom library path set?
try:
from django.conf import settings
lib_path = settings.GEOS_LIBRARY_PATH
except (AttributeError, EnvironmentError, ImportError):
lib_path = None
# Setting the appropriate names for the GEOS-C library.
if lib_path:
lib_names = None
elif os.name == 'nt':
# Windows NT libraries
lib_names = ['libgeos_c-1']
elif os.name == 'posix':
# *NIX libraries
lib_names = ['geos_c', 'GEOS']
else:
raise ImportError('Unsupported OS "%s"' % os.name)
# Using the ctypes `find_library` utility to find the path to the GEOS
# shared library. This is better than manually specifiying each library name
# and extension (e.g., libgeos_c.[so|so.1|dylib].).
if lib_names:
for lib_name in lib_names:
lib_path = find_library(lib_name)
if not lib_path is None: break
# No GEOS library could be found.
if lib_path is None:
raise ImportError('Could not find the GEOS library (tried "%s"). '
'Try setting GEOS_LIBRARY_PATH in your settings.' %
'", "'.join(lib_names))
# Getting the GEOS C library. The C interface (CDLL) is used for
# both *NIX and Windows.
# See the GEOS C API source code for more details on the library function calls:
# http://geos.refractions.net/ro/doxygen_docs/html/geos__c_8h-source.html
lgeos = CDLL(lib_path)
# The notice and error handler C function callback definitions.
# Supposed to mimic the GEOS message handler (C below):
# typedef void (*GEOSMessageHandler)(const char *fmt, ...);
NOTICEFUNC = CFUNCTYPE(None, c_char_p, c_char_p)
def notice_h(fmt, lst, output_h=sys.stdout):
try:
warn_msg = fmt % lst
except:
warn_msg = fmt
output_h.write('GEOS_NOTICE: %s\n' % warn_msg)
notice_h = NOTICEFUNC(notice_h)
ERRORFUNC = CFUNCTYPE(None, c_char_p, c_char_p)
def error_h(fmt, lst, output_h=sys.stderr):
try:
err_msg = fmt % lst
except:
err_msg = fmt
output_h.write('GEOS_ERROR: %s\n' % err_msg)
error_h = ERRORFUNC(error_h)
#### GEOS Geometry C data structures, and utility functions. ####
# Opaque GEOS geometry structures, used for GEOM_PTR and CS_PTR
class GEOSGeom_t(Structure): pass
class GEOSPrepGeom_t(Structure): pass
class GEOSCoordSeq_t(Structure): pass
class GEOSContextHandle_t(Structure): pass
# Pointers to opaque GEOS geometry structures.
GEOM_PTR = POINTER(GEOSGeom_t)
PREPGEOM_PTR = POINTER(GEOSPrepGeom_t)
CS_PTR = POINTER(GEOSCoordSeq_t)
CONTEXT_PTR = POINTER(GEOSContextHandle_t)
# Used specifically by the GEOSGeom_createPolygon and GEOSGeom_createCollection
# GEOS routines
def get_pointer_arr(n):
"Gets a ctypes pointer array (of length `n`) for GEOSGeom_t opaque pointer."
GeomArr = GEOM_PTR * n
return GeomArr()
# Returns the string version of the GEOS library. Have to set the restype
# explicitly to c_char_p to ensure compatibility accross 32 and 64-bit platforms.
geos_version = lgeos.GEOSversion
geos_version.argtypes = None
geos_version.restype = c_char_p
# Regular expression should be able to parse version strings such as
# '3.0.0rc4-CAPI-1.3.3', or '3.0.0-CAPI-1.4.1'
version_regex = re.compile(r'^(?P<version>(?P<major>\d+)\.(?P<minor>\d+)\.(?P<subminor>\d+))(rc(?P<release_candidate>\d+))?-CAPI-(?P<capi_version>\d+\.\d+\.\d+)$')
def geos_version_info():
"""
Returns a dictionary containing the various version metadata parsed from
the GEOS version string, including the version number, whether the version
is a release candidate (and what number release candidate), and the C API
version.
"""
ver = geos_version()
m = version_regex.match(ver)
if not m: raise GEOSException('Could not parse version info string "%s"' % ver)
return dict((key, m.group(key)) for key in ('version', 'release_candidate', 'capi_version', 'major', 'minor', 'subminor'))
# Version numbers and whether or not prepared geometry support is available.
_verinfo = geos_version_info()
GEOS_MAJOR_VERSION = int(_verinfo['major'])
GEOS_MINOR_VERSION = int(_verinfo['minor'])
GEOS_SUBMINOR_VERSION = int(_verinfo['subminor'])
del _verinfo
GEOS_VERSION = (GEOS_MAJOR_VERSION, GEOS_MINOR_VERSION, GEOS_SUBMINOR_VERSION)
GEOS_PREPARE = GEOS_VERSION >= (3, 1, 0)
if GEOS_PREPARE:
# Here we set up the prototypes for the initGEOS_r and finishGEOS_r
# routines. These functions aren't actually called until they are
# attached to a GEOS context handle -- this actually occurs in
# geos/prototypes/threadsafe.py.
lgeos.initGEOS_r.restype = CONTEXT_PTR
lgeos.finishGEOS_r.argtypes = [CONTEXT_PTR]
else:
# When thread-safety isn't available, the initGEOS routine must be called
# first. This function takes the notice and error functions, defined
# as Python callbacks above, as parameters. Here is the C code that is
# wrapped:
# extern void GEOS_DLL initGEOS(GEOSMessageHandler notice_function, GEOSMessageHandler error_function);
lgeos.initGEOS(notice_h, error_h)
# Calling finishGEOS() upon exit of the interpreter.
import atexit
atexit.register(lgeos.finishGEOS)
| ajibawa-2023/Python-Code-Large/train/row_98734 | 69 | 141 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0319, 0.0567, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n This module houses the ctypes initialization procedures, as well\n as the notice and error handler function callbacks (get called\n when an error occurs in GEOS).\n\n This module also houses GEOS Pointer utilities, including\n get_pointer_arr(), and GEOM_PTR.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Import_L9_C0", "label": "os import os, re, sys", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0638, 0.0071, 0, 0.66, 0.0278, 688, 0, 3, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "re", "sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os, re, sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:ImportFrom_L10_C0", "label": "from ctypes import c_char_p, Structure, CDLL\u2026", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0709, 0.0071, 0, 0.66, 0.0556, 182, 0, 5, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_char_p", "Structure", "CDLL", "CFUNCTYPE", "POINTER"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import c_char_p, Structure, CDLL, CFUNCTYPE, POINTER"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:ImportFrom_L11_C0", "label": "from ctypes.util import find_library", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.078, 0.0071, 0, 0.66, 0.0833, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "ctypes.util", "arg_names": [], "import_names": ["find_library"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes.util import find_library"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:ImportFrom_L12_C0", "label": "from django.contrib.gis.geos.error import GEOSException", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0851, 0.0071, 0, 0.66, 0.1111, 827, 0, 1, 0, 0, 827, 0, 0], "semantic": {"name": "django.contrib.gis.geos.error", "arg_names": [], "import_names": ["GEOSException"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.error import GEOSException"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Try_L15_C0", "label": "try", "type": "try", "loc": [15, 19], "level": 0, "parent": null, "vector": [7, 0, 0.1206, 0.0355, 0, 0.66, 0.1389, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from django.conf import settings\n lib_path = settings.GEOS_LIBRARY_PATH\nexcept (AttributeError, EnvironmentError, ImportError):\n lib_path = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:ImportFrom_L16_C4", "label": "from django.conf import settings", "type": "import", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:Try_L15_C0", "vector": [1, 1, 0.1135, 0.0071, 1, 0.5, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L17_C4", "label": "lib_path =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:Try_L15_C0", "vector": [14, 1, 0.1206, 0.0071, 1, 0.5, 1.0, 563, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "lib_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lib_path = settings.GEOS_LIBRARY_PATH"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L19_C4", "label": "lib_path =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:Try_L15_C0", "vector": [14, 1, 0.1348, 0.0071, 1, 0.5, 0.0, 563, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "lib_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lib_path = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L22_C0", "label": "if", "type": "if", "loc": [22, 31], "level": 0, "parent": null, "vector": [4, 0, 0.1879, 0.0709, 0, 0.66, 0.1667, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if lib_path:\n lib_names = None\nelif os.name == 'nt':\n # Windows NT libraries\n lib_names = ['libgeos_c-1']\nelif os.name == 'posix':\n # *NIX libraries\n lib_names = ['geos_c', 'GEOS']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L23_C4", "label": "lib_names =", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L22_C0", "vector": [14, 1, 0.1631, 0.0071, 1, 0.15, 0.0, 652, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "lib_names", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lib_names = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L24_C0", "label": "if", "type": "if", "loc": [24, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L22_C0", "vector": [4, 1, 0.195, 0.0567, 1, 0.15, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "elif os.name == 'nt':\n # Windows NT libraries\n lib_names = ['libgeos_c-1']\nelif os.name == 'posix':\n # *NIX libraries\n lib_names = ['geos_c', 'GEOS']\nelse:\n raise ImportError('Unsupported OS \"%s\"' % os.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L26_C4", "label": "lib_names =", "type": "assigned_variable", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L24_C0", "vector": [14, 2, 0.1844, 0.0071, 2, 0.16, 0.0, 652, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "lib_names", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lib_names = ['libgeos_c-1']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L27_C0", "label": "if", "type": "if", "loc": [27, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L24_C0", "vector": [4, 2, 0.2057, 0.0355, 2, 0.16, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "elif os.name == 'posix':\n # *NIX libraries\n lib_names = ['geos_c', 'GEOS']\nelse:\n raise ImportError('Unsupported OS \"%s\"' % os.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L29_C4", "label": "lib_names =", "type": "assigned_variable", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L27_C0", "vector": [14, 3, 0.2057, 0.0071, 3, 0.73, 0.0, 652, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "lib_names", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lib_names = ['geos_c', 'GEOS']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L36_C0", "label": "if", "type": "if", "loc": [36, 39], "level": 0, "parent": null, "vector": [4, 0, 0.266, 0.0284, 0, 0.66, 0.1944, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if lib_names:\n for lib_name in lib_names:\n lib_path = find_library(lib_name)\n if not lib_path is None: break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:For_L37_C4", "label": "for lib_name", "type": "for", "loc": [37, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L36_C0", "vector": [6, 1, 0.2695, 0.0213, 1, 0.83, 0.0, 613, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "lib_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for lib_name in lib_names:\n lib_path = find_library(lib_name)\n if not lib_path is None: break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L38_C8", "label": "lib_path = find_library()", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:For_L37_C4", "vector": [14, 2, 0.2695, 0.0071, 2, 0.74, 0.0, 563, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "lib_path", "arg_names": [], "import_names": [], "rhs_call_name": "find_library", "annotation": ""}, "snippet": " lib_path = find_library(lib_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L39_C8", "label": "if", "type": "if", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:For_L37_C4", "vector": [4, 2, 0.2766, 0.0071, 2, 0.74, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not lib_path is None: break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L42_C0", "label": "if", "type": "if", "loc": [42, 45], "level": 0, "parent": null, "vector": [4, 0, 0.3085, 0.0284, 0, 0.66, 0.2222, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if lib_path is None:\n raise ImportError('Could not find the GEOS library (tried \"%s\"). '\n 'Try setting GEOS_LIBRARY_PATH in your settings.' %\n '\", \"'.join(lib_names))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L51_C0", "label": "lgeos = CDLL()", "type": "assigned_variable", "loc": [51, 51], "level": 0, "parent": null, "vector": [14, 0, 0.3617, 0.0071, 0, 0.66, 0.25, 340, 3, 1, 0, 0, 453, 10, 1], "semantic": {"name": "lgeos", "arg_names": [], "import_names": [], "rhs_call_name": "CDLL", "annotation": ""}, "snippet": "lgeos = CDLL(lib_path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L56_C0", "label": "NOTICEFUNC = CFUNCTYPE()", "type": "assigned_variable", "loc": [56, 56], "level": 0, "parent": null, "vector": [14, 0, 0.3972, 0.0071, 0, 0.66, 0.2778, 905, 3, 3, 0, 0, 133, 10, 1], "semantic": {"name": "NOTICEFUNC", "arg_names": [], "import_names": [], "rhs_call_name": "CFUNCTYPE", "annotation": ""}, "snippet": "NOTICEFUNC = CFUNCTYPE(None, c_char_p, c_char_p)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L57_C0", "label": "notice_h", "type": "function", "loc": [57, 62], "level": 0, "parent": null, "vector": [2, 0, 0.422, 0.0426, 0, 0.66, 0.3056, 730, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "notice_h", "arg_names": ["fmt", "lst", "output_h"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def notice_h(fmt, lst, output_h=sys.stdout):\n try:\n warn_msg = fmt % lst\n except:\n warn_msg = fmt\n output_h.write('GEOS_NOTICE: %s\\n' % warn_msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Try_L58_C4", "label": "try", "type": "try", "loc": [58, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L57_C0", "vector": [7, 1, 0.422, 0.0284, 1, 0.42, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n warn_msg = fmt % lst\n except:\n warn_msg = fmt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L59_C8", "label": "warn_msg =", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:Try_L58_C4", "vector": [14, 2, 0.4184, 0.0071, 2, 0.18, 0.0, 102, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "warn_msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " warn_msg = fmt % lst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L61_C8", "label": "warn_msg =", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:Try_L58_C4", "vector": [14, 2, 0.4326, 0.0071, 2, 0.18, 0.0, 102, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "warn_msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " warn_msg = fmt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Expr_L62_C4", "label": "write()", "type": "expression", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L57_C0", "vector": [8, 1, 0.4397, 0.0071, 1, 0.42, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " output_h.write('GEOS_NOTICE: %s\\n' % warn_msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L63_C0", "label": "notice_h = NOTICEFUNC()", "type": "assigned_variable", "loc": [63, 63], "level": 0, "parent": null, "vector": [14, 0, 0.4468, 0.0071, 0, 0.66, 0.3333, 730, 3, 1, 0, 0, 905, 10, 1], "semantic": {"name": "notice_h", "arg_names": [], "import_names": [], "rhs_call_name": "NOTICEFUNC", "annotation": ""}, "snippet": "notice_h = NOTICEFUNC(notice_h)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L65_C0", "label": "ERRORFUNC = CFUNCTYPE()", "type": "assigned_variable", "loc": [65, 65], "level": 0, "parent": null, "vector": [14, 0, 0.461, 0.0071, 0, 0.66, 0.3611, 836, 3, 3, 0, 0, 133, 10, 1], "semantic": {"name": "ERRORFUNC", "arg_names": [], "import_names": [], "rhs_call_name": "CFUNCTYPE", "annotation": ""}, "snippet": "ERRORFUNC = CFUNCTYPE(None, c_char_p, c_char_p)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L66_C0", "label": "error_h", "type": "function", "loc": [66, 71], "level": 0, "parent": null, "vector": [2, 0, 0.4858, 0.0426, 0, 0.66, 0.3889, 893, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "error_h", "arg_names": ["fmt", "lst", "output_h"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def error_h(fmt, lst, output_h=sys.stderr):\n try:\n err_msg = fmt % lst\n except:\n err_msg = fmt\n output_h.write('GEOS_ERROR: %s\\n' % err_msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Try_L67_C4", "label": "try", "type": "try", "loc": [67, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L66_C0", "vector": [7, 1, 0.4858, 0.0284, 1, 0.34, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n err_msg = fmt % lst\n except:\n err_msg = fmt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L68_C8", "label": "err_msg =", "type": "assigned_variable", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:Try_L67_C4", "vector": [14, 2, 0.4823, 0.0071, 2, 0.76, 0.0, 236, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "err_msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " err_msg = fmt % lst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L70_C8", "label": "err_msg =", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:Try_L67_C4", "vector": [14, 2, 0.4965, 0.0071, 2, 0.76, 0.0, 236, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "err_msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " err_msg = fmt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Expr_L71_C4", "label": "write()", "type": "expression", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L66_C0", "vector": [8, 1, 0.5035, 0.0071, 1, 0.34, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " output_h.write('GEOS_ERROR: %s\\n' % err_msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L72_C0", "label": "error_h = ERRORFUNC()", "type": "assigned_variable", "loc": [72, 72], "level": 0, "parent": null, "vector": [14, 0, 0.5106, 0.0071, 0, 0.66, 0.4167, 893, 3, 1, 0, 0, 836, 10, 1], "semantic": {"name": "error_h", "arg_names": [], "import_names": [], "rhs_call_name": "ERRORFUNC", "annotation": ""}, "snippet": "error_h = ERRORFUNC(error_h)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:ClassDef_L77_C0", "label": "GEOSGeom_t", "type": "class", "loc": [77, 77], "level": 0, "parent": null, "vector": [3, 0, 0.5461, 0.0071, 0, 0.66, 0.4444, 273, 0, 0, 0, 0, 183, 0, 0], "semantic": {"name": "GEOSGeom_t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GEOSGeom_t(Structure): pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:ClassDef_L78_C0", "label": "GEOSPrepGeom_t", "type": "class", "loc": [78, 78], "level": 0, "parent": null, "vector": [3, 0, 0.5532, 0.0071, 0, 0.66, 0.4722, 765, 0, 0, 0, 0, 183, 0, 0], "semantic": {"name": "GEOSPrepGeom_t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GEOSPrepGeom_t(Structure): pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:ClassDef_L79_C0", "label": "GEOSCoordSeq_t", "type": "class", "loc": [79, 79], "level": 0, "parent": null, "vector": [3, 0, 0.5603, 0.0071, 0, 0.66, 0.5, 153, 0, 0, 0, 0, 183, 0, 0], "semantic": {"name": "GEOSCoordSeq_t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GEOSCoordSeq_t(Structure): pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:ClassDef_L80_C0", "label": "GEOSContextHandle_t", "type": "class", "loc": [80, 80], "level": 0, "parent": null, "vector": [3, 0, 0.5674, 0.0071, 0, 0.66, 0.5278, 15, 0, 0, 0, 0, 183, 0, 0], "semantic": {"name": "GEOSContextHandle_t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GEOSContextHandle_t(Structure): pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L83_C0", "label": "GEOM_PTR = POINTER()", "type": "assigned_variable", "loc": [83, 83], "level": 0, "parent": null, "vector": [14, 0, 0.5887, 0.0071, 0, 0.66, 0.5556, 410, 3, 1, 0, 0, 785, 10, 1], "semantic": {"name": "GEOM_PTR", "arg_names": [], "import_names": [], "rhs_call_name": "POINTER", "annotation": ""}, "snippet": "GEOM_PTR = POINTER(GEOSGeom_t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L84_C0", "label": "PREPGEOM_PTR = POINTER()", "type": "assigned_variable", "loc": [84, 84], "level": 0, "parent": null, "vector": [14, 0, 0.5957, 0.0071, 0, 0.66, 0.5833, 793, 3, 1, 0, 0, 785, 10, 1], "semantic": {"name": "PREPGEOM_PTR", "arg_names": [], "import_names": [], "rhs_call_name": "POINTER", "annotation": ""}, "snippet": "PREPGEOM_PTR = POINTER(GEOSPrepGeom_t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L85_C0", "label": "CS_PTR = POINTER()", "type": "assigned_variable", "loc": [85, 85], "level": 0, "parent": null, "vector": [14, 0, 0.6028, 0.0071, 0, 0.66, 0.6111, 842, 3, 1, 0, 0, 785, 10, 1], "semantic": {"name": "CS_PTR", "arg_names": [], "import_names": [], "rhs_call_name": "POINTER", "annotation": ""}, "snippet": "CS_PTR = POINTER(GEOSCoordSeq_t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L86_C0", "label": "CONTEXT_PTR = POINTER()", "type": "assigned_variable", "loc": [86, 86], "level": 0, "parent": null, "vector": [14, 0, 0.6099, 0.0071, 0, 0.66, 0.6389, 977, 3, 1, 0, 0, 785, 10, 1], "semantic": {"name": "CONTEXT_PTR", "arg_names": [], "import_names": [], "rhs_call_name": "POINTER", "annotation": ""}, "snippet": "CONTEXT_PTR = POINTER(GEOSContextHandle_t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L90_C0", "label": "get_pointer_arr", "type": "function", "loc": [90, 93], "level": 0, "parent": null, "vector": [2, 0, 0.6489, 0.0284, 0, 0.66, 0.6667, 677, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_pointer_arr", "arg_names": ["n"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_pointer_arr(n):\n \"Gets a ctypes pointer array (of length `n`) for GEOSGeom_t opaque pointer.\"\n GeomArr = GEOM_PTR * n\n return GeomArr()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Expr_L91_C4", "label": "expression", "type": "expression", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L90_C0", "vector": [8, 1, 0.6454, 0.0071, 1, 0.68, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Gets a ctypes pointer array (of length `n`) for GEOSGeom_t opaque pointer.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L92_C4", "label": "GeomArr =", "type": "assigned_variable", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L90_C0", "vector": [14, 1, 0.6525, 0.0071, 1, 0.68, 0.5, 460, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "GeomArr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " GeomArr = GEOM_PTR * n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Return_L93_C4", "label": "return", "type": "return", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L90_C0", "vector": [13, 1, 0.6596, 0.0071, 1, 0.68, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return GeomArr()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L97_C0", "label": "geos_version =", "type": "assigned_variable", "loc": [97, 97], "level": 0, "parent": null, "vector": [14, 0, 0.6879, 0.0071, 0, 0.66, 0.6944, 74, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geos_version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "geos_version = lgeos.GEOSversion"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L98_C0", "label": "geos_version.argtypes =", "type": "assigned_variable", "loc": [98, 98], "level": 0, "parent": null, "vector": [14, 0, 0.695, 0.0071, 0, 0.66, 0.7222, 501, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "geos_version.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "geos_version.argtypes = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L99_C0", "label": "geos_version.restype =", "type": "assigned_variable", "loc": [99, 99], "level": 0, "parent": null, "vector": [14, 0, 0.7021, 0.0071, 0, 0.66, 0.75, 924, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geos_version.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "geos_version.restype = c_char_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L103_C0", "label": "version_regex = compile()", "type": "assigned_variable", "loc": [103, 103], "level": 0, "parent": null, "vector": [14, 0, 0.7305, 0.0071, 0, 0.66, 0.7778, 866, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "version_regex", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "version_regex = re.compile(r'^(?P<version>(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<subminor>\\d+))(rc(?P<release_candidate>\\d+))?-CAPI-(?P<capi_version>\\d+\\.\\d+\\.\\d+)$')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L104_C0", "label": "geos_version_info", "type": "function", "loc": [104, 114], "level": 0, "parent": null, "vector": [2, 0, 0.773, 0.078, 0, 0.66, 0.8056, 4, 0, 0, 1, 0, 0, 0, 5], "semantic": {"name": "geos_version_info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def geos_version_info():\n \"\"\"\n Returns a dictionary containing the various version metadata parsed from\n the GEOS version string, including the version number, whether the version\n is a release candidate (and what number release candidate), and the C API\n version.\n \"\"\"\n ver = geos_version()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Expr_L105_C4", "label": "expression", "type": "expression", "loc": [105, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L104_C0", "vector": [8, 1, 0.7624, 0.0426, 1, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a dictionary containing the various version metadata parsed from\n the GEOS version string, including the version number, whether the version\n is a release candidate (and what number release candidate), and the C API\n version.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L111_C4", "label": "ver = geos_version()", "type": "assigned_variable", "loc": [111, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L104_C0", "vector": [14, 1, 0.7872, 0.0071, 1, 0.15, 0.25, 648, 3, 0, 0, 0, 74, 10, 1], "semantic": {"name": "ver", "arg_names": [], "import_names": [], "rhs_call_name": "geos_version", "annotation": ""}, "snippet": " ver = geos_version()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L112_C4", "label": "m = match()", "type": "assigned_variable", "loc": [112, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L104_C0", "vector": [14, 1, 0.7943, 0.0071, 1, 0.15, 0.5, 711, 3, 1, 0, 0, 36, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " m = version_regex.match(ver)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L113_C4", "label": "if", "type": "if", "loc": [113, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L104_C0", "vector": [4, 1, 0.8014, 0.0071, 1, 0.15, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not m: raise GEOSException('Could not parse version info string \"%s\"' % ver)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Return_L114_C4", "label": "return", "type": "return", "loc": [114, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L104_C0", "vector": [13, 1, 0.8085, 0.0071, 1, 0.15, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict((key, m.group(key)) for key in ('version', 'release_candidate', 'capi_version', 'major', 'minor', 'subminor'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L117_C0", "label": "_verinfo = geos_version_info()", "type": "assigned_variable", "loc": [117, 117], "level": 0, "parent": null, "vector": [14, 0, 0.8298, 0.0071, 0, 0.66, 0.8333, 826, 3, 0, 0, 0, 4, 10, 1], "semantic": {"name": "_verinfo", "arg_names": [], "import_names": [], "rhs_call_name": "geos_version_info", "annotation": ""}, "snippet": "_verinfo = geos_version_info()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L118_C0", "label": "GEOS_MAJOR_VERSION = int()", "type": "assigned_variable", "loc": [118, 118], "level": 0, "parent": null, "vector": [14, 0, 0.8369, 0.0071, 0, 0.66, 0.8611, 317, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "GEOS_MAJOR_VERSION", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": "GEOS_MAJOR_VERSION = int(_verinfo['major'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L119_C0", "label": "GEOS_MINOR_VERSION = int()", "type": "assigned_variable", "loc": [119, 119], "level": 0, "parent": null, "vector": [14, 0, 0.844, 0.0071, 0, 0.66, 0.8889, 711, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "GEOS_MINOR_VERSION", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": "GEOS_MINOR_VERSION = int(_verinfo['minor'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L120_C0", "label": "GEOS_SUBMINOR_VERSION = int()", "type": "assigned_variable", "loc": [120, 120], "level": 0, "parent": null, "vector": [14, 0, 0.8511, 0.0071, 0, 0.66, 0.9167, 642, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "GEOS_SUBMINOR_VERSION", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": "GEOS_SUBMINOR_VERSION = int(_verinfo['subminor'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L122_C0", "label": "GEOS_VERSION =", "type": "assigned_variable", "loc": [122, 122], "level": 0, "parent": null, "vector": [14, 0, 0.8652, 0.0071, 0, 0.66, 0.9722, 171, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "GEOS_VERSION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "GEOS_VERSION = (GEOS_MAJOR_VERSION, GEOS_MINOR_VERSION, GEOS_SUBMINOR_VERSION)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L123_C0", "label": "GEOS_PREPARE =", "type": "assigned_variable", "loc": [123, 123], "level": 0, "parent": null, "vector": [14, 0, 0.8723, 0.0071, 0, 0.66, 1.0, 702, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "GEOS_PREPARE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "GEOS_PREPARE = GEOS_VERSION >= (3, 1, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L125_C0", "label": "if", "type": "if", "loc": [125, 141], "level": 0, "parent": null, "vector": [4, 0, 0.9433, 0.1206, 0, 0.66, 1.0278, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if GEOS_PREPARE:\n # Here we set up the prototypes for the initGEOS_r and finishGEOS_r\n # routines. These functions aren't actually called until they are\n # attached to a GEOS context handle -- this actually occurs in\n # geos/prototypes/threadsafe.py.\n lgeos.initGEOS_r.restype = CONTEXT_PTR\n lgeos.finishGEOS_r.argtypes = [CONTEXT_PTR]\nelse:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L130_C4", "label": "lgeos.initGEOS_r.restype =", "type": "assigned_variable", "loc": [130, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L125_C0", "vector": [14, 1, 0.922, 0.0071, 1, 0.77, 0.0, 84, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "lgeos.initGEOS_r.restype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lgeos.initGEOS_r.restype = CONTEXT_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L131_C4", "label": "lgeos.finishGEOS_r.argtypes =", "type": "assigned_variable", "loc": [131, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L125_C0", "vector": [14, 1, 0.9291, 0.0071, 1, 0.77, 0.25, 497, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "lgeos.finishGEOS_r.argtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lgeos.finishGEOS_r.argtypes = [CONTEXT_PTR]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Expr_L138_C4", "label": "initGEOS()", "type": "expression", "loc": [138, 138], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L125_C0", "vector": [8, 1, 0.9787, 0.0071, 1, 0.77, 0.5, 551, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "initGEOS", "arg_names": [], "import_names": [], "rhs_call_name": "initGEOS", "annotation": ""}, "snippet": " lgeos.initGEOS(notice_h, error_h)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Import_L140_C4", "label": "atexit import atexit", "type": "import", "loc": [140, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L125_C0", "vector": [1, 1, 0.9929, 0.0071, 1, 0.77, 0.75, 585, 0, 1, 0, 0, 585, 0, 0], "semantic": {"name": "atexit", "arg_names": [], "import_names": ["atexit"], "rhs_call_name": "", "annotation": ""}, "snippet": " import atexit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98734:Expr_L141_C4", "label": "register()", "type": "expression", "loc": [141, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L125_C0", "vector": [8, 1, 1.0, 0.0071, 1, 0.77, 1.0, 276, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "register", "arg_names": [], "import_names": [], "rhs_call_name": "register", "annotation": ""}, "snippet": " atexit.register(lgeos.finishGEOS)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98734:Try_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:ImportFrom_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:Try_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:Try_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L24_C0"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L27_C0"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:For_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:For_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:For_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Try_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:Try_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:Try_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Expr_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Try_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:Try_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:Try_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Expr_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Expr_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Return_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L104_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Expr_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L104_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L104_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L104_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:FunctionDef_L104_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Return_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L125_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L125_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L125_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Expr_L138_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L125_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Import_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:If_L125_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Expr_L141_C4"}] |
"""
GEOS Testing module.
"""
from django.utils.unittest import TestSuite, TextTestRunner
import test_geos, test_io, test_geos_mutation, test_mutable_list
test_suites = [
test_geos.suite(),
test_io.suite(),
test_geos_mutation.suite(),
test_mutable_list.suite(),
]
def suite():
"Builds a test suite for the GEOS tests."
s = TestSuite()
map(s.addTest, test_suites)
return s
def run(verbosity=1):
"Runs the GEOS tests."
TextTestRunner(verbosity=verbosity).run(suite())
if __name__ == '__main__':
run(2)
| ajibawa-2023/Python-Code-Large/train/row_98735 | 14 | 25 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98735:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.08, 0.12, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nGEOS Testing module.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98735:ImportFrom_L4_C0", "label": "from django.utils.unittest import TestSuite, TextTestRunner", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.16, 0.04, 0, 0.66, 0.1667, 270, 0, 2, 0, 0, 270, 0, 0], "semantic": {"name": "django.utils.unittest", "arg_names": [], "import_names": ["TestSuite", "TextTestRunner"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.unittest import TestSuite, TextTestRunner"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98735:Import_L5_C0", "label": "test_geos import test_geos, test_io, test_geos_mutation\u2026", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.04, 0, 0.66, 0.3333, 124, 0, 4, 0, 0, 124, 0, 0], "semantic": {"name": "test_geos", "arg_names": [], "import_names": ["test_geos", "test_io", "test_geos_mutation", "test_mutable_list"], "rhs_call_name": "", "annotation": ""}, "snippet": "import test_geos, test_io, test_geos_mutation, test_mutable_list"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98735:Assign_L7_C0", "label": "test_suites =", "type": "assigned_variable", "loc": [7, 12], "level": 0, "parent": null, "vector": [14, 0, 0.38, 0.24, 0, 0.66, 0.5, 781, 0, 0, 0, 0, 0, 5, 4], "semantic": {"name": "test_suites", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "test_suites = [\n test_geos.suite(),\n test_io.suite(),\n test_geos_mutation.suite(),\n test_mutable_list.suite(),\n ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98735:FunctionDef_L14_C0", "label": "suite", "type": "function", "loc": [14, 18], "level": 0, "parent": null, "vector": [2, 0, 0.64, 0.2, 0, 0.66, 0.6667, 425, 0, 0, 1, 0, 0, 0, 2], "semantic": {"name": "suite", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def suite():\n \"Builds a test suite for the GEOS tests.\"\n s = TestSuite()\n map(s.addTest, test_suites)\n return s"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98735:Expr_L15_C4", "label": "expression", "type": "expression", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98735:FunctionDef_L14_C0", "vector": [8, 1, 0.6, 0.04, 1, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Builds a test suite for the GEOS tests.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98735:Assign_L16_C4", "label": "s = TestSuite()", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98735:FunctionDef_L14_C0", "vector": [14, 1, 0.64, 0.04, 1, 0.44, 0.3333, 553, 3, 0, 0, 0, 75, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "TestSuite", "annotation": ""}, "snippet": " s = TestSuite()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98735:Expr_L17_C4", "label": "map()", "type": "expression", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98735:FunctionDef_L14_C0", "vector": [8, 1, 0.68, 0.04, 1, 0.44, 0.6667, 53, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "map", "arg_names": [], "import_names": [], "rhs_call_name": "map", "annotation": ""}, "snippet": " map(s.addTest, test_suites)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98735:Return_L18_C4", "label": "return", "type": "return", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98735:FunctionDef_L14_C0", "vector": [13, 1, 0.72, 0.04, 1, 0.44, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return s"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98735:FunctionDef_L20_C0", "label": "run", "type": "function", "loc": [20, 22], "level": 0, "parent": null, "vector": [2, 0, 0.84, 0.12, 0, 0.66, 0.8333, 679, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "run", "arg_names": ["verbosity"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def run(verbosity=1):\n \"Runs the GEOS tests.\"\n TextTestRunner(verbosity=verbosity).run(suite())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98735:Expr_L21_C4", "label": "expression", "type": "expression", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98735:FunctionDef_L20_C0", "vector": [8, 1, 0.84, 0.04, 1, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Runs the GEOS tests.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98735:Expr_L22_C4", "label": "run()", "type": "expression", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98735:FunctionDef_L20_C0", "vector": [8, 1, 0.88, 0.04, 1, 0.72, 1.0, 679, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " TextTestRunner(verbosity=verbosity).run(suite())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98735:If_L24_C0", "label": "if", "type": "if", "loc": [24, 25], "level": 0, "parent": null, "vector": [4, 0, 0.98, 0.08, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n run(2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98735:Expr_L25_C4", "label": "run()", "type": "expression", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98735:If_L24_C0", "vector": [8, 1, 1.0, 0.04, 1, 0.66, 0.0, 679, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " run(2)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98735:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98735:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98735:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98735:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98735:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98735:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98735:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98735:Return_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98735:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98735:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98735:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98735:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98735:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98735:Expr_L25_C4"}] |
from ctypes import c_uint, byref
from django.contrib.gis.geos.error import GEOSIndexError
from django.contrib.gis.geos.geometry import GEOSGeometry
from django.contrib.gis.geos.libgeos import get_pointer_arr, GEOM_PTR
from django.contrib.gis.geos.linestring import LinearRing
from django.contrib.gis.geos import prototypes as capi
class Polygon(GEOSGeometry):
_minlength = 1
def __init__(self, *args, **kwargs):
"""
Initializes on an exterior ring and a sequence of holes (both
instances may be either LinearRing instances, or a tuple/list
that may be constructed into a LinearRing).
Examples of initialization, where shell, hole1, and hole2 are
valid LinearRing geometries:
>>> poly = Polygon(shell, hole1, hole2)
>>> poly = Polygon(shell, (hole1, hole2))
Example where a tuple parameters are used:
>>> poly = Polygon(((0, 0), (0, 10), (10, 10), (0, 10), (0, 0)),
((4, 4), (4, 6), (6, 6), (6, 4), (4, 4)))
"""
if not args:
raise TypeError('Must provide at least one LinearRing, or a tuple, to initialize a Polygon.')
# Getting the ext_ring and init_holes parameters from the argument list
ext_ring = args[0]
init_holes = args[1:]
n_holes = len(init_holes)
# If initialized as Polygon(shell, (LinearRing, LinearRing)) [for backward-compatibility]
if n_holes == 1 and isinstance(init_holes[0], (tuple, list)):
if len(init_holes[0]) == 0:
init_holes = ()
n_holes = 0
elif isinstance(init_holes[0][0], LinearRing):
init_holes = init_holes[0]
n_holes = len(init_holes)
polygon = self._create_polygon(n_holes + 1, (ext_ring,) + init_holes)
super(Polygon, self).__init__(polygon, **kwargs)
def __iter__(self):
"Iterates over each ring in the polygon."
for i in xrange(len(self)):
yield self[i]
def __len__(self):
"Returns the number of rings in this Polygon."
return self.num_interior_rings + 1
@classmethod
def from_bbox(cls, bbox):
"Constructs a Polygon from a bounding box (4-tuple)."
x0, y0, x1, y1 = bbox
return GEOSGeometry( 'POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))' % (
x0, y0, x0, y1, x1, y1, x1, y0, x0, y0) )
### These routines are needed for list-like operation w/ListMixin ###
def _create_polygon(self, length, items):
# Instantiate LinearRing objects if necessary, but don't clone them yet
# _construct_ring will throw a TypeError if a parameter isn't a valid ring
# If we cloned the pointers here, we wouldn't be able to clean up
# in case of error.
rings = []
for r in items:
if isinstance(r, GEOM_PTR):
rings.append(r)
else:
rings.append(self._construct_ring(r))
shell = self._clone(rings.pop(0))
n_holes = length - 1
if n_holes:
holes = get_pointer_arr(n_holes)
for i, r in enumerate(rings):
holes[i] = self._clone(r)
holes_param = byref(holes)
else:
holes_param = None
return capi.create_polygon(shell, holes_param, c_uint(n_holes))
def _clone(self, g):
if isinstance(g, GEOM_PTR):
return capi.geom_clone(g)
else:
return capi.geom_clone(g.ptr)
def _construct_ring(self, param, msg='Parameter must be a sequence of LinearRings or objects that can initialize to LinearRings'):
"Helper routine for trying to construct a ring from the given parameter."
if isinstance(param, LinearRing): return param
try:
ring = LinearRing(param)
return ring
except TypeError:
raise TypeError(msg)
def _set_list(self, length, items):
# Getting the current pointer, replacing with the newly constructed
# geometry, and destroying the old geometry.
prev_ptr = self.ptr
srid = self.srid
self.ptr = self._create_polygon(length, items)
if srid: self.srid = srid
capi.destroy_geom(prev_ptr)
def _get_single_internal(self, index):
"""
Returns the ring at the specified index. The first index, 0, will
always return the exterior ring. Indices > 0 will return the
interior ring at the given index (e.g., poly[1] and poly[2] would
return the first and second interior ring, respectively).
CAREFUL: Internal/External are not the same as Interior/Exterior!
_get_single_internal returns a pointer from the existing geometries for use
internally by the object's methods. _get_single_external returns a clone
of the same geometry for use by external code.
"""
if index == 0:
return capi.get_extring(self.ptr)
else:
# Getting the interior ring, have to subtract 1 from the index.
return capi.get_intring(self.ptr, index-1)
def _get_single_external(self, index):
return GEOSGeometry(capi.geom_clone(self._get_single_internal(index)), srid=self.srid)
_set_single = GEOSGeometry._set_single_rebuild
_assign_extended_slice = GEOSGeometry._assign_extended_slice_rebuild
#### Polygon Properties ####
@property
def num_interior_rings(self):
"Returns the number of interior rings."
# Getting the number of rings
return capi.get_nrings(self.ptr)
def _get_ext_ring(self):
"Gets the exterior ring of the Polygon."
return self[0]
def _set_ext_ring(self, ring):
"Sets the exterior ring of the Polygon."
self[0] = ring
# Properties for the exterior ring/shell.
exterior_ring = property(_get_ext_ring, _set_ext_ring)
shell = exterior_ring
@property
def tuple(self):
"Gets the tuple for each ring in this Polygon."
return tuple([self[i].tuple for i in xrange(len(self))])
coords = tuple
@property
def kml(self):
"Returns the KML representation of this Polygon."
inner_kml = ''.join(["<innerBoundaryIs>%s</innerBoundaryIs>" % self[i+1].kml
for i in xrange(self.num_interior_rings)])
return "<Polygon><outerBoundaryIs>%s</outerBoundaryIs>%s</Polygon>" % (self[0].kml, inner_kml)
| ajibawa-2023/Python-Code-Large/train/row_98736 | 95 | 166 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98736:ImportFrom_L1_C0", "label": "from ctypes import c_uint, byref", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.006, 0.006, 0, 0.66, 0.0, 182, 0, 2, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_uint", "byref"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import c_uint, byref"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:ImportFrom_L2_C0", "label": "from django.contrib.gis.geos.error import GEOSIndexError", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.012, 0.006, 0, 0.66, 0.1667, 827, 0, 1, 0, 0, 827, 0, 0], "semantic": {"name": "django.contrib.gis.geos.error", "arg_names": [], "import_names": ["GEOSIndexError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.error import GEOSIndexError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:ImportFrom_L3_C0", "label": "from django.contrib.gis.geos.geometry import GEOSGeometry", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0181, 0.006, 0, 0.66, 0.3333, 843, 0, 1, 0, 0, 843, 0, 0], "semantic": {"name": "django.contrib.gis.geos.geometry", "arg_names": [], "import_names": ["GEOSGeometry"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.geometry import GEOSGeometry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:ImportFrom_L4_C0", "label": "from django.contrib.gis.geos.libgeos import get_pointer_arr, GEOM_PTR", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0241, 0.006, 0, 0.66, 0.5, 64, 0, 2, 0, 0, 64, 0, 0], "semantic": {"name": "django.contrib.gis.geos.libgeos", "arg_names": [], "import_names": ["get_pointer_arr", "GEOM_PTR"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.libgeos import get_pointer_arr, GEOM_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:ImportFrom_L5_C0", "label": "from django.contrib.gis.geos.linestring import LinearRing", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0301, 0.006, 0, 0.66, 0.6667, 662, 0, 1, 0, 0, 662, 0, 0], "semantic": {"name": "django.contrib.gis.geos.linestring", "arg_names": [], "import_names": ["LinearRing"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.linestring import LinearRing"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:ImportFrom_L6_C0", "label": "from django.contrib.gis.geos import capi", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0361, 0.006, 0, 0.66, 0.8333, 886, 0, 1, 0, 0, 886, 0, 0], "semantic": {"name": "django.contrib.gis.geos", "arg_names": [], "import_names": ["capi"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos import prototypes as capi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "label": "Polygon", "type": "class", "loc": [8, 166], "level": 0, "parent": null, "vector": [3, 0, 0.5241, 0.9578, 0, 0.66, 1.0, 818, 0, 15, 0, 0, 958, 0, 44], "semantic": {"name": "Polygon", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Polygon(GEOSGeometry):\n _minlength = 1\n\n def __init__(self, *args, **kwargs):\n \"\"\"\n Initializes on an exterior ring and a sequence of holes (both\n instances may be either LinearRing instances, or a tuple/list\n that may be constructed into a LinearRing)."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L9_C4", "label": "_minlength =", "type": "assigned_variable", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "vector": [14, 1, 0.0542, 0.006, 1, 0.93, 0.0, 990, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "_minlength", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _minlength = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L11_C4", "label": "__init__", "type": "function", "loc": [11, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "vector": [2, 1, 0.1657, 0.2048, 1, 0.93, 0.05, 555, 0, 3, 0, 0, 0, 0, 9], "semantic": {"name": "__init__", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, *args, **kwargs):\n \"\"\"\n Initializes on an exterior ring and a sequence of holes (both\n instances may be either LinearRing instances, or a tuple/list\n that may be constructed into a LinearRing).\n\n Examples of initialization, where shell, hole1, and hole2 are\n valid LinearRing geometries:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L12_C8", "label": "expression", "type": "expression", "loc": [12, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L11_C4", "vector": [8, 2, 0.1114, 0.0843, 2, 0.65, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Initializes on an exterior ring and a sequence of holes (both\n instances may be either LinearRing instances, or a tuple/list\n that may be constructed into a LinearRing).\n\n Examples of initialization, where shell, hole1, and hole2 are\n valid LinearRing geometries:\n >>> poly = Polygon(shell, hole1, hole2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L26_C8", "label": "if", "type": "if", "loc": [26, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L11_C4", "vector": [4, 2, 0.1596, 0.012, 2, 0.65, 0.1429, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not args:\n raise TypeError('Must provide at least one LinearRing, or a tuple, to initialize a Polygon.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L30_C8", "label": "ext_ring =", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L11_C4", "vector": [14, 2, 0.1807, 0.006, 2, 0.65, 0.2857, 80, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ext_ring", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ext_ring = args[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L31_C8", "label": "init_holes =", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L11_C4", "vector": [14, 2, 0.1867, 0.006, 2, 0.65, 0.4286, 458, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "init_holes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " init_holes = args[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L32_C8", "label": "n_holes = len()", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L11_C4", "vector": [14, 2, 0.1928, 0.006, 2, 0.65, 0.5714, 812, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "n_holes", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " n_holes = len(init_holes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L35_C8", "label": "if", "type": "if", "loc": [35, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L11_C4", "vector": [4, 2, 0.2289, 0.0422, 2, 0.65, 0.7143, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if n_holes == 1 and isinstance(init_holes[0], (tuple, list)):\n if len(init_holes[0]) == 0:\n init_holes = ()\n n_holes = 0\n elif isinstance(init_holes[0][0], LinearRing):\n init_holes = init_holes[0]\n n_holes = len(init_holes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L36_C12", "label": "if", "type": "if", "loc": [36, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L35_C8", "vector": [4, 3, 0.2319, 0.0361, 3, 0.2, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(init_holes[0]) == 0:\n init_holes = ()\n n_holes = 0\n elif isinstance(init_holes[0][0], LinearRing):\n init_holes = init_holes[0]\n n_holes = len(init_holes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L37_C16", "label": "init_holes =", "type": "assigned_variable", "loc": [37, 37], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L36_C12", "vector": [14, 4, 0.2229, 0.006, 4, 0.48, 0.0, 458, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "init_holes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " init_holes = ()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L38_C16", "label": "n_holes =", "type": "assigned_variable", "loc": [38, 38], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L36_C12", "vector": [14, 4, 0.2289, 0.006, 4, 0.48, 0.5, 812, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "n_holes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " n_holes = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L39_C12", "label": "if", "type": "if", "loc": [39, 41], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L36_C12", "vector": [4, 4, 0.241, 0.0181, 4, 0.48, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(init_holes[0][0], LinearRing):\n init_holes = init_holes[0]\n n_holes = len(init_holes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L40_C16", "label": "init_holes =", "type": "assigned_variable", "loc": [40, 40], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L39_C12", "vector": [14, 5, 0.241, 0.006, 5, 0.95, 0.0, 458, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "init_holes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " init_holes = init_holes[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L41_C16", "label": "n_holes = len()", "type": "assigned_variable", "loc": [41, 41], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L39_C12", "vector": [14, 5, 0.247, 0.006, 5, 0.95, 1.0, 812, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "n_holes", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " n_holes = len(init_holes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L43_C8", "label": "polygon = _create_polygon()", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L11_C4", "vector": [14, 2, 0.259, 0.006, 2, 0.65, 0.8571, 854, 3, 2, 0, 0, 570, 10, 1], "semantic": {"name": "polygon", "arg_names": [], "import_names": [], "rhs_call_name": "_create_polygon", "annotation": ""}, "snippet": " polygon = self._create_polygon(n_holes + 1, (ext_ring,) + init_holes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L44_C8", "label": "__init__()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L11_C4", "vector": [8, 2, 0.2651, 0.006, 2, 0.65, 1.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(Polygon, self).__init__(polygon, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L46_C4", "label": "__iter__", "type": "function", "loc": [46, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "vector": [2, 1, 0.2861, 0.0241, 1, 0.93, 0.1, 891, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n \"Iterates over each ring in the polygon.\"\n for i in xrange(len(self)):\n yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L47_C8", "label": "expression", "type": "expression", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L46_C4", "vector": [8, 2, 0.2831, 0.006, 2, 0.81, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Iterates over each ring in the polygon.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:For_L48_C8", "label": "for i", "type": "for", "loc": [48, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L46_C4", "vector": [6, 2, 0.2922, 0.012, 2, 0.81, 1.0, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange(len(self)):\n yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L49_C12", "label": "expression", "type": "expression", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:For_L48_C8", "vector": [8, 3, 0.2952, 0.006, 3, 0.74, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L51_C4", "label": "__len__", "type": "function", "loc": [51, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "vector": [2, 1, 0.3133, 0.0181, 1, 0.93, 0.15, 76, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__len__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __len__(self):\n \"Returns the number of rings in this Polygon.\"\n return self.num_interior_rings + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L52_C8", "label": "expression", "type": "expression", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L51_C4", "vector": [8, 2, 0.3133, 0.006, 2, 0.77, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the number of rings in this Polygon.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L53_C8", "label": "return", "type": "return", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L51_C4", "vector": [13, 2, 0.3193, 0.006, 2, 0.77, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.num_interior_rings + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L56_C4", "label": "from_bbox", "type": "function", "loc": [56, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "vector": [2, 1, 0.3494, 0.0301, 1, 0.93, 0.2, 671, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "from_bbox", "arg_names": ["cls", "bbox"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_bbox(cls, bbox):\n \"Constructs a Polygon from a bounding box (4-tuple).\"\n x0, y0, x1, y1 = bbox\n return GEOSGeometry( 'POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))' % (\n x0, y0, x0, y1, x1, y1, x1, y0, x0, y0) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L57_C8", "label": "expression", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L56_C4", "vector": [8, 2, 0.3434, 0.006, 2, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Constructs a Polygon from a bounding box (4-tuple).\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L58_C8", "label": "x0, y0, x1, y1 =", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L56_C4", "vector": [14, 2, 0.3494, 0.006, 2, 0.72, 0.5, 793, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "x0, y0, x1, y1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " x0, y0, x1, y1 = bbox"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L59_C8", "label": "return", "type": "return", "loc": [59, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L56_C4", "vector": [13, 2, 0.3584, 0.012, 2, 0.72, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return GEOSGeometry( 'POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))' % (\n x0, y0, x0, y1, x1, y1, x1, y0, x0, y0) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L63_C4", "label": "_create_polygon", "type": "function", "loc": [63, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "vector": [2, 1, 0.4488, 0.1446, 1, 0.93, 0.25, 570, 0, 3, 1, 0, 0, 0, 12], "semantic": {"name": "_create_polygon", "arg_names": ["self", "length", "items"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _create_polygon(self, length, items):\n # Instantiate LinearRing objects if necessary, but don't clone them yet\n # _construct_ring will throw a TypeError if a parameter isn't a valid ring\n # If we cloned the pointers here, we wouldn't be able to clean up\n # in case of error.\n rings = []\n for r in items:\n if isinstance(r, GEOM_PTR):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L68_C8", "label": "rings =", "type": "assigned_variable", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L63_C4", "vector": [14, 2, 0.4096, 0.006, 2, 0.15, 0.0, 462, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "rings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rings = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:For_L69_C8", "label": "for r", "type": "for", "loc": [69, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L63_C4", "vector": [6, 2, 0.4277, 0.0301, 2, 0.15, 0.2, 436, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for r in items:\n if isinstance(r, GEOM_PTR):\n rings.append(r)\n else:\n rings.append(self._construct_ring(r))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L70_C12", "label": "if", "type": "if", "loc": [70, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:For_L69_C8", "vector": [4, 3, 0.4307, 0.0241, 3, 0.94, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(r, GEOM_PTR):\n rings.append(r)\n else:\n rings.append(self._construct_ring(r))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L71_C16", "label": "append()", "type": "expression", "loc": [71, 71], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L70_C12", "vector": [8, 4, 0.4277, 0.006, 4, 0.86, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " rings.append(r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L73_C16", "label": "append()", "type": "expression", "loc": [73, 73], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L70_C12", "vector": [8, 4, 0.4398, 0.006, 4, 0.86, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " rings.append(self._construct_ring(r))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L75_C8", "label": "shell = _clone()", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L63_C4", "vector": [14, 2, 0.4518, 0.006, 2, 0.15, 0.4, 192, 3, 1, 0, 0, 617, 10, 2], "semantic": {"name": "shell", "arg_names": [], "import_names": [], "rhs_call_name": "_clone", "annotation": ""}, "snippet": " shell = self._clone(rings.pop(0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L77_C8", "label": "n_holes =", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L63_C4", "vector": [14, 2, 0.4639, 0.006, 2, 0.15, 0.6, 812, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "n_holes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " n_holes = length - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L78_C8", "label": "if", "type": "if", "loc": [78, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L63_C4", "vector": [4, 2, 0.488, 0.0422, 2, 0.15, 0.8, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if n_holes:\n holes = get_pointer_arr(n_holes)\n for i, r in enumerate(rings):\n holes[i] = self._clone(r)\n holes_param = byref(holes)\n else:\n holes_param = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L79_C12", "label": "holes = get_pointer_arr()", "type": "assigned_variable", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L78_C8", "vector": [14, 3, 0.4759, 0.006, 3, 0.72, 0.0, 294, 3, 1, 0, 0, 677, 10, 1], "semantic": {"name": "holes", "arg_names": [], "import_names": [], "rhs_call_name": "get_pointer_arr", "annotation": ""}, "snippet": " holes = get_pointer_arr(n_holes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:For_L80_C12", "label": "for i, r", "type": "for", "loc": [80, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L78_C8", "vector": [6, 3, 0.488, 0.0181, 3, 0.72, 0.5, 556, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i, r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, r in enumerate(rings):\n holes[i] = self._clone(r)\n holes_param = byref(holes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L81_C16", "label": " = _clone()", "type": "assigned_variable", "loc": [81, 81], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:For_L80_C12", "vector": [14, 4, 0.488, 0.006, 4, 0.91, 0.0, 0, 3, 1, 0, 0, 617, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "_clone", "annotation": ""}, "snippet": " holes[i] = self._clone(r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L82_C16", "label": "holes_param = byref()", "type": "assigned_variable", "loc": [82, 82], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:For_L80_C12", "vector": [14, 4, 0.494, 0.006, 4, 0.91, 1.0, 822, 3, 1, 0, 0, 417, 10, 1], "semantic": {"name": "holes_param", "arg_names": [], "import_names": [], "rhs_call_name": "byref", "annotation": ""}, "snippet": " holes_param = byref(holes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L84_C12", "label": "holes_param =", "type": "assigned_variable", "loc": [84, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L78_C8", "vector": [14, 3, 0.506, 0.006, 3, 0.72, 1.0, 822, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "holes_param", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " holes_param = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L86_C8", "label": "return", "type": "return", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L63_C4", "vector": [13, 2, 0.5181, 0.006, 2, 0.15, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.create_polygon(shell, holes_param, c_uint(n_holes))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L88_C4", "label": "_clone", "type": "function", "loc": [88, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "vector": [2, 1, 0.5422, 0.0301, 1, 0.93, 0.3, 617, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "_clone", "arg_names": ["self", "g"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _clone(self, g):\n if isinstance(g, GEOM_PTR):\n return capi.geom_clone(g)\n else:\n return capi.geom_clone(g.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L89_C8", "label": "if", "type": "if", "loc": [89, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L88_C4", "vector": [4, 2, 0.5452, 0.0241, 2, 0.92, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(g, GEOM_PTR):\n return capi.geom_clone(g)\n else:\n return capi.geom_clone(g.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L90_C12", "label": "return", "type": "return", "loc": [90, 90], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L89_C8", "vector": [13, 3, 0.5422, 0.006, 3, 0.33, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.geom_clone(g)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L92_C12", "label": "return", "type": "return", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L89_C8", "vector": [13, 3, 0.5542, 0.006, 3, 0.33, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.geom_clone(g.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L94_C4", "label": "_construct_ring", "type": "function", "loc": [94, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "vector": [2, 1, 0.5873, 0.0482, 1, 0.93, 0.35, 762, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "_construct_ring", "arg_names": ["self", "param", "msg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _construct_ring(self, param, msg='Parameter must be a sequence of LinearRings or objects that can initialize to LinearRings'):\n \"Helper routine for trying to construct a ring from the given parameter.\"\n if isinstance(param, LinearRing): return param\n try:\n ring = LinearRing(param)\n return ring\n except TypeError:\n raise TypeError(msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L95_C8", "label": "expression", "type": "expression", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L94_C4", "vector": [8, 2, 0.5723, 0.006, 2, 0.69, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Helper routine for trying to construct a ring from the given parameter.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L96_C8", "label": "if", "type": "if", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L94_C4", "vector": [4, 2, 0.5783, 0.006, 2, 0.69, 0.5, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(param, LinearRing): return param"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L96_C42", "label": "return", "type": "return", "loc": [96, 96], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L96_C8", "vector": [13, 3, 0.5783, 0.006, 3, 0.02, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(param, LinearRing): return param"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Try_L97_C8", "label": "try", "type": "try", "loc": [97, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L94_C4", "vector": [7, 2, 0.5964, 0.0301, 2, 0.69, 1.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n ring = LinearRing(param)\n return ring\n except TypeError:\n raise TypeError(msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L98_C12", "label": "ring = LinearRing()", "type": "assigned_variable", "loc": [98, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:Try_L97_C8", "vector": [14, 3, 0.5904, 0.006, 3, 0.27, 0.0, 661, 3, 1, 0, 0, 441, 10, 1], "semantic": {"name": "ring", "arg_names": [], "import_names": [], "rhs_call_name": "LinearRing", "annotation": ""}, "snippet": " ring = LinearRing(param)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L99_C12", "label": "return", "type": "return", "loc": [99, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:Try_L97_C8", "vector": [13, 3, 0.5964, 0.006, 3, 0.27, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ring"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L103_C4", "label": "_set_list", "type": "function", "loc": [103, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "vector": [2, 1, 0.6416, 0.0482, 1, 0.93, 0.4, 305, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "_set_list", "arg_names": ["self", "length", "items"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_list(self, length, items):\n # Getting the current pointer, replacing with the newly constructed\n # geometry, and destroying the old geometry.\n prev_ptr = self.ptr\n srid = self.srid\n self.ptr = self._create_polygon(length, items)\n if srid: self.srid = srid\n capi.destroy_geom(prev_ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L106_C8", "label": "prev_ptr =", "type": "assigned_variable", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L103_C4", "vector": [14, 2, 0.6386, 0.006, 2, 0.56, 0.0, 766, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "prev_ptr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prev_ptr = self.ptr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L107_C8", "label": "srid =", "type": "assigned_variable", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L103_C4", "vector": [14, 2, 0.6446, 0.006, 2, 0.56, 0.25, 357, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "srid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " srid = self.srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L108_C8", "label": "self.ptr = _create_polygon()", "type": "assigned_variable", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L103_C4", "vector": [14, 2, 0.6506, 0.006, 2, 0.56, 0.5, 386, 3, 2, 0, 0, 570, 10, 1], "semantic": {"name": "self.ptr", "arg_names": [], "import_names": [], "rhs_call_name": "_create_polygon", "annotation": ""}, "snippet": " self.ptr = self._create_polygon(length, items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L109_C8", "label": "if", "type": "if", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L103_C4", "vector": [4, 2, 0.6566, 0.006, 2, 0.56, 0.75, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if srid: self.srid = srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L109_C17", "label": "self.srid =", "type": "assigned_variable", "loc": [109, 109], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L109_C8", "vector": [14, 3, 0.6566, 0.006, 3, 0.76, 0.0, 289, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.srid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if srid: self.srid = srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L110_C8", "label": "destroy_geom()", "type": "expression", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L103_C4", "vector": [8, 2, 0.6627, 0.006, 2, 0.56, 1.0, 266, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "destroy_geom", "arg_names": [], "import_names": [], "rhs_call_name": "destroy_geom", "annotation": ""}, "snippet": " capi.destroy_geom(prev_ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L112_C4", "label": "_get_single_internal", "type": "function", "loc": [112, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "vector": [2, 1, 0.7229, 0.1024, 1, 0.93, 0.45, 98, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "_get_single_internal", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_single_internal(self, index):\n \"\"\"\n Returns the ring at the specified index. The first index, 0, will\n always return the exterior ring. Indices > 0 will return the\n interior ring at the given index (e.g., poly[1] and poly[2] would\n return the first and second interior ring, respectively).\n\n CAREFUL: Internal/External are not the same as Interior/Exterior!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L113_C8", "label": "expression", "type": "expression", "loc": [113, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L112_C4", "vector": [8, 2, 0.7108, 0.0663, 2, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the ring at the specified index. The first index, 0, will\n always return the exterior ring. Indices > 0 will return the\n interior ring at the given index (e.g., poly[1] and poly[2] would\n return the first and second interior ring, respectively).\n\n CAREFUL: Internal/External are not the same as Interior/Exterior!\n _get_single_internal returns a pointer from the existing geometries for use"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L124_C8", "label": "if", "type": "if", "loc": [124, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L112_C4", "vector": [4, 2, 0.759, 0.0301, 2, 0.18, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if index == 0:\n return capi.get_extring(self.ptr)\n else:\n # Getting the interior ring, have to subtract 1 from the index.\n return capi.get_intring(self.ptr, index-1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L125_C12", "label": "return", "type": "return", "loc": [125, 125], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L124_C8", "vector": [13, 3, 0.753, 0.006, 3, 0.16, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_extring(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L128_C12", "label": "return", "type": "return", "loc": [128, 128], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L124_C8", "vector": [13, 3, 0.7711, 0.006, 3, 0.16, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_intring(self.ptr, index-1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L130_C4", "label": "_get_single_external", "type": "function", "loc": [130, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "vector": [2, 1, 0.7861, 0.012, 1, 0.93, 0.5, 470, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "_get_single_external", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_single_external(self, index):\n return GEOSGeometry(capi.geom_clone(self._get_single_internal(index)), srid=self.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L131_C8", "label": "return", "type": "return", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L130_C4", "vector": [13, 2, 0.7892, 0.006, 2, 0.3, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return GEOSGeometry(capi.geom_clone(self._get_single_internal(index)), srid=self.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L133_C4", "label": "_set_single =", "type": "assigned_variable", "loc": [133, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "vector": [14, 1, 0.8012, 0.006, 1, 0.93, 0.55, 950, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_set_single", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _set_single = GEOSGeometry._set_single_rebuild"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L134_C4", "label": "_assign_extended_slice =", "type": "assigned_variable", "loc": [134, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "vector": [14, 1, 0.8072, 0.006, 1, 0.93, 0.6, 725, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_assign_extended_slice", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _assign_extended_slice = GEOSGeometry._assign_extended_slice_rebuild"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L138_C4", "label": "num_interior_rings", "type": "function", "loc": [138, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "vector": [2, 1, 0.8404, 0.0241, 1, 0.93, 0.65, 69, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "num_interior_rings", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def num_interior_rings(self):\n \"Returns the number of interior rings.\"\n # Getting the number of rings\n return capi.get_nrings(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L139_C8", "label": "expression", "type": "expression", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L138_C4", "vector": [8, 2, 0.8373, 0.006, 2, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the number of interior rings.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L141_C8", "label": "return", "type": "return", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L138_C4", "vector": [13, 2, 0.8494, 0.006, 2, 0.54, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_nrings(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L143_C4", "label": "_get_ext_ring", "type": "function", "loc": [143, 145], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "vector": [2, 1, 0.8675, 0.0181, 1, 0.93, 0.7, 552, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "_get_ext_ring", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_ext_ring(self):\n \"Gets the exterior ring of the Polygon.\"\n return self[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L144_C8", "label": "expression", "type": "expression", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L143_C4", "vector": [8, 2, 0.8675, 0.006, 2, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Gets the exterior ring of the Polygon.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L145_C8", "label": "return", "type": "return", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L143_C4", "vector": [13, 2, 0.8735, 0.006, 2, 0.07, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L147_C4", "label": "_set_ext_ring", "type": "function", "loc": [147, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "vector": [2, 1, 0.8916, 0.0181, 1, 0.93, 0.75, 97, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "_set_ext_ring", "arg_names": ["self", "ring"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_ext_ring(self, ring):\n \"Sets the exterior ring of the Polygon.\"\n self[0] = ring"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L148_C8", "label": "expression", "type": "expression", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L147_C4", "vector": [8, 2, 0.8916, 0.006, 2, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Sets the exterior ring of the Polygon.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L149_C8", "label": "assign", "type": "assigned_variable", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L147_C4", "vector": [14, 2, 0.8976, 0.006, 2, 0.45, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self[0] = ring"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L152_C4", "label": "exterior_ring = property()", "type": "assigned_variable", "loc": [152, 152], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "vector": [14, 1, 0.9157, 0.006, 1, 0.93, 0.8, 988, 3, 2, 0, 0, 244, 10, 1], "semantic": {"name": "exterior_ring", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " exterior_ring = property(_get_ext_ring, _set_ext_ring)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L153_C4", "label": "shell =", "type": "assigned_variable", "loc": [153, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "vector": [14, 1, 0.9217, 0.006, 1, 0.93, 0.85, 192, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "shell", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " shell = exterior_ring"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L156_C4", "label": "tuple", "type": "function", "loc": [156, 158], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "vector": [2, 1, 0.9458, 0.0181, 1, 0.93, 0.9, 259, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "tuple", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def tuple(self):\n \"Gets the tuple for each ring in this Polygon.\"\n return tuple([self[i].tuple for i in xrange(len(self))])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L157_C8", "label": "expression", "type": "expression", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L156_C4", "vector": [8, 2, 0.9458, 0.006, 2, 0.96, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Gets the tuple for each ring in this Polygon.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L158_C8", "label": "return", "type": "return", "loc": [158, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L156_C4", "vector": [13, 2, 0.9518, 0.006, 2, 0.96, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return tuple([self[i].tuple for i in xrange(len(self))])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L159_C4", "label": "coords =", "type": "assigned_variable", "loc": [159, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "vector": [14, 1, 0.9578, 0.006, 1, 0.93, 0.95, 216, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "coords", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " coords = tuple"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L162_C4", "label": "kml", "type": "function", "loc": [162, 166], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "vector": [2, 1, 0.988, 0.0301, 1, 0.93, 1.0, 168, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "kml", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def kml(self):\n \"Returns the KML representation of this Polygon.\"\n inner_kml = ''.join([\"<innerBoundaryIs>%s</innerBoundaryIs>\" % self[i+1].kml\n for i in xrange(self.num_interior_rings)])\n return \"<Polygon><outerBoundaryIs>%s</outerBoundaryIs>%s</Polygon>\" % (self[0].kml, inner_kml)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L163_C8", "label": "expression", "type": "expression", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L162_C4", "vector": [8, 2, 0.9819, 0.006, 2, 0.8, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the KML representation of this Polygon.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L164_C8", "label": "inner_kml = join()", "type": "assigned_variable", "loc": [164, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L162_C4", "vector": [14, 2, 0.991, 0.012, 2, 0.8, 0.5, 495, 3, 1, 0, 0, 933, 10, 2], "semantic": {"name": "inner_kml", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " inner_kml = ''.join([\"<innerBoundaryIs>%s</innerBoundaryIs>\" % self[i+1].kml\n for i in xrange(self.num_interior_rings)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L166_C8", "label": "return", "type": "return", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L162_C4", "vector": [13, 2, 1.0, 0.006, 2, 0.8, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"<Polygon><outerBoundaryIs>%s</outerBoundaryIs>%s</Polygon>\" % (self[0].kml, inner_kml)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L36_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L36_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L37_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L36_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L38_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L36_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L39_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L39_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L40_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L39_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L41_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:For_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:For_L48_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:For_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:For_L69_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L70_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L70_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L71_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L70_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L73_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L78_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L78_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:For_L80_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:For_L80_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L81_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:For_L80_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L82_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L78_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L84_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L90_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L92_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L96_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L96_C42"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Try_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:Try_L97_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L98_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:Try_L97_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L99_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L109_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L109_C17"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L125_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:If_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L128_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L138_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L143_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L143_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L147_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L147_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L156_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L156_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Expr_L163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Return_L166_C8"}] |
from django.contrib.gis.geos.base import GEOSBase
from django.contrib.gis.geos.geometry import GEOSGeometry
from django.contrib.gis.geos.prototypes import prepared as capi
class PreparedGeometry(GEOSBase):
"""
A geometry that is prepared for performing certain operations.
At the moment this includes the contains covers, and intersects
operations.
"""
ptr_type = capi.PREPGEOM_PTR
def __init__(self, geom):
if not isinstance(geom, GEOSGeometry): raise TypeError
self.ptr = capi.geos_prepare(geom.ptr)
def __del__(self):
if self._ptr: capi.prepared_destroy(self._ptr)
def contains(self, other):
return capi.prepared_contains(self.ptr, other.ptr)
def contains_properly(self, other):
return capi.prepared_contains_properly(self.ptr, other.ptr)
def covers(self, other):
return capi.prepared_covers(self.ptr, other.ptr)
def intersects(self, other):
return capi.prepared_intersects(self.ptr, other.ptr)
| ajibawa-2023/Python-Code-Large/train/row_98737 | 20 | 30 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98737:ImportFrom_L1_C0", "label": "from django.contrib.gis.geos.base import GEOSBase", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0333, 0.0333, 0, 0.66, 0.0, 386, 0, 1, 0, 0, 386, 0, 0], "semantic": {"name": "django.contrib.gis.geos.base", "arg_names": [], "import_names": ["GEOSBase"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.base import GEOSBase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98737:ImportFrom_L2_C0", "label": "from django.contrib.gis.geos.geometry import GEOSGeometry", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0667, 0.0333, 0, 0.66, 0.3333, 843, 0, 1, 0, 0, 843, 0, 0], "semantic": {"name": "django.contrib.gis.geos.geometry", "arg_names": [], "import_names": ["GEOSGeometry"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.geometry import GEOSGeometry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98737:ImportFrom_L3_C0", "label": "from django.contrib.gis.geos.prototypes import capi", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1, 0.0333, 0, 0.66, 0.6667, 856, 0, 1, 0, 0, 856, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes", "arg_names": [], "import_names": ["capi"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes import prepared as capi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98737:ClassDef_L5_C0", "label": "PreparedGeometry", "type": "class", "loc": [5, 30], "level": 0, "parent": null, "vector": [3, 0, 0.5833, 0.8667, 0, 0.66, 1.0, 723, 0, 6, 0, 0, 274, 0, 7], "semantic": {"name": "PreparedGeometry", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PreparedGeometry(GEOSBase):\n \"\"\"\n A geometry that is prepared for performing certain operations.\n At the moment this includes the contains covers, and intersects\n operations.\n \"\"\"\n ptr_type = capi.PREPGEOM_PTR\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98737:Expr_L6_C4", "label": "expression", "type": "expression", "loc": [6, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98737:ClassDef_L5_C0", "vector": [8, 1, 0.2667, 0.1667, 1, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n A geometry that is prepared for performing certain operations.\n At the moment this includes the contains covers, and intersects\n operations.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98737:Assign_L11_C4", "label": "ptr_type =", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98737:ClassDef_L5_C0", "vector": [14, 1, 0.3667, 0.0333, 1, 0.18, 0.1429, 247, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ptr_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ptr_type = capi.PREPGEOM_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L13_C4", "label": "__init__", "type": "function", "loc": [13, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98737:ClassDef_L5_C0", "vector": [2, 1, 0.4667, 0.1, 1, 0.18, 0.2857, 555, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "geom"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, geom):\n if not isinstance(geom, GEOSGeometry): raise TypeError\n self.ptr = capi.geos_prepare(geom.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98737:If_L14_C8", "label": "if", "type": "if", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L13_C4", "vector": [4, 2, 0.4667, 0.0333, 2, 0.47, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(geom, GEOSGeometry): raise TypeError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98737:Assign_L15_C8", "label": "self.ptr = geos_prepare()", "type": "assigned_variable", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L13_C4", "vector": [14, 2, 0.5, 0.0333, 2, 0.47, 1.0, 386, 3, 1, 0, 0, 524, 10, 1], "semantic": {"name": "self.ptr", "arg_names": [], "import_names": [], "rhs_call_name": "geos_prepare", "annotation": ""}, "snippet": " self.ptr = capi.geos_prepare(geom.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L17_C4", "label": "__del__", "type": "function", "loc": [17, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98737:ClassDef_L5_C0", "vector": [2, 1, 0.5833, 0.0667, 1, 0.18, 0.4286, 258, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__del__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __del__(self):\n if self._ptr: capi.prepared_destroy(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98737:If_L18_C8", "label": "if", "type": "if", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L17_C4", "vector": [4, 2, 0.6, 0.0333, 2, 0.8, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._ptr: capi.prepared_destroy(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98737:Expr_L18_C22", "label": "prepared_destroy()", "type": "expression", "loc": [18, 18], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98737:If_L18_C8", "vector": [8, 3, 0.6, 0.0333, 3, 0.43, 0.0, 17, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "prepared_destroy", "arg_names": [], "import_names": [], "rhs_call_name": "prepared_destroy", "annotation": ""}, "snippet": " if self._ptr: capi.prepared_destroy(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L20_C4", "label": "contains", "type": "function", "loc": [20, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98737:ClassDef_L5_C0", "vector": [2, 1, 0.6833, 0.0667, 1, 0.18, 0.5714, 848, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "contains", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def contains(self, other):\n return capi.prepared_contains(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98737:Return_L21_C8", "label": "return", "type": "return", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L20_C4", "vector": [13, 2, 0.7, 0.0333, 2, 0.55, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.prepared_contains(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L23_C4", "label": "contains_properly", "type": "function", "loc": [23, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98737:ClassDef_L5_C0", "vector": [2, 1, 0.7833, 0.0667, 1, 0.18, 0.7143, 878, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "contains_properly", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def contains_properly(self, other):\n return capi.prepared_contains_properly(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98737:Return_L24_C8", "label": "return", "type": "return", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L23_C4", "vector": [13, 2, 0.8, 0.0333, 2, 0.55, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.prepared_contains_properly(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L26_C4", "label": "covers", "type": "function", "loc": [26, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98737:ClassDef_L5_C0", "vector": [2, 1, 0.8833, 0.0667, 1, 0.18, 0.8571, 40, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "covers", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def covers(self, other):\n return capi.prepared_covers(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98737:Return_L27_C8", "label": "return", "type": "return", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L26_C4", "vector": [13, 2, 0.9, 0.0333, 2, 0.78, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.prepared_covers(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L29_C4", "label": "intersects", "type": "function", "loc": [29, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98737:ClassDef_L5_C0", "vector": [2, 1, 0.9833, 0.0667, 1, 0.18, 1.0, 772, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "intersects", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def intersects(self, other):\n return capi.prepared_intersects(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98737:Return_L30_C8", "label": "return", "type": "return", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L29_C4", "vector": [13, 2, 1.0, 0.0333, 2, 0.09, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.prepared_intersects(self.ptr, other.ptr)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98737:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98737:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98737:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98737:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98737:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98737:If_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98737:Assign_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98737:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98737:If_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98737:If_L18_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98737:Expr_L18_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98737:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98737:Return_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98737:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98737:Return_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98737:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98737:Return_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98737:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98737:FunctionDef_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98737:Return_L30_C8"}] |
"""
This module houses the GEOSCoordSeq object, which is used internally
by GEOSGeometry to house the actual coordinates of the Point,
LineString, and LinearRing geometries.
"""
from ctypes import c_double, c_uint, byref
from django.contrib.gis.geos.base import GEOSBase, numpy
from django.contrib.gis.geos.error import GEOSException, GEOSIndexError
from django.contrib.gis.geos.libgeos import CS_PTR
from django.contrib.gis.geos import prototypes as capi
class GEOSCoordSeq(GEOSBase):
"The internal representation of a list of coordinates inside a Geometry."
ptr_type = CS_PTR
#### Python 'magic' routines ####
def __init__(self, ptr, z=False):
"Initializes from a GEOS pointer."
if not isinstance(ptr, CS_PTR):
raise TypeError('Coordinate sequence should initialize with a CS_PTR.')
self._ptr = ptr
self._z = z
def __iter__(self):
"Iterates over each point in the coordinate sequence."
for i in xrange(self.size):
yield self[i]
def __len__(self):
"Returns the number of points in the coordinate sequence."
return int(self.size)
def __str__(self):
"Returns the string representation of the coordinate sequence."
return str(self.tuple)
def __getitem__(self, index):
"Returns the coordinate sequence value at the given index."
coords = [self.getX(index), self.getY(index)]
if self.dims == 3 and self._z:
coords.append(self.getZ(index))
return tuple(coords)
def __setitem__(self, index, value):
"Sets the coordinate sequence value at the given index."
# Checking the input value
if isinstance(value, (list, tuple)):
pass
elif numpy and isinstance(value, numpy.ndarray):
pass
else:
raise TypeError('Must set coordinate with a sequence (list, tuple, or numpy array).')
# Checking the dims of the input
if self.dims == 3 and self._z:
n_args = 3
set_3d = True
else:
n_args = 2
set_3d = False
if len(value) != n_args:
raise TypeError('Dimension of value does not match.')
# Setting the X, Y, Z
self.setX(index, value[0])
self.setY(index, value[1])
if set_3d: self.setZ(index, value[2])
#### Internal Routines ####
def _checkindex(self, index):
"Checks the given index."
sz = self.size
if (sz < 1) or (index < 0) or (index >= sz):
raise GEOSIndexError('invalid GEOS Geometry index: %s' % str(index))
def _checkdim(self, dim):
"Checks the given dimension."
if dim < 0 or dim > 2:
raise GEOSException('invalid ordinate dimension "%d"' % dim)
#### Ordinate getting and setting routines ####
def getOrdinate(self, dimension, index):
"Returns the value for the given dimension and index."
self._checkindex(index)
self._checkdim(dimension)
return capi.cs_getordinate(self.ptr, index, dimension, byref(c_double()))
def setOrdinate(self, dimension, index, value):
"Sets the value for the given dimension and index."
self._checkindex(index)
self._checkdim(dimension)
capi.cs_setordinate(self.ptr, index, dimension, value)
def getX(self, index):
"Get the X value at the index."
return self.getOrdinate(0, index)
def setX(self, index, value):
"Set X with the value at the given index."
self.setOrdinate(0, index, value)
def getY(self, index):
"Get the Y value at the given index."
return self.getOrdinate(1, index)
def setY(self, index, value):
"Set Y with the value at the given index."
self.setOrdinate(1, index, value)
def getZ(self, index):
"Get Z with the value at the given index."
return self.getOrdinate(2, index)
def setZ(self, index, value):
"Set Z with the value at the given index."
self.setOrdinate(2, index, value)
### Dimensions ###
@property
def size(self):
"Returns the size of this coordinate sequence."
return capi.cs_getsize(self.ptr, byref(c_uint()))
@property
def dims(self):
"Returns the dimensions of this coordinate sequence."
return capi.cs_getdims(self.ptr, byref(c_uint()))
@property
def hasz(self):
"""
Returns whether this coordinate sequence is 3D. This property value is
inherited from the parent Geometry.
"""
return self._z
### Other Methods ###
def clone(self):
"Clones this coordinate sequence."
return GEOSCoordSeq(capi.cs_clone(self.ptr), self.hasz)
@property
def kml(self):
"Returns the KML representation for the coordinates."
# Getting the substitution string depending on whether the coordinates have
# a Z dimension.
if self.hasz: substr = '%s,%s,%s '
else: substr = '%s,%s,0 '
return '<coordinates>%s</coordinates>' % \
''.join([substr % self[i] for i in xrange(len(self))]).strip()
@property
def tuple(self):
"Returns a tuple version of this coordinate sequence."
n = self.size
if n == 1: return self[0]
else: return tuple([self[i] for i in xrange(n)])
| ajibawa-2023/Python-Code-Large/train/row_98738 | 103 | 156 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0192, 0.0321, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n This module houses the GEOSCoordSeq object, which is used internally\n by GEOSGeometry to house the actual coordinates of the Point,\n LineString, and LinearRing geometries.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:ImportFrom_L6_C0", "label": "from ctypes import c_double, c_uint, byref", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0385, 0.0064, 0, 0.66, 0.1667, 182, 0, 3, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_double", "c_uint", "byref"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import c_double, c_uint, byref"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:ImportFrom_L7_C0", "label": "from django.contrib.gis.geos.base import GEOSBase, numpy", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0449, 0.0064, 0, 0.66, 0.3333, 386, 0, 2, 0, 0, 386, 0, 0], "semantic": {"name": "django.contrib.gis.geos.base", "arg_names": [], "import_names": ["GEOSBase", "numpy"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.base import GEOSBase, numpy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:ImportFrom_L8_C0", "label": "from django.contrib.gis.geos.error import GEOSException, GEOSIndexError", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0513, 0.0064, 0, 0.66, 0.5, 827, 0, 2, 0, 0, 827, 0, 0], "semantic": {"name": "django.contrib.gis.geos.error", "arg_names": [], "import_names": ["GEOSException", "GEOSIndexError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.error import GEOSException, GEOSIndexError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:ImportFrom_L9_C0", "label": "from django.contrib.gis.geos.libgeos import CS_PTR", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0577, 0.0064, 0, 0.66, 0.6667, 64, 0, 1, 0, 0, 64, 0, 0], "semantic": {"name": "django.contrib.gis.geos.libgeos", "arg_names": [], "import_names": ["CS_PTR"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.libgeos import CS_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:ImportFrom_L10_C0", "label": "from django.contrib.gis.geos import capi", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0641, 0.0064, 0, 0.66, 0.8333, 886, 0, 1, 0, 0, 886, 0, 0], "semantic": {"name": "django.contrib.gis.geos", "arg_names": [], "import_names": ["capi"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos import prototypes as capi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "label": "GEOSCoordSeq", "type": "class", "loc": [12, 156], "level": 0, "parent": null, "vector": [3, 0, 0.5385, 0.9295, 0, 0.66, 1.0, 895, 0, 22, 0, 0, 274, 0, 49], "semantic": {"name": "GEOSCoordSeq", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GEOSCoordSeq(GEOSBase):\n \"The internal representation of a list of coordinates inside a Geometry.\"\n\n ptr_type = CS_PTR\n\n #### Python 'magic' routines ####\n def __init__(self, ptr, z=False):\n \"Initializes from a GEOS pointer.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L13_C4", "label": "expression", "type": "expression", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "vector": [8, 1, 0.0833, 0.0064, 1, 0.22, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"The internal representation of a list of coordinates inside a Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Assign_L15_C4", "label": "ptr_type =", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "vector": [14, 1, 0.0962, 0.0064, 1, 0.22, 0.0435, 247, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ptr_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ptr_type = CS_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L18_C4", "label": "__init__", "type": "function", "loc": [18, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "vector": [2, 1, 0.1314, 0.0385, 1, 0.22, 0.087, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "ptr", "z"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, ptr, z=False):\n \"Initializes from a GEOS pointer.\"\n if not isinstance(ptr, CS_PTR):\n raise TypeError('Coordinate sequence should initialize with a CS_PTR.')\n self._ptr = ptr\n self._z = z"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L19_C8", "label": "expression", "type": "expression", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L18_C4", "vector": [8, 2, 0.1218, 0.0064, 2, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Initializes from a GEOS pointer.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L20_C8", "label": "if", "type": "if", "loc": [20, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L18_C4", "vector": [4, 2, 0.1314, 0.0128, 2, 0.44, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(ptr, CS_PTR):\n raise TypeError('Coordinate sequence should initialize with a CS_PTR.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Assign_L22_C8", "label": "self._ptr =", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L18_C4", "vector": [14, 2, 0.141, 0.0064, 2, 0.44, 0.6667, 479, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._ptr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._ptr = ptr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Assign_L23_C8", "label": "self._z =", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L18_C4", "vector": [14, 2, 0.1474, 0.0064, 2, 0.44, 1.0, 354, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._z", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._z = z"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L25_C4", "label": "__iter__", "type": "function", "loc": [25, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "vector": [2, 1, 0.1699, 0.0256, 1, 0.22, 0.1304, 891, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n \"Iterates over each point in the coordinate sequence.\"\n for i in xrange(self.size):\n yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L26_C8", "label": "expression", "type": "expression", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L25_C4", "vector": [8, 2, 0.1667, 0.0064, 2, 0.12, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Iterates over each point in the coordinate sequence.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:For_L27_C8", "label": "for i", "type": "for", "loc": [27, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L25_C4", "vector": [6, 2, 0.1763, 0.0128, 2, 0.12, 1.0, 826, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange(self.size):\n yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L28_C12", "label": "expression", "type": "expression", "loc": [28, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:For_L27_C8", "vector": [8, 3, 0.1795, 0.0064, 3, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L30_C4", "label": "__len__", "type": "function", "loc": [30, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "vector": [2, 1, 0.1987, 0.0192, 1, 0.22, 0.1739, 76, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__len__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __len__(self):\n \"Returns the number of points in the coordinate sequence.\"\n return int(self.size)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L31_C8", "label": "expression", "type": "expression", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L30_C4", "vector": [8, 2, 0.1987, 0.0064, 2, 0.12, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the number of points in the coordinate sequence.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L32_C8", "label": "return", "type": "return", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L30_C4", "vector": [13, 2, 0.2051, 0.0064, 2, 0.12, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return int(self.size)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L34_C4", "label": "__str__", "type": "function", "loc": [34, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "vector": [2, 1, 0.2244, 0.0192, 1, 0.22, 0.2174, 527, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n \"Returns the string representation of the coordinate sequence.\"\n return str(self.tuple)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L35_C8", "label": "expression", "type": "expression", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L34_C4", "vector": [8, 2, 0.2244, 0.0064, 2, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the string representation of the coordinate sequence.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L36_C8", "label": "return", "type": "return", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L34_C4", "vector": [13, 2, 0.2308, 0.0064, 2, 0.28, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str(self.tuple)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L38_C4", "label": "__getitem__", "type": "function", "loc": [38, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "vector": [2, 1, 0.2596, 0.0385, 1, 0.22, 0.2609, 698, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "__getitem__", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getitem__(self, index):\n \"Returns the coordinate sequence value at the given index.\"\n coords = [self.getX(index), self.getY(index)]\n if self.dims == 3 and self._z:\n coords.append(self.getZ(index))\n return tuple(coords)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L39_C8", "label": "expression", "type": "expression", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L38_C4", "vector": [8, 2, 0.25, 0.0064, 2, 0.47, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the coordinate sequence value at the given index.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Assign_L40_C8", "label": "coords =", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L38_C4", "vector": [14, 2, 0.2564, 0.0064, 2, 0.47, 0.3333, 216, 0, 0, 0, 0, 0, 5, 2], "semantic": {"name": "coords", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " coords = [self.getX(index), self.getY(index)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L41_C8", "label": "if", "type": "if", "loc": [41, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L38_C4", "vector": [4, 2, 0.266, 0.0128, 2, 0.47, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.dims == 3 and self._z:\n coords.append(self.getZ(index))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L42_C12", "label": "append()", "type": "expression", "loc": [42, 42], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L41_C8", "vector": [8, 3, 0.2692, 0.0064, 3, 0.39, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " coords.append(self.getZ(index))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L43_C8", "label": "return", "type": "return", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L38_C4", "vector": [13, 2, 0.2756, 0.0064, 2, 0.47, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return tuple(coords)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L45_C4", "label": "__setitem__", "type": "function", "loc": [45, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "vector": [2, 1, 0.3558, 0.141, 1, 0.22, 0.3043, 343, 0, 3, 0, 0, 0, 0, 8], "semantic": {"name": "__setitem__", "arg_names": ["self", "index", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __setitem__(self, index, value):\n \"Sets the coordinate sequence value at the given index.\"\n # Checking the input value\n if isinstance(value, (list, tuple)):\n pass\n elif numpy and isinstance(value, numpy.ndarray):\n pass\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L46_C8", "label": "expression", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L45_C4", "vector": [8, 2, 0.2949, 0.0064, 2, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Sets the coordinate sequence value at the given index.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L48_C8", "label": "if", "type": "if", "loc": [48, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L45_C4", "vector": [4, 2, 0.3237, 0.0385, 2, 0.28, 0.1667, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, (list, tuple)):\n pass\n elif numpy and isinstance(value, numpy.ndarray):\n pass\n else:\n raise TypeError('Must set coordinate with a sequence (list, tuple, or numpy array).')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L50_C8", "label": "if", "type": "if", "loc": [50, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L48_C8", "vector": [4, 3, 0.3301, 0.0256, 3, 0.33, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif numpy and isinstance(value, numpy.ndarray):\n pass\n else:\n raise TypeError('Must set coordinate with a sequence (list, tuple, or numpy array).')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L55_C8", "label": "if", "type": "if", "loc": [55, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L45_C4", "vector": [4, 2, 0.3686, 0.0385, 2, 0.28, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.dims == 3 and self._z:\n n_args = 3\n set_3d = True\n else:\n n_args = 2\n set_3d = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Assign_L56_C12", "label": "n_args =", "type": "assigned_variable", "loc": [56, 56], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L55_C8", "vector": [14, 3, 0.359, 0.0064, 3, 0.21, 0.0, 21, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "n_args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " n_args = 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Assign_L57_C12", "label": "set_3d =", "type": "assigned_variable", "loc": [57, 57], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L55_C8", "vector": [14, 3, 0.3654, 0.0064, 3, 0.21, 0.3333, 854, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "set_3d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " set_3d = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Assign_L59_C12", "label": "n_args =", "type": "assigned_variable", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L55_C8", "vector": [14, 3, 0.3782, 0.0064, 3, 0.21, 0.6667, 21, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "n_args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " n_args = 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Assign_L60_C12", "label": "set_3d =", "type": "assigned_variable", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L55_C8", "vector": [14, 3, 0.3846, 0.0064, 3, 0.21, 1.0, 854, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "set_3d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " set_3d = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L61_C8", "label": "if", "type": "if", "loc": [61, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L45_C4", "vector": [4, 2, 0.3942, 0.0128, 2, 0.28, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(value) != n_args:\n raise TypeError('Dimension of value does not match.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L64_C8", "label": "setX()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L45_C4", "vector": [8, 2, 0.4103, 0.0064, 2, 0.28, 0.6667, 468, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setX", "arg_names": [], "import_names": [], "rhs_call_name": "setX", "annotation": ""}, "snippet": " self.setX(index, value[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L65_C8", "label": "setY()", "type": "expression", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L45_C4", "vector": [8, 2, 0.4167, 0.0064, 2, 0.28, 0.8333, 611, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setY", "arg_names": [], "import_names": [], "rhs_call_name": "setY", "annotation": ""}, "snippet": " self.setY(index, value[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L66_C8", "label": "if", "type": "if", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L45_C4", "vector": [4, 2, 0.4231, 0.0064, 2, 0.28, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if set_3d: self.setZ(index, value[2])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L66_C19", "label": "setZ()", "type": "expression", "loc": [66, 66], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L66_C8", "vector": [8, 3, 0.4231, 0.0064, 3, 0.45, 0.0, 796, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setZ", "arg_names": [], "import_names": [], "rhs_call_name": "setZ", "annotation": ""}, "snippet": " if set_3d: self.setZ(index, value[2])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L69_C4", "label": "_checkindex", "type": "function", "loc": [69, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "vector": [2, 1, 0.4551, 0.0321, 1, 0.22, 0.3478, 679, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_checkindex", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _checkindex(self, index):\n \"Checks the given index.\"\n sz = self.size\n if (sz < 1) or (index < 0) or (index >= sz):\n raise GEOSIndexError('invalid GEOS Geometry index: %s' % str(index))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L70_C8", "label": "expression", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L69_C4", "vector": [8, 2, 0.4487, 0.0064, 2, 0.01, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Checks the given index.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Assign_L71_C8", "label": "sz =", "type": "assigned_variable", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L69_C4", "vector": [14, 2, 0.4551, 0.0064, 2, 0.01, 0.5, 780, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sz", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sz = self.size"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L72_C8", "label": "if", "type": "if", "loc": [72, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L69_C4", "vector": [4, 2, 0.4647, 0.0128, 2, 0.01, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (sz < 1) or (index < 0) or (index >= sz):\n raise GEOSIndexError('invalid GEOS Geometry index: %s' % str(index))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L75_C4", "label": "_checkdim", "type": "function", "loc": [75, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "vector": [2, 1, 0.4904, 0.0256, 1, 0.22, 0.3913, 364, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_checkdim", "arg_names": ["self", "dim"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _checkdim(self, dim):\n \"Checks the given dimension.\"\n if dim < 0 or dim > 2:\n raise GEOSException('invalid ordinate dimension \"%d\"' % dim)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L76_C8", "label": "expression", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L75_C4", "vector": [8, 2, 0.4872, 0.0064, 2, 0.61, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Checks the given dimension.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L77_C8", "label": "if", "type": "if", "loc": [77, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L75_C4", "vector": [4, 2, 0.4968, 0.0128, 2, 0.61, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if dim < 0 or dim > 2:\n raise GEOSException('invalid ordinate dimension \"%d\"' % dim)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L81_C4", "label": "getOrdinate", "type": "function", "loc": [81, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "vector": [2, 1, 0.5321, 0.0321, 1, 0.22, 0.4348, 923, 0, 3, 1, 0, 0, 0, 5], "semantic": {"name": "getOrdinate", "arg_names": ["self", "dimension", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def getOrdinate(self, dimension, index):\n \"Returns the value for the given dimension and index.\"\n self._checkindex(index)\n self._checkdim(dimension)\n return capi.cs_getordinate(self.ptr, index, dimension, byref(c_double()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L82_C8", "label": "expression", "type": "expression", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L81_C4", "vector": [8, 2, 0.5256, 0.0064, 2, 0.64, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the value for the given dimension and index.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L83_C8", "label": "_checkindex()", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L81_C4", "vector": [8, 2, 0.5321, 0.0064, 2, 0.64, 0.3333, 679, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_checkindex", "arg_names": [], "import_names": [], "rhs_call_name": "_checkindex", "annotation": ""}, "snippet": " self._checkindex(index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L84_C8", "label": "_checkdim()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L81_C4", "vector": [8, 2, 0.5385, 0.0064, 2, 0.64, 0.6667, 364, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_checkdim", "arg_names": [], "import_names": [], "rhs_call_name": "_checkdim", "annotation": ""}, "snippet": " self._checkdim(dimension)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L85_C8", "label": "return", "type": "return", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L81_C4", "vector": [13, 2, 0.5449, 0.0064, 2, 0.64, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.cs_getordinate(self.ptr, index, dimension, byref(c_double()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L87_C4", "label": "setOrdinate", "type": "function", "loc": [87, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "vector": [2, 1, 0.5705, 0.0321, 1, 0.22, 0.4783, 640, 0, 4, 0, 0, 0, 0, 3], "semantic": {"name": "setOrdinate", "arg_names": ["self", "dimension", "index", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def setOrdinate(self, dimension, index, value):\n \"Sets the value for the given dimension and index.\"\n self._checkindex(index)\n self._checkdim(dimension)\n capi.cs_setordinate(self.ptr, index, dimension, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L88_C8", "label": "expression", "type": "expression", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L87_C4", "vector": [8, 2, 0.5641, 0.0064, 2, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Sets the value for the given dimension and index.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L89_C8", "label": "_checkindex()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L87_C4", "vector": [8, 2, 0.5705, 0.0064, 2, 0.15, 0.3333, 679, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_checkindex", "arg_names": [], "import_names": [], "rhs_call_name": "_checkindex", "annotation": ""}, "snippet": " self._checkindex(index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L90_C8", "label": "_checkdim()", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L87_C4", "vector": [8, 2, 0.5769, 0.0064, 2, 0.15, 0.6667, 364, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_checkdim", "arg_names": [], "import_names": [], "rhs_call_name": "_checkdim", "annotation": ""}, "snippet": " self._checkdim(dimension)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L91_C8", "label": "cs_setordinate()", "type": "expression", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L87_C4", "vector": [8, 2, 0.5833, 0.0064, 2, 0.15, 1.0, 204, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "cs_setordinate", "arg_names": [], "import_names": [], "rhs_call_name": "cs_setordinate", "annotation": ""}, "snippet": " capi.cs_setordinate(self.ptr, index, dimension, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L93_C4", "label": "getX", "type": "function", "loc": [93, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "vector": [2, 1, 0.6026, 0.0192, 1, 0.22, 0.5217, 866, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "getX", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def getX(self, index):\n \"Get the X value at the index.\"\n return self.getOrdinate(0, index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L94_C8", "label": "expression", "type": "expression", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L93_C4", "vector": [8, 2, 0.6026, 0.0064, 2, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Get the X value at the index.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L95_C8", "label": "return", "type": "return", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L93_C4", "vector": [13, 2, 0.609, 0.0064, 2, 0.15, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.getOrdinate(0, index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L97_C4", "label": "setX", "type": "function", "loc": [97, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "vector": [2, 1, 0.6282, 0.0192, 1, 0.22, 0.5652, 468, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setX", "arg_names": ["self", "index", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def setX(self, index, value):\n \"Set X with the value at the given index.\"\n self.setOrdinate(0, index, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L98_C8", "label": "expression", "type": "expression", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L97_C4", "vector": [8, 2, 0.6282, 0.0064, 2, 0.23, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Set X with the value at the given index.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L99_C8", "label": "setOrdinate()", "type": "expression", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L97_C4", "vector": [8, 2, 0.6346, 0.0064, 2, 0.23, 1.0, 640, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setOrdinate", "arg_names": [], "import_names": [], "rhs_call_name": "setOrdinate", "annotation": ""}, "snippet": " self.setOrdinate(0, index, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L101_C4", "label": "getY", "type": "function", "loc": [101, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "vector": [2, 1, 0.6538, 0.0192, 1, 0.22, 0.6087, 7, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "getY", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def getY(self, index):\n \"Get the Y value at the given index.\"\n return self.getOrdinate(1, index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L102_C8", "label": "expression", "type": "expression", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L101_C4", "vector": [8, 2, 0.6538, 0.0064, 2, 0.93, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Get the Y value at the given index.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L103_C8", "label": "return", "type": "return", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L101_C4", "vector": [13, 2, 0.6603, 0.0064, 2, 0.93, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.getOrdinate(1, index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L105_C4", "label": "setY", "type": "function", "loc": [105, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "vector": [2, 1, 0.6795, 0.0192, 1, 0.22, 0.6522, 611, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setY", "arg_names": ["self", "index", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def setY(self, index, value):\n \"Set Y with the value at the given index.\"\n self.setOrdinate(1, index, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L106_C8", "label": "expression", "type": "expression", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L105_C4", "vector": [8, 2, 0.6795, 0.0064, 2, 0.86, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Set Y with the value at the given index.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L107_C8", "label": "setOrdinate()", "type": "expression", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L105_C4", "vector": [8, 2, 0.6859, 0.0064, 2, 0.86, 1.0, 640, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setOrdinate", "arg_names": [], "import_names": [], "rhs_call_name": "setOrdinate", "annotation": ""}, "snippet": " self.setOrdinate(1, index, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L109_C4", "label": "getZ", "type": "function", "loc": [109, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "vector": [2, 1, 0.7051, 0.0192, 1, 0.22, 0.6957, 527, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "getZ", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def getZ(self, index):\n \"Get Z with the value at the given index.\"\n return self.getOrdinate(2, index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L110_C8", "label": "expression", "type": "expression", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L109_C4", "vector": [8, 2, 0.7051, 0.0064, 2, 0.65, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Get Z with the value at the given index.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L111_C8", "label": "return", "type": "return", "loc": [111, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L109_C4", "vector": [13, 2, 0.7115, 0.0064, 2, 0.65, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.getOrdinate(2, index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L113_C4", "label": "setZ", "type": "function", "loc": [113, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "vector": [2, 1, 0.7308, 0.0192, 1, 0.22, 0.7391, 796, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setZ", "arg_names": ["self", "index", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def setZ(self, index, value):\n \"Set Z with the value at the given index.\"\n self.setOrdinate(2, index, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L114_C8", "label": "expression", "type": "expression", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L113_C4", "vector": [8, 2, 0.7308, 0.0064, 2, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Set Z with the value at the given index.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L115_C8", "label": "setOrdinate()", "type": "expression", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L113_C4", "vector": [8, 2, 0.7372, 0.0064, 2, 0.18, 1.0, 640, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setOrdinate", "arg_names": [], "import_names": [], "rhs_call_name": "setOrdinate", "annotation": ""}, "snippet": " self.setOrdinate(2, index, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L119_C4", "label": "size", "type": "function", "loc": [119, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "vector": [2, 1, 0.7692, 0.0192, 1, 0.22, 0.7826, 714, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "size", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def size(self):\n \"Returns the size of this coordinate sequence.\"\n return capi.cs_getsize(self.ptr, byref(c_uint()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L120_C8", "label": "expression", "type": "expression", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L119_C4", "vector": [8, 2, 0.7692, 0.0064, 2, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the size of this coordinate sequence.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L121_C8", "label": "return", "type": "return", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L119_C4", "vector": [13, 2, 0.7756, 0.0064, 2, 0.94, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.cs_getsize(self.ptr, byref(c_uint()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L124_C4", "label": "dims", "type": "function", "loc": [124, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "vector": [2, 1, 0.8013, 0.0192, 1, 0.22, 0.8261, 219, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "dims", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def dims(self):\n \"Returns the dimensions of this coordinate sequence.\"\n return capi.cs_getdims(self.ptr, byref(c_uint()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L125_C8", "label": "expression", "type": "expression", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L124_C4", "vector": [8, 2, 0.8013, 0.0064, 2, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the dimensions of this coordinate sequence.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L126_C8", "label": "return", "type": "return", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L124_C4", "vector": [13, 2, 0.8077, 0.0064, 2, 0.94, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.cs_getdims(self.ptr, byref(c_uint()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L129_C4", "label": "hasz", "type": "function", "loc": [129, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "vector": [2, 1, 0.8429, 0.0385, 1, 0.22, 0.8696, 15, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "hasz", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def hasz(self):\n \"\"\"\n Returns whether this coordinate sequence is 3D. This property value is\n inherited from the parent Geometry.\n \"\"\"\n return self._z"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L130_C8", "label": "expression", "type": "expression", "loc": [130, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L129_C4", "vector": [8, 2, 0.8429, 0.0256, 2, 0.8, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns whether this coordinate sequence is 3D. This property value is\n inherited from the parent Geometry.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L134_C8", "label": "return", "type": "return", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L129_C4", "vector": [13, 2, 0.859, 0.0064, 2, 0.8, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._z"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L137_C4", "label": "clone", "type": "function", "loc": [137, 139], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "vector": [2, 1, 0.8846, 0.0192, 1, 0.22, 0.913, 911, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "clone", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clone(self):\n \"Clones this coordinate sequence.\"\n return GEOSCoordSeq(capi.cs_clone(self.ptr), self.hasz)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L138_C8", "label": "expression", "type": "expression", "loc": [138, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L137_C4", "vector": [8, 2, 0.8846, 0.0064, 2, 0.2, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Clones this coordinate sequence.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L139_C8", "label": "return", "type": "return", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L137_C4", "vector": [13, 2, 0.891, 0.0064, 2, 0.2, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return GEOSCoordSeq(capi.cs_clone(self.ptr), self.hasz)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L142_C4", "label": "kml", "type": "function", "loc": [142, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "vector": [2, 1, 0.9327, 0.0513, 1, 0.22, 0.9565, 168, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "kml", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def kml(self):\n \"Returns the KML representation for the coordinates.\"\n # Getting the substitution string depending on whether the coordinates have\n # a Z dimension.\n if self.hasz: substr = '%s,%s,%s '\n else: substr = '%s,%s,0 '\n return '<coordinates>%s</coordinates>' % \\\n ''.join([substr % self[i] for i in xrange(len(self))]).strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L143_C8", "label": "expression", "type": "expression", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L142_C4", "vector": [8, 2, 0.9167, 0.0064, 2, 0.35, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the KML representation for the coordinates.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L146_C8", "label": "if", "type": "if", "loc": [146, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L142_C4", "vector": [4, 2, 0.9391, 0.0128, 2, 0.35, 0.5, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.hasz: substr = '%s,%s,%s '\n else: substr = '%s,%s,0 '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Assign_L146_C22", "label": "substr =", "type": "assigned_variable", "loc": [146, 146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L146_C8", "vector": [14, 3, 0.9359, 0.0064, 3, 0.26, 0.0, 219, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "substr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.hasz: substr = '%s,%s,%s '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Assign_L147_C14", "label": "substr =", "type": "assigned_variable", "loc": [147, 147], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L146_C8", "vector": [14, 3, 0.9423, 0.0064, 3, 0.26, 1.0, 219, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "substr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " else: substr = '%s,%s,0 '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L148_C8", "label": "return", "type": "return", "loc": [148, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L142_C4", "vector": [13, 2, 0.9519, 0.0128, 2, 0.35, 1.0, 0, 4, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '<coordinates>%s</coordinates>' % \\\n ''.join([substr % self[i] for i in xrange(len(self))]).strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L152_C4", "label": "tuple", "type": "function", "loc": [152, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "vector": [2, 1, 0.9872, 0.0321, 1, 0.22, 1.0, 259, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "tuple", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def tuple(self):\n \"Returns a tuple version of this coordinate sequence.\"\n n = self.size\n if n == 1: return self[0]\n else: return tuple([self[i] for i in xrange(n)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L153_C8", "label": "expression", "type": "expression", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L152_C4", "vector": [8, 2, 0.9808, 0.0064, 2, 0.71, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a tuple version of this coordinate sequence.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Assign_L154_C8", "label": "n =", "type": "assigned_variable", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L152_C4", "vector": [14, 2, 0.9872, 0.0064, 2, 0.71, 0.5, 773, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "n", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " n = self.size"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L155_C8", "label": "if", "type": "if", "loc": [155, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L152_C4", "vector": [4, 2, 0.9968, 0.0128, 2, 0.71, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if n == 1: return self[0]\n else: return tuple([self[i] for i in xrange(n)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L155_C19", "label": "return", "type": "return", "loc": [155, 155], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L155_C8", "vector": [13, 3, 0.9936, 0.0064, 3, 0.2, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if n == 1: return self[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L156_C14", "label": "return", "type": "return", "loc": [156, 156], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L155_C8", "vector": [13, 3, 1.0, 0.0064, 3, 0.2, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " else: return tuple([self[i] for i in xrange(n)])"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:For_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:For_L27_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L28_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L42_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L48_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L55_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Assign_L56_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L55_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Assign_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L55_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Assign_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L55_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Assign_L60_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L66_C19"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Assign_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L124_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L124_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L126_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L142_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L142_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Assign_L146_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Assign_L147_C14"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L142_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L152_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L152_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Assign_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:FunctionDef_L152_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L155_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L155_C19"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:If_L155_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Return_L156_C14"}] |
from ctypes import c_void_p
from types import NoneType
from django.contrib.gis.geos.error import GEOSException, GEOSIndexError
# Trying to import GDAL libraries, if available. Have to place in
# try/except since this package may be used outside GeoDjango.
try:
from django.contrib.gis import gdal
except ImportError:
# A 'dummy' gdal module.
class GDALInfo(object):
HAS_GDAL = False
GEOJSON = False
gdal = GDALInfo()
# NumPy supported?
try:
import numpy
except ImportError:
numpy = False
class GEOSBase(object):
"""
Base object for GEOS objects that has a pointer access property
that controls access to the underlying C pointer.
"""
# Initially the pointer is NULL.
_ptr = None
# Default allowed pointer type.
ptr_type = c_void_p
# Pointer access property.
def _get_ptr(self):
# Raise an exception if the pointer isn't valid don't
# want to be passing NULL pointers to routines --
# that's very bad.
if self._ptr: return self._ptr
else: raise GEOSException('NULL GEOS %s pointer encountered.' % self.__class__.__name__)
def _set_ptr(self, ptr):
# Only allow the pointer to be set with pointers of the
# compatible type or None (NULL).
if isinstance(ptr, (self.ptr_type, NoneType)):
self._ptr = ptr
else:
raise TypeError('Incompatible pointer type')
# Property for controlling access to the GEOS object pointers. Using
# this raises an exception when the pointer is NULL, thus preventing
# the C library from attempting to access an invalid memory location.
ptr = property(_get_ptr, _set_ptr)
| ajibawa-2023/Python-Code-Large/train/row_98739 | 23 | 52 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98739:ImportFrom_L1_C0", "label": "from ctypes import c_void_p", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0192, 0.0192, 0, 0.66, 0.0, 182, 0, 1, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_void_p"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import c_void_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98739:ImportFrom_L2_C0", "label": "from types import NoneType", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0385, 0.0192, 0, 0.66, 0.2, 209, 0, 1, 0, 0, 209, 0, 0], "semantic": {"name": "types", "arg_names": [], "import_names": ["NoneType"], "rhs_call_name": "", "annotation": ""}, "snippet": "from types import NoneType"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98739:ImportFrom_L3_C0", "label": "from django.contrib.gis.geos.error import GEOSException, GEOSIndexError", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0577, 0.0192, 0, 0.66, 0.4, 827, 0, 2, 0, 0, 827, 0, 0], "semantic": {"name": "django.contrib.gis.geos.error", "arg_names": [], "import_names": ["GEOSException", "GEOSIndexError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.error import GEOSException, GEOSIndexError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98739:Try_L7_C0", "label": "try", "type": "try", "loc": [7, 14], "level": 0, "parent": null, "vector": [7, 0, 0.2019, 0.1538, 0, 0.66, 0.6, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from django.contrib.gis import gdal\nexcept ImportError:\n # A 'dummy' gdal module.\n class GDALInfo(object):\n HAS_GDAL = False\n GEOJSON = False\n gdal = GDALInfo()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98739:ImportFrom_L8_C4", "label": "from django.contrib.gis import gdal", "type": "import", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98739:Try_L7_C0", "vector": [1, 1, 0.1538, 0.0192, 1, 0.55, 0.0, 735, 0, 1, 0, 0, 735, 0, 0], "semantic": {"name": "django.contrib.gis", "arg_names": [], "import_names": ["gdal"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis import gdal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98739:ClassDef_L11_C4", "label": "GDALInfo", "type": "class", "loc": [11, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98739:Try_L7_C0", "vector": [3, 1, 0.2308, 0.0577, 1, 0.55, 0.0, 861, 0, 0, 0, 0, 186, 0, 0], "semantic": {"name": "GDALInfo", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class GDALInfo(object):\n HAS_GDAL = False\n GEOJSON = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98739:Assign_L12_C8", "label": "HAS_GDAL =", "type": "assigned_variable", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98739:ClassDef_L11_C4", "vector": [14, 2, 0.2308, 0.0192, 2, 0.86, 0.0, 654, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "HAS_GDAL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " HAS_GDAL = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98739:Assign_L13_C8", "label": "GEOJSON =", "type": "assigned_variable", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98739:ClassDef_L11_C4", "vector": [14, 2, 0.25, 0.0192, 2, 0.86, 1.0, 805, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "GEOJSON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " GEOJSON = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98739:Assign_L14_C4", "label": "gdal = GDALInfo()", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98739:Try_L7_C0", "vector": [14, 1, 0.2692, 0.0192, 1, 0.55, 1.0, 451, 3, 0, 0, 0, 861, 10, 1], "semantic": {"name": "gdal", "arg_names": [], "import_names": [], "rhs_call_name": "GDALInfo", "annotation": ""}, "snippet": " gdal = GDALInfo()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98739:Try_L17_C0", "label": "try", "type": "try", "loc": [17, 20], "level": 0, "parent": null, "vector": [7, 0, 0.3558, 0.0769, 0, 0.66, 0.8, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n import numpy\nexcept ImportError:\n numpy = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98739:Import_L18_C4", "label": "numpy import numpy", "type": "import", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98739:Try_L17_C0", "vector": [1, 1, 0.3462, 0.0192, 1, 0.72, 0.0, 954, 0, 1, 0, 0, 954, 0, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": ["numpy"], "rhs_call_name": "", "annotation": ""}, "snippet": " import numpy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98739:Assign_L20_C4", "label": "numpy =", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98739:Try_L17_C0", "vector": [14, 1, 0.3846, 0.0192, 1, 0.72, 0.0, 954, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "numpy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " numpy = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98739:ClassDef_L22_C0", "label": "GEOSBase", "type": "class", "loc": [22, 52], "level": 0, "parent": null, "vector": [3, 0, 0.7115, 0.5962, 0, 0.66, 1.0, 274, 0, 2, 0, 0, 186, 0, 4], "semantic": {"name": "GEOSBase", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GEOSBase(object):\n \"\"\"\n Base object for GEOS objects that has a pointer access property\n that controls access to the underlying C pointer.\n \"\"\"\n # Initially the pointer is NULL.\n _ptr = None\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98739:Expr_L23_C4", "label": "expression", "type": "expression", "loc": [23, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98739:ClassDef_L22_C0", "vector": [8, 1, 0.4712, 0.0769, 1, 0.23, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Base object for GEOS objects that has a pointer access property\n that controls access to the underlying C pointer.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98739:Assign_L28_C4", "label": "_ptr =", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98739:ClassDef_L22_C0", "vector": [14, 1, 0.5385, 0.0192, 1, 0.23, 0.2, 676, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "_ptr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _ptr = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98739:Assign_L31_C4", "label": "ptr_type =", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98739:ClassDef_L22_C0", "vector": [14, 1, 0.5962, 0.0192, 1, 0.23, 0.4, 247, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ptr_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ptr_type = c_void_p"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98739:FunctionDef_L34_C4", "label": "_get_ptr", "type": "function", "loc": [34, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98739:ClassDef_L22_C0", "vector": [2, 1, 0.7019, 0.1154, 1, 0.23, 0.6, 58, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "_get_ptr", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_ptr(self):\n # Raise an exception if the pointer isn't valid don't\n # want to be passing NULL pointers to routines --\n # that's very bad.\n if self._ptr: return self._ptr\n else: raise GEOSException('NULL GEOS %s pointer encountered.' % self.__class__.__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98739:If_L38_C8", "label": "if", "type": "if", "loc": [38, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98739:FunctionDef_L34_C4", "vector": [4, 2, 0.7404, 0.0385, 2, 0.92, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._ptr: return self._ptr\n else: raise GEOSException('NULL GEOS %s pointer encountered.' % self.__class__.__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98739:Return_L38_C22", "label": "return", "type": "return", "loc": [38, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98739:If_L38_C8", "vector": [13, 3, 0.7308, 0.0192, 3, 0.9, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._ptr: return self._ptr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98739:FunctionDef_L41_C4", "label": "_set_ptr", "type": "function", "loc": [41, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98739:ClassDef_L22_C0", "vector": [2, 1, 0.8462, 0.1346, 1, 0.23, 0.8, 489, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_set_ptr", "arg_names": ["self", "ptr"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_ptr(self, ptr):\n # Only allow the pointer to be set with pointers of the\n # compatible type or None (NULL).\n if isinstance(ptr, (self.ptr_type, NoneType)):\n self._ptr = ptr\n else:\n raise TypeError('Incompatible pointer type')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98739:If_L44_C8", "label": "if", "type": "if", "loc": [44, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98739:FunctionDef_L41_C4", "vector": [4, 2, 0.875, 0.0769, 2, 0.58, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(ptr, (self.ptr_type, NoneType)):\n self._ptr = ptr\n else:\n raise TypeError('Incompatible pointer type')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98739:Assign_L45_C12", "label": "self._ptr =", "type": "assigned_variable", "loc": [45, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98739:If_L44_C8", "vector": [14, 3, 0.8654, 0.0192, 3, 0.32, 0.0, 479, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._ptr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._ptr = ptr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98739:Assign_L52_C4", "label": "ptr = property()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98739:ClassDef_L22_C0", "vector": [14, 1, 1.0, 0.0192, 1, 0.23, 1.0, 676, 3, 2, 0, 0, 244, 10, 1], "semantic": {"name": "ptr", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " ptr = property(_get_ptr, _set_ptr)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98739:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98739:ImportFrom_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98739:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98739:ClassDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98739:ClassDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98739:Assign_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98739:ClassDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98739:Assign_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98739:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98739:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98739:Try_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98739:Import_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98739:Try_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98739:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98739:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98739:Expr_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98739:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98739:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98739:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98739:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98739:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98739:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98739:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98739:If_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98739:If_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98739:Return_L38_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98739:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98739:FunctionDef_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98739:FunctionDef_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98739:If_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98739:If_L44_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98739:Assign_L45_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98739:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98739:Assign_L52_C4"}] |
"""
This module contains the 'base' GEOSGeometry object -- all GEOS Geometries
inherit from this object.
"""
# Python, ctypes and types dependencies.
import re
from ctypes import addressof, byref, c_double, c_size_t
# super-class for mutable list behavior
from django.contrib.gis.geos.mutable_list import ListMixin
# GEOS-related dependencies.
from django.contrib.gis.geos.base import GEOSBase, gdal
from django.contrib.gis.geos.coordseq import GEOSCoordSeq
from django.contrib.gis.geos.error import GEOSException, GEOSIndexError
from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOS_PREPARE
from django.contrib.gis.geos.mutable_list import ListMixin
# All other functions in this module come from the ctypes
# prototypes module -- which handles all interaction with
# the underlying GEOS library.
from django.contrib.gis.geos import prototypes as capi
# These functions provide access to a thread-local instance
# of their corresponding GEOS I/O class.
from django.contrib.gis.geos.prototypes.io import wkt_r, wkt_w, wkb_r, wkb_w, ewkb_w, ewkb_w3d
# For recognizing geometry input.
from django.contrib.gis.geometry.regex import hex_regex, wkt_regex, json_regex
class GEOSGeometry(GEOSBase, ListMixin):
"A class that, generally, encapsulates a GEOS geometry."
# Raise GEOSIndexError instead of plain IndexError
# (see ticket #4740 and GEOSIndexError docstring)
_IndexError = GEOSIndexError
ptr_type = GEOM_PTR
#### Python 'magic' routines ####
def __init__(self, geo_input, srid=None):
"""
The base constructor for GEOS geometry objects, and may take the
following inputs:
* strings:
- WKT
- HEXEWKB (a PostGIS-specific canonical form)
- GeoJSON (requires GDAL)
* buffer:
- WKB
The `srid` keyword is used to specify the Source Reference Identifier
(SRID) number for this Geometry. If not set, the SRID will be None.
"""
if isinstance(geo_input, basestring):
if isinstance(geo_input, unicode):
# Encoding to ASCII, WKT or HEXEWKB doesn't need any more.
geo_input = geo_input.encode('ascii')
wkt_m = wkt_regex.match(geo_input)
if wkt_m:
# Handling WKT input.
if wkt_m.group('srid'): srid = int(wkt_m.group('srid'))
g = wkt_r().read(wkt_m.group('wkt'))
elif hex_regex.match(geo_input):
# Handling HEXEWKB input.
g = wkb_r().read(geo_input)
elif gdal.GEOJSON and json_regex.match(geo_input):
# Handling GeoJSON input.
g = wkb_r().read(gdal.OGRGeometry(geo_input).wkb)
else:
raise ValueError('String or unicode input unrecognized as WKT EWKT, and HEXEWKB.')
elif isinstance(geo_input, GEOM_PTR):
# When the input is a pointer to a geomtry (GEOM_PTR).
g = geo_input
elif isinstance(geo_input, buffer):
# When the input is a buffer (WKB).
g = wkb_r().read(geo_input)
elif isinstance(geo_input, GEOSGeometry):
g = capi.geom_clone(geo_input.ptr)
else:
# Invalid geometry type.
raise TypeError('Improper geometry input type: %s' % str(type(geo_input)))
if bool(g):
# Setting the pointer object with a valid pointer.
self.ptr = g
else:
raise GEOSException('Could not initialize GEOS Geometry with given input.')
# Post-initialization setup.
self._post_init(srid)
def _post_init(self, srid):
"Helper routine for performing post-initialization setup."
# Setting the SRID, if given.
if srid and isinstance(srid, int): self.srid = srid
# Setting the class type (e.g., Point, Polygon, etc.)
self.__class__ = GEOS_CLASSES[self.geom_typeid]
# Setting the coordinate sequence for the geometry (will be None on
# geometries that do not have coordinate sequences)
self._set_cs()
def __del__(self):
"""
Destroys this Geometry; in other words, frees the memory used by the
GEOS C++ object.
"""
if self._ptr: capi.destroy_geom(self._ptr)
def __copy__(self):
"""
Returns a clone because the copy of a GEOSGeometry may contain an
invalid pointer location if the original is garbage collected.
"""
return self.clone()
def __deepcopy__(self, memodict):
"""
The `deepcopy` routine is used by the `Node` class of django.utils.tree;
thus, the protocol routine needs to be implemented to return correct
copies (clones) of these GEOS objects, which use C pointers.
"""
return self.clone()
def __str__(self):
"WKT is used for the string representation."
return self.wkt
def __repr__(self):
"Short-hand representation because WKT may be very large."
return '<%s object at %s>' % (self.geom_type, hex(addressof(self.ptr)))
# Pickling support
def __getstate__(self):
# The pickled state is simply a tuple of the WKB (in string form)
# and the SRID.
return str(self.wkb), self.srid
def __setstate__(self, state):
# Instantiating from the tuple state that was pickled.
wkb, srid = state
ptr = wkb_r().read(buffer(wkb))
if not ptr: raise GEOSException('Invalid Geometry loaded from pickled state.')
self.ptr = ptr
self._post_init(srid)
# Comparison operators
def __eq__(self, other):
"""
Equivalence testing, a Geometry may be compared with another Geometry
or a WKT representation.
"""
if isinstance(other, basestring):
return self.wkt == other
elif isinstance(other, GEOSGeometry):
return self.equals_exact(other)
else:
return False
def __ne__(self, other):
"The not equals operator."
return not (self == other)
### Geometry set-like operations ###
# Thanks to Sean Gillies for inspiration:
# http://lists.gispython.org/pipermail/community/2007-July/001034.html
# g = g1 | g2
def __or__(self, other):
"Returns the union of this Geometry and the other."
return self.union(other)
# g = g1 & g2
def __and__(self, other):
"Returns the intersection of this Geometry and the other."
return self.intersection(other)
# g = g1 - g2
def __sub__(self, other):
"Return the difference this Geometry and the other."
return self.difference(other)
# g = g1 ^ g2
def __xor__(self, other):
"Return the symmetric difference of this Geometry and the other."
return self.sym_difference(other)
#### Coordinate Sequence Routines ####
@property
def has_cs(self):
"Returns True if this Geometry has a coordinate sequence, False if not."
# Only these geometries are allowed to have coordinate sequences.
if isinstance(self, (Point, LineString, LinearRing)):
return True
else:
return False
def _set_cs(self):
"Sets the coordinate sequence for this Geometry."
if self.has_cs:
self._cs = GEOSCoordSeq(capi.get_cs(self.ptr), self.hasz)
else:
self._cs = None
@property
def coord_seq(self):
"Returns a clone of the coordinate sequence for this Geometry."
if self.has_cs:
return self._cs.clone()
#### Geometry Info ####
@property
def geom_type(self):
"Returns a string representing the Geometry type, e.g. 'Polygon'"
return capi.geos_type(self.ptr)
@property
def geom_typeid(self):
"Returns an integer representing the Geometry type."
return capi.geos_typeid(self.ptr)
@property
def num_geom(self):
"Returns the number of geometries in the Geometry."
return capi.get_num_geoms(self.ptr)
@property
def num_coords(self):
"Returns the number of coordinates in the Geometry."
return capi.get_num_coords(self.ptr)
@property
def num_points(self):
"Returns the number points, or coordinates, in the Geometry."
return self.num_coords
@property
def dims(self):
"Returns the dimension of this Geometry (0=point, 1=line, 2=surface)."
return capi.get_dims(self.ptr)
def normalize(self):
"Converts this Geometry to normal form (or canonical form)."
return capi.geos_normalize(self.ptr)
#### Unary predicates ####
@property
def empty(self):
"""
Returns a boolean indicating whether the set of points in this Geometry
are empty.
"""
return capi.geos_isempty(self.ptr)
@property
def hasz(self):
"Returns whether the geometry has a 3D dimension."
return capi.geos_hasz(self.ptr)
@property
def ring(self):
"Returns whether or not the geometry is a ring."
return capi.geos_isring(self.ptr)
@property
def simple(self):
"Returns false if the Geometry not simple."
return capi.geos_issimple(self.ptr)
@property
def valid(self):
"This property tests the validity of this Geometry."
return capi.geos_isvalid(self.ptr)
@property
def valid_reason(self):
"""
Returns a string containing the reason for any invalidity.
"""
if not GEOS_PREPARE:
raise GEOSException('Upgrade GEOS to 3.1 to get validity reason.')
return capi.geos_isvalidreason(self.ptr)
#### Binary predicates. ####
def contains(self, other):
"Returns true if other.within(this) returns true."
return capi.geos_contains(self.ptr, other.ptr)
def crosses(self, other):
"""
Returns true if the DE-9IM intersection matrix for the two Geometries
is T*T****** (for a point and a curve,a point and an area or a line and
an area) 0******** (for two curves).
"""
return capi.geos_crosses(self.ptr, other.ptr)
def disjoint(self, other):
"""
Returns true if the DE-9IM intersection matrix for the two Geometries
is FF*FF****.
"""
return capi.geos_disjoint(self.ptr, other.ptr)
def equals(self, other):
"""
Returns true if the DE-9IM intersection matrix for the two Geometries
is T*F**FFF*.
"""
return capi.geos_equals(self.ptr, other.ptr)
def equals_exact(self, other, tolerance=0):
"""
Returns true if the two Geometries are exactly equal, up to a
specified tolerance.
"""
return capi.geos_equalsexact(self.ptr, other.ptr, float(tolerance))
def intersects(self, other):
"Returns true if disjoint returns false."
return capi.geos_intersects(self.ptr, other.ptr)
def overlaps(self, other):
"""
Returns true if the DE-9IM intersection matrix for the two Geometries
is T*T***T** (for two points or two surfaces) 1*T***T** (for two curves).
"""
return capi.geos_overlaps(self.ptr, other.ptr)
def relate_pattern(self, other, pattern):
"""
Returns true if the elements in the DE-9IM intersection matrix for the
two Geometries match the elements in pattern.
"""
if not isinstance(pattern, basestring) or len(pattern) > 9:
raise GEOSException('invalid intersection matrix pattern')
return capi.geos_relatepattern(self.ptr, other.ptr, pattern)
def touches(self, other):
"""
Returns true if the DE-9IM intersection matrix for the two Geometries
is FT*******, F**T***** or F***T****.
"""
return capi.geos_touches(self.ptr, other.ptr)
def within(self, other):
"""
Returns true if the DE-9IM intersection matrix for the two Geometries
is T*F**F***.
"""
return capi.geos_within(self.ptr, other.ptr)
#### SRID Routines ####
def get_srid(self):
"Gets the SRID for the geometry, returns None if no SRID is set."
s = capi.geos_get_srid(self.ptr)
if s == 0: return None
else: return s
def set_srid(self, srid):
"Sets the SRID for the geometry."
capi.geos_set_srid(self.ptr, srid)
srid = property(get_srid, set_srid)
#### Output Routines ####
@property
def ewkt(self):
"""
Returns the EWKT (WKT + SRID) of the Geometry. Note that Z values
are *not* included in this representation because GEOS does not yet
support serializing them.
"""
if self.get_srid(): return 'SRID=%s;%s' % (self.srid, self.wkt)
else: return self.wkt
@property
def wkt(self):
"Returns the WKT (Well-Known Text) representation of this Geometry."
return wkt_w().write(self)
@property
def hex(self):
"""
Returns the WKB of this Geometry in hexadecimal form. Please note
that the SRID and Z values are not included in this representation
because it is not a part of the OGC specification (use the `hexewkb`
property instead).
"""
# A possible faster, all-python, implementation:
# str(self.wkb).encode('hex')
return wkb_w().write_hex(self)
@property
def hexewkb(self):
"""
Returns the EWKB of this Geometry in hexadecimal form. This is an
extension of the WKB specification that includes SRID and Z values
that are a part of this geometry.
"""
if self.hasz:
if not GEOS_PREPARE:
# See: http://trac.osgeo.org/geos/ticket/216
raise GEOSException('Upgrade GEOS to 3.1 to get valid 3D HEXEWKB.')
return ewkb_w3d().write_hex(self)
else:
return ewkb_w().write_hex(self)
@property
def json(self):
"""
Returns GeoJSON representation of this Geometry if GDAL 1.5+
is installed.
"""
if gdal.GEOJSON:
return self.ogr.json
else:
raise GEOSException('GeoJSON output only supported on GDAL 1.5+.')
geojson = json
@property
def wkb(self):
"""
Returns the WKB (Well-Known Binary) representation of this Geometry
as a Python buffer. SRID and Z values are not included, use the
`ewkb` property instead.
"""
return wkb_w().write(self)
@property
def ewkb(self):
"""
Return the EWKB representation of this Geometry as a Python buffer.
This is an extension of the WKB specification that includes any SRID
and Z values that are a part of this geometry.
"""
if self.hasz:
if not GEOS_PREPARE:
# See: http://trac.osgeo.org/geos/ticket/216
raise GEOSException('Upgrade GEOS to 3.1 to get valid 3D EWKB.')
return ewkb_w3d().write(self)
else:
return ewkb_w().write(self)
@property
def kml(self):
"Returns the KML representation of this Geometry."
gtype = self.geom_type
return '<%s>%s</%s>' % (gtype, self.coord_seq.kml, gtype)
@property
def prepared(self):
"""
Returns a PreparedGeometry corresponding to this geometry -- it is
optimized for the contains, intersects, and covers operations.
"""
if GEOS_PREPARE:
return PreparedGeometry(self)
else:
raise GEOSException('GEOS 3.1+ required for prepared geometry support.')
#### GDAL-specific output routines ####
@property
def ogr(self):
"Returns the OGR Geometry for this Geometry."
if gdal.HAS_GDAL:
if self.srid:
return gdal.OGRGeometry(self.wkb, self.srid)
else:
return gdal.OGRGeometry(self.wkb)
else:
raise GEOSException('GDAL required to convert to an OGRGeometry.')
@property
def srs(self):
"Returns the OSR SpatialReference for SRID of this Geometry."
if gdal.HAS_GDAL:
if self.srid:
return gdal.SpatialReference(self.srid)
else:
return None
else:
raise GEOSException('GDAL required to return a SpatialReference object.')
@property
def crs(self):
"Alias for `srs` property."
return self.srs
def transform(self, ct, clone=False):
"""
Requires GDAL. Transforms the geometry according to the given
transformation object, which may be an integer SRID, and WKT or
PROJ.4 string. By default, the geometry is transformed in-place and
nothing is returned. However if the `clone` keyword is set, then this
geometry will not be modified and a transformed clone will be returned
instead.
"""
srid = self.srid
if gdal.HAS_GDAL and srid:
# Creating an OGR Geometry, which is then transformed.
g = gdal.OGRGeometry(self.wkb, srid)
g.transform(ct)
# Getting a new GEOS pointer
ptr = wkb_r().read(g.wkb)
if clone:
# User wants a cloned transformed geometry returned.
return GEOSGeometry(ptr, srid=g.srid)
if ptr:
# Reassigning pointer, and performing post-initialization setup
# again due to the reassignment.
capi.destroy_geom(self.ptr)
self.ptr = ptr
self._post_init(g.srid)
else:
raise GEOSException('Transformed WKB was invalid.')
#### Topology Routines ####
def _topology(self, gptr):
"Helper routine to return Geometry from the given pointer."
return GEOSGeometry(gptr, srid=self.srid)
@property
def boundary(self):
"Returns the boundary as a newly allocated Geometry object."
return self._topology(capi.geos_boundary(self.ptr))
def buffer(self, width, quadsegs=8):
"""
Returns a geometry that represents all points whose distance from this
Geometry is less than or equal to distance. Calculations are in the
Spatial Reference System of this Geometry. The optional third parameter sets
the number of segment used to approximate a quarter circle (defaults to 8).
(Text from PostGIS documentation at ch. 6.1.3)
"""
return self._topology(capi.geos_buffer(self.ptr, width, quadsegs))
@property
def centroid(self):
"""
The centroid is equal to the centroid of the set of component Geometries
of highest dimension (since the lower-dimension geometries contribute zero
"weight" to the centroid).
"""
return self._topology(capi.geos_centroid(self.ptr))
@property
def convex_hull(self):
"""
Returns the smallest convex Polygon that contains all the points
in the Geometry.
"""
return self._topology(capi.geos_convexhull(self.ptr))
def difference(self, other):
"""
Returns a Geometry representing the points making up this Geometry
that do not make up other.
"""
return self._topology(capi.geos_difference(self.ptr, other.ptr))
@property
def envelope(self):
"Return the envelope for this geometry (a polygon)."
return self._topology(capi.geos_envelope(self.ptr))
def intersection(self, other):
"Returns a Geometry representing the points shared by this Geometry and other."
return self._topology(capi.geos_intersection(self.ptr, other.ptr))
@property
def point_on_surface(self):
"Computes an interior point of this Geometry."
return self._topology(capi.geos_pointonsurface(self.ptr))
def relate(self, other):
"Returns the DE-9IM intersection matrix for this Geometry and the other."
return capi.geos_relate(self.ptr, other.ptr)
def simplify(self, tolerance=0.0, preserve_topology=False):
"""
Returns the Geometry, simplified using the Douglas-Peucker algorithm
to the specified tolerance (higher tolerance => less points). If no
tolerance provided, defaults to 0.
By default, this function does not preserve topology - e.g. polygons can
be split, collapse to lines or disappear holes can be created or
disappear, and lines can cross. By specifying preserve_topology=True,
the result will have the same dimension and number of components as the
input. This is significantly slower.
"""
if preserve_topology:
return self._topology(capi.geos_preservesimplify(self.ptr, tolerance))
else:
return self._topology(capi.geos_simplify(self.ptr, tolerance))
def sym_difference(self, other):
"""
Returns a set combining the points in this Geometry not in other,
and the points in other not in this Geometry.
"""
return self._topology(capi.geos_symdifference(self.ptr, other.ptr))
def union(self, other):
"Returns a Geometry representing all the points in this Geometry and other."
return self._topology(capi.geos_union(self.ptr, other.ptr))
#### Other Routines ####
@property
def area(self):
"Returns the area of the Geometry."
return capi.geos_area(self.ptr, byref(c_double()))
def distance(self, other):
"""
Returns the distance between the closest points on this Geometry
and the other. Units will be in those of the coordinate system of
the Geometry.
"""
if not isinstance(other, GEOSGeometry):
raise TypeError('distance() works only on other GEOS Geometries.')
return capi.geos_distance(self.ptr, other.ptr, byref(c_double()))
@property
def extent(self):
"""
Returns the extent of this geometry as a 4-tuple, consisting of
(xmin, ymin, xmax, ymax).
"""
env = self.envelope
if isinstance(env, Point):
xmin, ymin = env.tuple
xmax, ymax = xmin, ymin
else:
xmin, ymin = env[0][0]
xmax, ymax = env[0][2]
return (xmin, ymin, xmax, ymax)
@property
def length(self):
"""
Returns the length of this Geometry (e.g., 0 for point, or the
circumfrence of a Polygon).
"""
return capi.geos_length(self.ptr, byref(c_double()))
def clone(self):
"Clones this Geometry."
return GEOSGeometry(capi.geom_clone(self.ptr), srid=self.srid)
# Class mapping dictionary. Has to be at the end to avoid import
# conflicts with GEOSGeometry.
from django.contrib.gis.geos.linestring import LineString, LinearRing
from django.contrib.gis.geos.point import Point
from django.contrib.gis.geos.polygon import Polygon
from django.contrib.gis.geos.collections import GeometryCollection, MultiPoint, MultiLineString, MultiPolygon
GEOS_CLASSES = {0 : Point,
1 : LineString,
2 : LinearRing,
3 : Polygon,
4 : MultiPoint,
5 : MultiLineString,
6 : MultiPolygon,
7 : GeometryCollection,
}
# If supported, import the PreparedGeometry class.
if GEOS_PREPARE:
from django.contrib.gis.geos.prepared import PreparedGeometry
| ajibawa-2023/Python-Code-Large/train/row_98740 | 323 | 670 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0037, 0.006, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n This module contains the 'base' GEOSGeometry object -- all GEOS Geometries\n inherit from this object.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Import_L6_C0", "label": "re import re", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.009, 0.0015, 0, 0.66, 0.0556, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:ImportFrom_L7_C0", "label": "from ctypes import addressof, byref, c_double\u2026", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0104, 0.0015, 0, 0.66, 0.1111, 182, 0, 4, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["addressof", "byref", "c_double", "c_size_t"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import addressof, byref, c_double, c_size_t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:ImportFrom_L10_C0", "label": "from django.contrib.gis.geos.mutable_list import ListMixin", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0149, 0.0015, 0, 0.66, 0.1667, 696, 0, 1, 0, 0, 696, 0, 0], "semantic": {"name": "django.contrib.gis.geos.mutable_list", "arg_names": [], "import_names": ["ListMixin"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.mutable_list import ListMixin"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:ImportFrom_L13_C0", "label": "from django.contrib.gis.geos.base import GEOSBase, gdal", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0194, 0.0015, 0, 0.66, 0.2222, 386, 0, 2, 0, 0, 386, 0, 0], "semantic": {"name": "django.contrib.gis.geos.base", "arg_names": [], "import_names": ["GEOSBase", "gdal"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.base import GEOSBase, gdal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:ImportFrom_L14_C0", "label": "from django.contrib.gis.geos.coordseq import GEOSCoordSeq", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0209, 0.0015, 0, 0.66, 0.2778, 849, 0, 1, 0, 0, 849, 0, 0], "semantic": {"name": "django.contrib.gis.geos.coordseq", "arg_names": [], "import_names": ["GEOSCoordSeq"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.coordseq import GEOSCoordSeq"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:ImportFrom_L15_C0", "label": "from django.contrib.gis.geos.error import GEOSException, GEOSIndexError", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0224, 0.0015, 0, 0.66, 0.3333, 827, 0, 2, 0, 0, 827, 0, 0], "semantic": {"name": "django.contrib.gis.geos.error", "arg_names": [], "import_names": ["GEOSException", "GEOSIndexError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.error import GEOSException, GEOSIndexError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:ImportFrom_L16_C0", "label": "from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOS_PREPARE", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0239, 0.0015, 0, 0.66, 0.3889, 64, 0, 2, 0, 0, 64, 0, 0], "semantic": {"name": "django.contrib.gis.geos.libgeos", "arg_names": [], "import_names": ["GEOM_PTR", "GEOS_PREPARE"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOS_PREPARE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:ImportFrom_L17_C0", "label": "from django.contrib.gis.geos.mutable_list import ListMixin", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0254, 0.0015, 0, 0.66, 0.4444, 696, 0, 1, 0, 0, 696, 0, 0], "semantic": {"name": "django.contrib.gis.geos.mutable_list", "arg_names": [], "import_names": ["ListMixin"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.mutable_list import ListMixin"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:ImportFrom_L22_C0", "label": "from django.contrib.gis.geos import capi", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.0328, 0.0015, 0, 0.66, 0.5, 886, 0, 1, 0, 0, 886, 0, 0], "semantic": {"name": "django.contrib.gis.geos", "arg_names": [], "import_names": ["capi"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos import prototypes as capi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:ImportFrom_L26_C0", "label": "from django.contrib.gis.geos.prototypes.io import wkt_r, wkt_w, wkb_r\u2026", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.0388, 0.0015, 0, 0.66, 0.5556, 150, 0, 6, 0, 0, 150, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prototypes.io", "arg_names": [], "import_names": ["wkt_r", "wkt_w", "wkb_r", "wkb_w", "ewkb_w", "ewkb_w3d"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.prototypes.io import wkt_r, wkt_w, wkb_r, wkb_w, ewkb_w, ewkb_w3d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:ImportFrom_L29_C0", "label": "from django.contrib.gis.geometry.regex import hex_regex, wkt_regex, json_regex", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.0433, 0.0015, 0, 0.66, 0.6111, 508, 0, 3, 0, 0, 508, 0, 0], "semantic": {"name": "django.contrib.gis.geometry.regex", "arg_names": [], "import_names": ["hex_regex", "wkt_regex", "json_regex"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geometry.regex import hex_regex, wkt_regex, json_regex"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "label": "GEOSGeometry", "type": "class", "loc": [31, 650], "level": 0, "parent": null, "vector": [3, 0, 0.5082, 0.9254, 0, 0.66, 0.6667, 958, 0, 74, 0, 0, 274, 0, 99], "semantic": {"name": "GEOSGeometry", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GEOSGeometry(GEOSBase, ListMixin):\n \"A class that, generally, encapsulates a GEOS geometry.\"\n\n # Raise GEOSIndexError instead of plain IndexError\n # (see ticket #4740 and GEOSIndexError docstring)\n _IndexError = GEOSIndexError\n\n ptr_type = GEOM_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L32_C4", "label": "expression", "type": "expression", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [8, 1, 0.0478, 0.0015, 1, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"A class that, generally, encapsulates a GEOS geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L36_C4", "label": "_IndexError =", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [14, 1, 0.0537, 0.0015, 1, 0.76, 0.0128, 868, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_IndexError", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _IndexError = GEOSIndexError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L38_C4", "label": "ptr_type =", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [14, 1, 0.0567, 0.0015, 1, 0.76, 0.0256, 247, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ptr_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ptr_type = GEOM_PTR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L41_C4", "label": "__init__", "type": "function", "loc": [41, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.1, 0.0791, 1, 0.76, 0.0385, 555, 0, 3, 0, 0, 0, 0, 30], "semantic": {"name": "__init__", "arg_names": ["self", "geo_input", "srid"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, geo_input, srid=None):\n \"\"\"\n The base constructor for GEOS geometry objects, and may take the\n following inputs:\n\n * strings:\n - WKT\n - HEXEWKB (a PostGIS-specific canonical form)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L42_C8", "label": "expression", "type": "expression", "loc": [42, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L41_C4", "vector": [8, 2, 0.0724, 0.0209, 2, 0.95, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n The base constructor for GEOS geometry objects, and may take the\n following inputs:\n\n * strings:\n - WKT\n - HEXEWKB (a PostGIS-specific canonical form)\n - GeoJSON (requires GDAL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L56_C8", "label": "if", "type": "if", "loc": [56, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L41_C4", "vector": [4, 2, 0.1045, 0.0433, 2, 0.95, 0.3333, 0, 3, 0, 0, 0, 0, 0, 27], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(geo_input, basestring):\n if isinstance(geo_input, unicode):\n # Encoding to ASCII, WKT or HEXEWKB doesn't need any more.\n geo_input = geo_input.encode('ascii')\n\n wkt_m = wkt_regex.match(geo_input)\n if wkt_m:\n # Handling WKT input."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L57_C12", "label": "if", "type": "if", "loc": [57, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L56_C8", "vector": [4, 3, 0.0866, 0.0045, 3, 0.85, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(geo_input, unicode):\n # Encoding to ASCII, WKT or HEXEWKB doesn't need any more.\n geo_input = geo_input.encode('ascii')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L59_C16", "label": "geo_input = encode()", "type": "assigned_variable", "loc": [59, 59], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L57_C12", "vector": [14, 4, 0.0881, 0.0015, 4, 0.54, 0.0, 58, 3, 1, 0, 0, 623, 10, 1], "semantic": {"name": "geo_input", "arg_names": [], "import_names": [], "rhs_call_name": "encode", "annotation": ""}, "snippet": " geo_input = geo_input.encode('ascii')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L61_C12", "label": "wkt_m = match()", "type": "assigned_variable", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L56_C8", "vector": [14, 3, 0.091, 0.0015, 3, 0.85, 0.3333, 422, 3, 1, 0, 0, 36, 10, 1], "semantic": {"name": "wkt_m", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " wkt_m = wkt_regex.match(geo_input)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L62_C12", "label": "if", "type": "if", "loc": [62, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L56_C8", "vector": [4, 3, 0.1007, 0.0179, 3, 0.85, 0.6667, 0, 2, 0, 0, 0, 0, 0, 14], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if wkt_m:\n # Handling WKT input.\n if wkt_m.group('srid'): srid = int(wkt_m.group('srid'))\n g = wkt_r().read(wkt_m.group('wkt'))\n elif hex_regex.match(geo_input):\n # Handling HEXEWKB input.\n g = wkb_r().read(geo_input)\n elif gdal.GEOJSON and json_regex.match(geo_input):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L64_C16", "label": "if", "type": "if", "loc": [64, 64], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L62_C12", "vector": [4, 4, 0.0955, 0.0015, 4, 0.16, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if wkt_m.group('srid'): srid = int(wkt_m.group('srid'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L64_C40", "label": "srid = int()", "type": "assigned_variable", "loc": [64, 64], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L64_C16", "vector": [14, 5, 0.0955, 0.0015, 5, 0.9, 0.0, 357, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "srid", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " if wkt_m.group('srid'): srid = int(wkt_m.group('srid'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L65_C16", "label": "g = read()", "type": "assigned_variable", "loc": [65, 65], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L62_C12", "vector": [14, 4, 0.097, 0.0015, 4, 0.16, 0.5, 384, 3, 1, 0, 0, 453, 10, 3], "semantic": {"name": "g", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " g = wkt_r().read(wkt_m.group('wkt'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L66_C12", "label": "if", "type": "if", "loc": [66, 73], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L62_C12", "vector": [4, 4, 0.1037, 0.0119, 4, 0.16, 1.0, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif hex_regex.match(geo_input):\n # Handling HEXEWKB input.\n g = wkb_r().read(geo_input)\n elif gdal.GEOJSON and json_regex.match(geo_input):\n # Handling GeoJSON input.\n g = wkb_r().read(gdal.OGRGeometry(geo_input).wkb)\n else:\n raise ValueError('String or unicode input unrecognized as WKT EWKT, and HEXEWKB.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L68_C16", "label": "g = read()", "type": "assigned_variable", "loc": [68, 68], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L66_C12", "vector": [14, 5, 0.1015, 0.0015, 5, 0.94, 0.0, 384, 3, 1, 0, 0, 453, 10, 2], "semantic": {"name": "g", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " g = wkb_r().read(geo_input)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L69_C12", "label": "if", "type": "if", "loc": [69, 73], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L66_C12", "vector": [4, 5, 0.106, 0.0075, 5, 0.94, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif gdal.GEOJSON and json_regex.match(geo_input):\n # Handling GeoJSON input.\n g = wkb_r().read(gdal.OGRGeometry(geo_input).wkb)\n else:\n raise ValueError('String or unicode input unrecognized as WKT EWKT, and HEXEWKB.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L71_C16", "label": "g = read()", "type": "assigned_variable", "loc": [71, 71], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L69_C12", "vector": [14, 6, 0.106, 0.0015, 6, 0.03, 0.0, 384, 3, 1, 0, 0, 453, 10, 3], "semantic": {"name": "g", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " g = wkb_r().read(gdal.OGRGeometry(geo_input).wkb)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L74_C8", "label": "if", "type": "if", "loc": [74, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L56_C8", "vector": [4, 3, 0.1179, 0.0164, 3, 0.85, 1.0, 0, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(geo_input, GEOM_PTR):\n # When the input is a pointer to a geomtry (GEOM_PTR).\n g = geo_input\n elif isinstance(geo_input, buffer):\n # When the input is a buffer (WKB).\n g = wkb_r().read(geo_input)\n elif isinstance(geo_input, GEOSGeometry):\n g = capi.geom_clone(geo_input.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L76_C12", "label": "g =", "type": "assigned_variable", "loc": [76, 76], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L74_C8", "vector": [14, 4, 0.1134, 0.0015, 4, 0.23, 0.0, 384, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "g", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " g = geo_input"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L77_C8", "label": "if", "type": "if", "loc": [77, 84], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L74_C8", "vector": [4, 4, 0.1201, 0.0119, 4, 0.23, 1.0, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(geo_input, buffer):\n # When the input is a buffer (WKB).\n g = wkb_r().read(geo_input)\n elif isinstance(geo_input, GEOSGeometry):\n g = capi.geom_clone(geo_input.ptr)\n else:\n # Invalid geometry type.\n raise TypeError('Improper geometry input type: %s' % str(type(geo_input)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L79_C12", "label": "g = read()", "type": "assigned_variable", "loc": [79, 79], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L77_C8", "vector": [14, 5, 0.1179, 0.0015, 5, 0.0, 0.0, 384, 3, 1, 0, 0, 453, 10, 2], "semantic": {"name": "g", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " g = wkb_r().read(geo_input)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L80_C8", "label": "if", "type": "if", "loc": [80, 84], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L77_C8", "vector": [4, 5, 0.1224, 0.0075, 5, 0.0, 1.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(geo_input, GEOSGeometry):\n g = capi.geom_clone(geo_input.ptr)\n else:\n # Invalid geometry type.\n raise TypeError('Improper geometry input type: %s' % str(type(geo_input)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L81_C12", "label": "g = geom_clone()", "type": "assigned_variable", "loc": [81, 81], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L80_C8", "vector": [14, 6, 0.1209, 0.0015, 6, 0.3, 0.0, 384, 3, 1, 0, 0, 54, 10, 1], "semantic": {"name": "g", "arg_names": [], "import_names": [], "rhs_call_name": "geom_clone", "annotation": ""}, "snippet": " g = capi.geom_clone(geo_input.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L86_C8", "label": "if", "type": "if", "loc": [86, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L41_C4", "vector": [4, 2, 0.1313, 0.0075, 2, 0.95, 0.6667, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if bool(g):\n # Setting the pointer object with a valid pointer.\n self.ptr = g\n else:\n raise GEOSException('Could not initialize GEOS Geometry with given input.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L88_C12", "label": "self.ptr =", "type": "assigned_variable", "loc": [88, 88], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L86_C8", "vector": [14, 3, 0.1313, 0.0015, 3, 0.02, 0.0, 386, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.ptr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ptr = g"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L93_C8", "label": "_post_init()", "type": "expression", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L41_C4", "vector": [8, 2, 0.1388, 0.0015, 2, 0.95, 1.0, 831, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_post_init", "arg_names": [], "import_names": [], "rhs_call_name": "_post_init", "annotation": ""}, "snippet": " self._post_init(srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L95_C4", "label": "_post_init", "type": "function", "loc": [95, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.1493, 0.0164, 1, 0.76, 0.0513, 831, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_post_init", "arg_names": ["self", "srid"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _post_init(self, srid):\n \"Helper routine for performing post-initialization setup.\"\n # Setting the SRID, if given.\n if srid and isinstance(srid, int): self.srid = srid\n\n # Setting the class type (e.g., Point, Polygon, etc.)\n self.__class__ = GEOS_CLASSES[self.geom_typeid]\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L96_C8", "label": "expression", "type": "expression", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L95_C4", "vector": [8, 2, 0.1433, 0.0015, 2, 0.62, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Helper routine for performing post-initialization setup.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L98_C8", "label": "if", "type": "if", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L95_C4", "vector": [4, 2, 0.1463, 0.0015, 2, 0.62, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if srid and isinstance(srid, int): self.srid = srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L98_C43", "label": "self.srid =", "type": "assigned_variable", "loc": [98, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L98_C8", "vector": [14, 3, 0.1463, 0.0015, 3, 0.38, 0.0, 289, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.srid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if srid and isinstance(srid, int): self.srid = srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L101_C8", "label": "self.__class__ =", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L95_C4", "vector": [14, 2, 0.1507, 0.0015, 2, 0.62, 0.6667, 366, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.__class__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__class__ = GEOS_CLASSES[self.geom_typeid]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L105_C8", "label": "_set_cs()", "type": "expression", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L95_C4", "vector": [8, 2, 0.1567, 0.0015, 2, 0.62, 1.0, 372, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_set_cs", "arg_names": [], "import_names": [], "rhs_call_name": "_set_cs", "annotation": ""}, "snippet": " self._set_cs()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L107_C4", "label": "__del__", "type": "function", "loc": [107, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.1634, 0.009, 1, 0.76, 0.0641, 258, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__del__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __del__(self):\n \"\"\"\n Destroys this Geometry; in other words, frees the memory used by the\n GEOS C++ object.\n \"\"\"\n if self._ptr: capi.destroy_geom(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L108_C8", "label": "expression", "type": "expression", "loc": [108, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L107_C4", "vector": [8, 2, 0.1634, 0.006, 2, 0.03, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Destroys this Geometry; in other words, frees the memory used by the\n GEOS C++ object.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L112_C8", "label": "if", "type": "if", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L107_C4", "vector": [4, 2, 0.1672, 0.0015, 2, 0.03, 1.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._ptr: capi.destroy_geom(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L112_C22", "label": "destroy_geom()", "type": "expression", "loc": [112, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L112_C8", "vector": [8, 3, 0.1672, 0.0015, 3, 0.58, 0.0, 266, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "destroy_geom", "arg_names": [], "import_names": [], "rhs_call_name": "destroy_geom", "annotation": ""}, "snippet": " if self._ptr: capi.destroy_geom(self._ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L114_C4", "label": "__copy__", "type": "function", "loc": [114, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.1739, 0.009, 1, 0.76, 0.0769, 822, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__copy__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __copy__(self):\n \"\"\"\n Returns a clone because the copy of a GEOSGeometry may contain an\n invalid pointer location if the original is garbage collected.\n \"\"\"\n return self.clone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L115_C8", "label": "expression", "type": "expression", "loc": [115, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L114_C4", "vector": [8, 2, 0.1739, 0.006, 2, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a clone because the copy of a GEOSGeometry may contain an\n invalid pointer location if the original is garbage collected.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L119_C8", "label": "return", "type": "return", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L114_C4", "vector": [13, 2, 0.1776, 0.0015, 2, 0.05, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.clone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L121_C4", "label": "__deepcopy__", "type": "function", "loc": [121, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.1851, 0.0104, 1, 0.76, 0.0897, 652, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__deepcopy__", "arg_names": ["self", "memodict"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __deepcopy__(self, memodict):\n \"\"\"\n The `deepcopy` routine is used by the `Node` class of django.utils.tree;\n thus, the protocol routine needs to be implemented to return correct\n copies (clones) of these GEOS objects, which use C pointers.\n \"\"\"\n return self.clone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L122_C8", "label": "expression", "type": "expression", "loc": [122, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L121_C4", "vector": [8, 2, 0.1851, 0.0075, 2, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n The `deepcopy` routine is used by the `Node` class of django.utils.tree;\n thus, the protocol routine needs to be implemented to return correct\n copies (clones) of these GEOS objects, which use C pointers.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L127_C8", "label": "return", "type": "return", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L121_C4", "vector": [13, 2, 0.1896, 0.0015, 2, 0.43, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.clone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L129_C4", "label": "__str__", "type": "function", "loc": [129, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.194, 0.0045, 1, 0.76, 0.1026, 527, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n \"WKT is used for the string representation.\"\n return self.wkt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L130_C8", "label": "expression", "type": "expression", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L129_C4", "vector": [8, 2, 0.194, 0.0015, 2, 0.3, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"WKT is used for the string representation.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L131_C8", "label": "return", "type": "return", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L129_C4", "vector": [13, 2, 0.1955, 0.0015, 2, 0.3, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.wkt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L133_C4", "label": "__repr__", "type": "function", "loc": [133, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.2, 0.0045, 1, 0.76, 0.1154, 204, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "__repr__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __repr__(self):\n \"Short-hand representation because WKT may be very large.\"\n return '<%s object at %s>' % (self.geom_type, hex(addressof(self.ptr)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L134_C8", "label": "expression", "type": "expression", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L133_C4", "vector": [8, 2, 0.2, 0.0015, 2, 0.86, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Short-hand representation because WKT may be very large.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L135_C8", "label": "return", "type": "return", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L133_C4", "vector": [13, 2, 0.2015, 0.0015, 2, 0.86, 1.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '<%s object at %s>' % (self.geom_type, hex(addressof(self.ptr)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L138_C4", "label": "__getstate__", "type": "function", "loc": [138, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.2082, 0.006, 1, 0.76, 0.1282, 250, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__getstate__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getstate__(self):\n # The pickled state is simply a tuple of the WKB (in string form)\n # and the SRID.\n return str(self.wkb), self.srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L141_C8", "label": "return", "type": "return", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L138_C4", "vector": [13, 2, 0.2104, 0.0015, 2, 0.68, 0.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str(self.wkb), self.srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L143_C4", "label": "__setstate__", "type": "function", "loc": [143, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.2179, 0.0104, 1, 0.76, 0.141, 698, 0, 2, 0, 0, 0, 0, 5], "semantic": {"name": "__setstate__", "arg_names": ["self", "state"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __setstate__(self, state):\n # Instantiating from the tuple state that was pickled.\n wkb, srid = state\n ptr = wkb_r().read(buffer(wkb))\n if not ptr: raise GEOSException('Invalid Geometry loaded from pickled state.')\n self.ptr = ptr\n self._post_init(srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L145_C8", "label": "wkb, srid =", "type": "assigned_variable", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L143_C4", "vector": [14, 2, 0.2164, 0.0015, 2, 0.67, 0.0, 871, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "wkb, srid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wkb, srid = state"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L146_C8", "label": "ptr = read()", "type": "assigned_variable", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L143_C4", "vector": [14, 2, 0.2179, 0.0015, 2, 0.67, 0.25, 676, 3, 1, 0, 0, 453, 10, 3], "semantic": {"name": "ptr", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " ptr = wkb_r().read(buffer(wkb))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L147_C8", "label": "if", "type": "if", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L143_C4", "vector": [4, 2, 0.2194, 0.0015, 2, 0.67, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not ptr: raise GEOSException('Invalid Geometry loaded from pickled state.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L148_C8", "label": "self.ptr =", "type": "assigned_variable", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L143_C4", "vector": [14, 2, 0.2209, 0.0015, 2, 0.67, 0.75, 386, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.ptr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ptr = ptr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L149_C8", "label": "_post_init()", "type": "expression", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L143_C4", "vector": [8, 2, 0.2224, 0.0015, 2, 0.67, 1.0, 831, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_post_init", "arg_names": [], "import_names": [], "rhs_call_name": "_post_init", "annotation": ""}, "snippet": " self._post_init(srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L152_C4", "label": "__eq__", "type": "function", "loc": [152, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.2343, 0.0164, 1, 0.76, 0.1538, 763, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "__eq__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __eq__(self, other):\n \"\"\"\n Equivalence testing, a Geometry may be compared with another Geometry\n or a WKT representation.\n \"\"\"\n if isinstance(other, basestring):\n return self.wkt == other\n elif isinstance(other, GEOSGeometry):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L153_C8", "label": "expression", "type": "expression", "loc": [153, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L152_C4", "vector": [8, 2, 0.2306, 0.006, 2, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Equivalence testing, a Geometry may be compared with another Geometry\n or a WKT representation.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L157_C8", "label": "if", "type": "if", "loc": [157, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L152_C4", "vector": [4, 2, 0.2381, 0.009, 2, 0.41, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, basestring):\n return self.wkt == other\n elif isinstance(other, GEOSGeometry):\n return self.equals_exact(other)\n else:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L158_C12", "label": "return", "type": "return", "loc": [158, 158], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L157_C8", "vector": [13, 3, 0.2358, 0.0015, 3, 0.94, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.wkt == other"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L159_C8", "label": "if", "type": "if", "loc": [159, 162], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L157_C8", "vector": [4, 3, 0.2396, 0.006, 3, 0.94, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(other, GEOSGeometry):\n return self.equals_exact(other)\n else:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L160_C12", "label": "return", "type": "return", "loc": [160, 160], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L159_C8", "vector": [13, 4, 0.2388, 0.0015, 4, 0.16, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.equals_exact(other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L162_C12", "label": "return", "type": "return", "loc": [162, 162], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L159_C8", "vector": [13, 4, 0.2418, 0.0015, 4, 0.16, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L164_C4", "label": "__ne__", "type": "function", "loc": [164, 166], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.2463, 0.0045, 1, 0.76, 0.1667, 254, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__ne__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __ne__(self, other):\n \"The not equals operator.\"\n return not (self == other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L165_C8", "label": "expression", "type": "expression", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L164_C4", "vector": [8, 2, 0.2463, 0.0015, 2, 0.12, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"The not equals operator.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L166_C8", "label": "return", "type": "return", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L164_C4", "vector": [13, 2, 0.2478, 0.0015, 2, 0.12, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return not (self == other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L172_C4", "label": "__or__", "type": "function", "loc": [172, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.2582, 0.0045, 1, 0.76, 0.1795, 789, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__or__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __or__(self, other):\n \"Returns the union of this Geometry and the other.\"\n return self.union(other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L173_C8", "label": "expression", "type": "expression", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L172_C4", "vector": [8, 2, 0.2582, 0.0015, 2, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the union of this Geometry and the other.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L174_C8", "label": "return", "type": "return", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L172_C4", "vector": [13, 2, 0.2597, 0.0015, 2, 0.41, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.union(other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L177_C4", "label": "__and__", "type": "function", "loc": [177, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.2657, 0.0045, 1, 0.76, 0.1923, 916, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__and__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __and__(self, other):\n \"Returns the intersection of this Geometry and the other.\"\n return self.intersection(other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L178_C8", "label": "expression", "type": "expression", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L177_C4", "vector": [8, 2, 0.2657, 0.0015, 2, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the intersection of this Geometry and the other.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L179_C8", "label": "return", "type": "return", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L177_C4", "vector": [13, 2, 0.2672, 0.0015, 2, 0.49, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.intersection(other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L182_C4", "label": "__sub__", "type": "function", "loc": [182, 184], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.2731, 0.0045, 1, 0.76, 0.2051, 555, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__sub__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __sub__(self, other):\n \"Return the difference this Geometry and the other.\"\n return self.difference(other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L183_C8", "label": "expression", "type": "expression", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L182_C4", "vector": [8, 2, 0.2731, 0.0015, 2, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Return the difference this Geometry and the other.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L184_C8", "label": "return", "type": "return", "loc": [184, 184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L182_C4", "vector": [13, 2, 0.2746, 0.0015, 2, 0.07, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.difference(other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L187_C4", "label": "__xor__", "type": "function", "loc": [187, 189], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.2806, 0.0045, 1, 0.76, 0.2179, 746, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__xor__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __xor__(self, other):\n \"Return the symmetric difference of this Geometry and the other.\"\n return self.sym_difference(other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L188_C8", "label": "expression", "type": "expression", "loc": [188, 188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L187_C4", "vector": [8, 2, 0.2806, 0.0015, 2, 0.06, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Return the symmetric difference of this Geometry and the other.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L189_C8", "label": "return", "type": "return", "loc": [189, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L187_C4", "vector": [13, 2, 0.2821, 0.0015, 2, 0.06, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.sym_difference(other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L193_C4", "label": "has_cs", "type": "function", "loc": [193, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.2925, 0.0104, 1, 0.76, 0.2308, 705, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "has_cs", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def has_cs(self):\n \"Returns True if this Geometry has a coordinate sequence, False if not.\"\n # Only these geometries are allowed to have coordinate sequences.\n if isinstance(self, (Point, LineString, LinearRing)):\n return True\n else:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L194_C8", "label": "expression", "type": "expression", "loc": [194, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L193_C4", "vector": [8, 2, 0.2896, 0.0015, 2, 0.21, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns True if this Geometry has a coordinate sequence, False if not.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L196_C8", "label": "if", "type": "if", "loc": [196, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L193_C4", "vector": [4, 2, 0.2948, 0.006, 2, 0.21, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(self, (Point, LineString, LinearRing)):\n return True\n else:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L197_C12", "label": "return", "type": "return", "loc": [197, 197], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L196_C8", "vector": [13, 3, 0.294, 0.0015, 3, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L199_C12", "label": "return", "type": "return", "loc": [199, 199], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L196_C8", "vector": [13, 3, 0.297, 0.0015, 3, 0.88, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L201_C4", "label": "_set_cs", "type": "function", "loc": [201, 206], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.3037, 0.009, 1, 0.76, 0.2436, 372, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "_set_cs", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_cs(self):\n \"Sets the coordinate sequence for this Geometry.\"\n if self.has_cs:\n self._cs = GEOSCoordSeq(capi.get_cs(self.ptr), self.hasz)\n else:\n self._cs = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L202_C8", "label": "expression", "type": "expression", "loc": [202, 202], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L201_C4", "vector": [8, 2, 0.3015, 0.0015, 2, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Sets the coordinate sequence for this Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L203_C8", "label": "if", "type": "if", "loc": [203, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L201_C4", "vector": [4, 2, 0.3052, 0.006, 2, 0.54, 1.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.has_cs:\n self._cs = GEOSCoordSeq(capi.get_cs(self.ptr), self.hasz)\n else:\n self._cs = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L204_C12", "label": "self._cs = GEOSCoordSeq()", "type": "assigned_variable", "loc": [204, 204], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L203_C8", "vector": [14, 3, 0.3045, 0.0015, 3, 0.21, 0.0, 243, 3, 2, 0, 0, 895, 10, 2], "semantic": {"name": "self._cs", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSCoordSeq", "annotation": ""}, "snippet": " self._cs = GEOSCoordSeq(capi.get_cs(self.ptr), self.hasz)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L206_C12", "label": "self._cs =", "type": "assigned_variable", "loc": [206, 206], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L203_C8", "vector": [14, 3, 0.3075, 0.0015, 3, 0.21, 1.0, 243, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._cs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._cs = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L209_C4", "label": "coord_seq", "type": "function", "loc": [209, 212], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.3142, 0.006, 1, 0.76, 0.2564, 258, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "coord_seq", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def coord_seq(self):\n \"Returns a clone of the coordinate sequence for this Geometry.\"\n if self.has_cs:\n return self._cs.clone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L210_C8", "label": "expression", "type": "expression", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L209_C4", "vector": [8, 2, 0.3134, 0.0015, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a clone of the coordinate sequence for this Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L211_C8", "label": "if", "type": "if", "loc": [211, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L209_C4", "vector": [4, 2, 0.3157, 0.003, 2, 0.98, 1.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.has_cs:\n return self._cs.clone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L212_C12", "label": "return", "type": "return", "loc": [212, 212], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L211_C8", "vector": [13, 3, 0.3164, 0.0015, 3, 0.21, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._cs.clone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L216_C4", "label": "geom_type", "type": "function", "loc": [216, 218], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.3239, 0.0045, 1, 0.76, 0.2692, 770, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "geom_type", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geom_type(self):\n \"Returns a string representing the Geometry type, e.g. 'Polygon'\"\n return capi.geos_type(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L217_C8", "label": "expression", "type": "expression", "loc": [217, 217], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L216_C4", "vector": [8, 2, 0.3239, 0.0015, 2, 0.32, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a string representing the Geometry type, e.g. 'Polygon'\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L218_C8", "label": "return", "type": "return", "loc": [218, 218], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L216_C4", "vector": [13, 2, 0.3254, 0.0015, 2, 0.32, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.geos_type(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L221_C4", "label": "geom_typeid", "type": "function", "loc": [221, 223], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.3313, 0.0045, 1, 0.76, 0.2821, 613, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "geom_typeid", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geom_typeid(self):\n \"Returns an integer representing the Geometry type.\"\n return capi.geos_typeid(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L222_C8", "label": "expression", "type": "expression", "loc": [222, 222], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L221_C4", "vector": [8, 2, 0.3313, 0.0015, 2, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns an integer representing the Geometry type.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L223_C8", "label": "return", "type": "return", "loc": [223, 223], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L221_C4", "vector": [13, 2, 0.3328, 0.0015, 2, 0.43, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.geos_typeid(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L226_C4", "label": "num_geom", "type": "function", "loc": [226, 228], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.3388, 0.0045, 1, 0.76, 0.2949, 574, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "num_geom", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def num_geom(self):\n \"Returns the number of geometries in the Geometry.\"\n return capi.get_num_geoms(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L227_C8", "label": "expression", "type": "expression", "loc": [227, 227], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L226_C4", "vector": [8, 2, 0.3388, 0.0015, 2, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the number of geometries in the Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L228_C8", "label": "return", "type": "return", "loc": [228, 228], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L226_C4", "vector": [13, 2, 0.3403, 0.0015, 2, 0.41, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_num_geoms(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L231_C4", "label": "num_coords", "type": "function", "loc": [231, 233], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.3463, 0.0045, 1, 0.76, 0.3077, 586, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "num_coords", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def num_coords(self):\n \"Returns the number of coordinates in the Geometry.\"\n return capi.get_num_coords(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L232_C8", "label": "expression", "type": "expression", "loc": [232, 232], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L231_C4", "vector": [8, 2, 0.3463, 0.0015, 2, 0.55, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the number of coordinates in the Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L233_C8", "label": "return", "type": "return", "loc": [233, 233], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L231_C4", "vector": [13, 2, 0.3478, 0.0015, 2, 0.55, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_num_coords(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L236_C4", "label": "num_points", "type": "function", "loc": [236, 238], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.3537, 0.0045, 1, 0.76, 0.3205, 754, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "num_points", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def num_points(self):\n \"Returns the number points, or coordinates, in the Geometry.\"\n return self.num_coords"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L237_C8", "label": "expression", "type": "expression", "loc": [237, 237], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L236_C4", "vector": [8, 2, 0.3537, 0.0015, 2, 0.8, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the number points, or coordinates, in the Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L238_C8", "label": "return", "type": "return", "loc": [238, 238], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L236_C4", "vector": [13, 2, 0.3552, 0.0015, 2, 0.8, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.num_coords"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L241_C4", "label": "dims", "type": "function", "loc": [241, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.3612, 0.0045, 1, 0.76, 0.3333, 219, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "dims", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def dims(self):\n \"Returns the dimension of this Geometry (0=point, 1=line, 2=surface).\"\n return capi.get_dims(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L242_C8", "label": "expression", "type": "expression", "loc": [242, 242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L241_C4", "vector": [8, 2, 0.3612, 0.0015, 2, 0.29, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the dimension of this Geometry (0=point, 1=line, 2=surface).\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L243_C8", "label": "return", "type": "return", "loc": [243, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L241_C4", "vector": [13, 2, 0.3627, 0.0015, 2, 0.29, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.get_dims(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L245_C4", "label": "normalize", "type": "function", "loc": [245, 247], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.3672, 0.0045, 1, 0.76, 0.3462, 257, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "normalize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def normalize(self):\n \"Converts this Geometry to normal form (or canonical form).\"\n return capi.geos_normalize(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L246_C8", "label": "expression", "type": "expression", "loc": [246, 246], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L245_C4", "vector": [8, 2, 0.3672, 0.0015, 2, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Converts this Geometry to normal form (or canonical form).\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L247_C8", "label": "return", "type": "return", "loc": [247, 247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L245_C4", "vector": [13, 2, 0.3687, 0.0015, 2, 0.73, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.geos_normalize(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L251_C4", "label": "empty", "type": "function", "loc": [251, 256], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.3784, 0.009, 1, 0.76, 0.359, 365, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "empty", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def empty(self):\n \"\"\"\n Returns a boolean indicating whether the set of points in this Geometry\n are empty.\n \"\"\"\n return capi.geos_isempty(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L252_C8", "label": "expression", "type": "expression", "loc": [252, 255], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L251_C4", "vector": [8, 2, 0.3784, 0.006, 2, 0.89, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a boolean indicating whether the set of points in this Geometry\n are empty.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L256_C8", "label": "return", "type": "return", "loc": [256, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L251_C4", "vector": [13, 2, 0.3821, 0.0015, 2, 0.89, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.geos_isempty(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L259_C4", "label": "hasz", "type": "function", "loc": [259, 261], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.3881, 0.0045, 1, 0.76, 0.3718, 15, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "hasz", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def hasz(self):\n \"Returns whether the geometry has a 3D dimension.\"\n return capi.geos_hasz(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L260_C8", "label": "expression", "type": "expression", "loc": [260, 260], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L259_C4", "vector": [8, 2, 0.3881, 0.0015, 2, 0.24, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns whether the geometry has a 3D dimension.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L261_C8", "label": "return", "type": "return", "loc": [261, 261], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L259_C4", "vector": [13, 2, 0.3896, 0.0015, 2, 0.24, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.geos_hasz(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L264_C4", "label": "ring", "type": "function", "loc": [264, 266], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.3955, 0.0045, 1, 0.76, 0.3846, 661, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "ring", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def ring(self):\n \"Returns whether or not the geometry is a ring.\"\n return capi.geos_isring(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L265_C8", "label": "expression", "type": "expression", "loc": [265, 265], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L264_C4", "vector": [8, 2, 0.3955, 0.0015, 2, 0.16, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns whether or not the geometry is a ring.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L266_C8", "label": "return", "type": "return", "loc": [266, 266], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L264_C4", "vector": [13, 2, 0.397, 0.0015, 2, 0.16, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.geos_isring(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L269_C4", "label": "simple", "type": "function", "loc": [269, 271], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.403, 0.0045, 1, 0.76, 0.3974, 268, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "simple", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def simple(self):\n \"Returns false if the Geometry not simple.\"\n return capi.geos_issimple(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L270_C8", "label": "expression", "type": "expression", "loc": [270, 270], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L269_C4", "vector": [8, 2, 0.403, 0.0015, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns false if the Geometry not simple.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L271_C8", "label": "return", "type": "return", "loc": [271, 271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L269_C4", "vector": [13, 2, 0.4045, 0.0015, 2, 0.98, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.geos_issimple(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L274_C4", "label": "valid", "type": "function", "loc": [274, 276], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.4104, 0.0045, 1, 0.76, 0.4103, 552, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "valid", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def valid(self):\n \"This property tests the validity of this Geometry.\"\n return capi.geos_isvalid(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L275_C8", "label": "expression", "type": "expression", "loc": [275, 275], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L274_C4", "vector": [8, 2, 0.4104, 0.0015, 2, 0.19, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"This property tests the validity of this Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L276_C8", "label": "return", "type": "return", "loc": [276, 276], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L274_C4", "vector": [13, 2, 0.4119, 0.0015, 2, 0.19, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.geos_isvalid(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L279_C4", "label": "valid_reason", "type": "function", "loc": [279, 285], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.4209, 0.0104, 1, 0.76, 0.4231, 348, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "valid_reason", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def valid_reason(self):\n \"\"\"\n Returns a string containing the reason for any invalidity.\n \"\"\"\n if not GEOS_PREPARE:\n raise GEOSException('Upgrade GEOS to 3.1 to get validity reason.')\n return capi.geos_isvalidreason(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L280_C8", "label": "expression", "type": "expression", "loc": [280, 282], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L279_C4", "vector": [8, 2, 0.4194, 0.0045, 2, 0.92, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a string containing the reason for any invalidity.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L283_C8", "label": "if", "type": "if", "loc": [283, 284], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L279_C4", "vector": [4, 2, 0.4231, 0.003, 2, 0.92, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not GEOS_PREPARE:\n raise GEOSException('Upgrade GEOS to 3.1 to get validity reason.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L285_C8", "label": "return", "type": "return", "loc": [285, 285], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L279_C4", "vector": [13, 2, 0.4254, 0.0015, 2, 0.92, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.geos_isvalidreason(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L288_C4", "label": "contains", "type": "function", "loc": [288, 290], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.4313, 0.0045, 1, 0.76, 0.4359, 848, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "contains", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def contains(self, other):\n \"Returns true if other.within(this) returns true.\"\n return capi.geos_contains(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L289_C8", "label": "expression", "type": "expression", "loc": [289, 289], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L288_C4", "vector": [8, 2, 0.4313, 0.0015, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns true if other.within(this) returns true.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L290_C8", "label": "return", "type": "return", "loc": [290, 290], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L288_C4", "vector": [13, 2, 0.4328, 0.0015, 2, 0.98, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.geos_contains(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L292_C4", "label": "crosses", "type": "function", "loc": [292, 298], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.4403, 0.0104, 1, 0.76, 0.4487, 690, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "crosses", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def crosses(self, other):\n \"\"\"\n Returns true if the DE-9IM intersection matrix for the two Geometries\n is T*T****** (for a point and a curve,a point and an area or a line and\n an area) 0******** (for two curves).\n \"\"\"\n return capi.geos_crosses(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L293_C8", "label": "expression", "type": "expression", "loc": [293, 297], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L292_C4", "vector": [8, 2, 0.4403, 0.0075, 2, 0.55, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns true if the DE-9IM intersection matrix for the two Geometries\n is T*T****** (for a point and a curve,a point and an area or a line and\n an area) 0******** (for two curves).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L298_C8", "label": "return", "type": "return", "loc": [298, 298], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L292_C4", "vector": [13, 2, 0.4448, 0.0015, 2, 0.55, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.geos_crosses(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L300_C4", "label": "disjoint", "type": "function", "loc": [300, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.4515, 0.009, 1, 0.76, 0.4615, 303, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "disjoint", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def disjoint(self, other):\n \"\"\"\n Returns true if the DE-9IM intersection matrix for the two Geometries\n is FF*FF****.\n \"\"\"\n return capi.geos_disjoint(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L301_C8", "label": "expression", "type": "expression", "loc": [301, 304], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L300_C4", "vector": [8, 2, 0.4515, 0.006, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns true if the DE-9IM intersection matrix for the two Geometries\n is FF*FF****.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L305_C8", "label": "return", "type": "return", "loc": [305, 305], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L300_C4", "vector": [13, 2, 0.4552, 0.0015, 2, 0.98, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.geos_disjoint(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L307_C4", "label": "equals", "type": "function", "loc": [307, 312], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.4619, 0.009, 1, 0.76, 0.4744, 135, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "equals", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def equals(self, other):\n \"\"\"\n Returns true if the DE-9IM intersection matrix for the two Geometries\n is T*F**FFF*.\n \"\"\"\n return capi.geos_equals(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L308_C8", "label": "expression", "type": "expression", "loc": [308, 311], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L307_C4", "vector": [8, 2, 0.4619, 0.006, 2, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns true if the DE-9IM intersection matrix for the two Geometries\n is T*F**FFF*.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L312_C8", "label": "return", "type": "return", "loc": [312, 312], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L307_C4", "vector": [13, 2, 0.4657, 0.0015, 2, 0.88, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.geos_equals(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L314_C4", "label": "equals_exact", "type": "function", "loc": [314, 319], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.4724, 0.009, 1, 0.76, 0.4872, 801, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "equals_exact", "arg_names": ["self", "other", "tolerance"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def equals_exact(self, other, tolerance=0):\n \"\"\"\n Returns true if the two Geometries are exactly equal, up to a\n specified tolerance.\n \"\"\"\n return capi.geos_equalsexact(self.ptr, other.ptr, float(tolerance))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L315_C8", "label": "expression", "type": "expression", "loc": [315, 318], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L314_C4", "vector": [8, 2, 0.4724, 0.006, 2, 0.86, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns true if the two Geometries are exactly equal, up to a\n specified tolerance.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L319_C8", "label": "return", "type": "return", "loc": [319, 319], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L314_C4", "vector": [13, 2, 0.4761, 0.0015, 2, 0.86, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.geos_equalsexact(self.ptr, other.ptr, float(tolerance))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L321_C4", "label": "intersects", "type": "function", "loc": [321, 323], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.4806, 0.0045, 1, 0.76, 0.5, 772, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "intersects", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def intersects(self, other):\n \"Returns true if disjoint returns false.\"\n return capi.geos_intersects(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L322_C8", "label": "expression", "type": "expression", "loc": [322, 322], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L321_C4", "vector": [8, 2, 0.4806, 0.0015, 2, 0.56, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns true if disjoint returns false.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L323_C8", "label": "return", "type": "return", "loc": [323, 323], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L321_C4", "vector": [13, 2, 0.4821, 0.0015, 2, 0.56, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.geos_intersects(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L325_C4", "label": "overlaps", "type": "function", "loc": [325, 330], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.4888, 0.009, 1, 0.76, 0.5128, 458, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "overlaps", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def overlaps(self, other):\n \"\"\"\n Returns true if the DE-9IM intersection matrix for the two Geometries\n is T*T***T** (for two points or two surfaces) 1*T***T** (for two curves).\n \"\"\"\n return capi.geos_overlaps(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L326_C8", "label": "expression", "type": "expression", "loc": [326, 329], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L325_C4", "vector": [8, 2, 0.4888, 0.006, 2, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns true if the DE-9IM intersection matrix for the two Geometries\n is T*T***T** (for two points or two surfaces) 1*T***T** (for two curves).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L330_C8", "label": "return", "type": "return", "loc": [330, 330], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L325_C4", "vector": [13, 2, 0.4925, 0.0015, 2, 0.05, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.geos_overlaps(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L332_C4", "label": "relate_pattern", "type": "function", "loc": [332, 339], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.5007, 0.0119, 1, 0.76, 0.5256, 699, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "relate_pattern", "arg_names": ["self", "other", "pattern"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def relate_pattern(self, other, pattern):\n \"\"\"\n Returns true if the elements in the DE-9IM intersection matrix for the\n two Geometries match the elements in pattern.\n \"\"\"\n if not isinstance(pattern, basestring) or len(pattern) > 9:\n raise GEOSException('invalid intersection matrix pattern')\n return capi.geos_relatepattern(self.ptr, other.ptr, pattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L333_C8", "label": "expression", "type": "expression", "loc": [333, 336], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L332_C4", "vector": [8, 2, 0.4993, 0.006, 2, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns true if the elements in the DE-9IM intersection matrix for the\n two Geometries match the elements in pattern.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L337_C8", "label": "if", "type": "if", "loc": [337, 338], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L332_C4", "vector": [4, 2, 0.5037, 0.003, 2, 0.66, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(pattern, basestring) or len(pattern) > 9:\n raise GEOSException('invalid intersection matrix pattern')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L339_C8", "label": "return", "type": "return", "loc": [339, 339], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L332_C4", "vector": [13, 2, 0.506, 0.0015, 2, 0.66, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.geos_relatepattern(self.ptr, other.ptr, pattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L341_C4", "label": "touches", "type": "function", "loc": [341, 346], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.5127, 0.009, 1, 0.76, 0.5385, 422, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "touches", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def touches(self, other):\n \"\"\"\n Returns true if the DE-9IM intersection matrix for the two Geometries\n is FT*******, F**T***** or F***T****.\n \"\"\"\n return capi.geos_touches(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L342_C8", "label": "expression", "type": "expression", "loc": [342, 345], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L341_C4", "vector": [8, 2, 0.5127, 0.006, 2, 0.4, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns true if the DE-9IM intersection matrix for the two Geometries\n is FT*******, F**T***** or F***T****.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L346_C8", "label": "return", "type": "return", "loc": [346, 346], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L341_C4", "vector": [13, 2, 0.5164, 0.0015, 2, 0.4, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.geos_touches(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L348_C4", "label": "within", "type": "function", "loc": [348, 353], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.5231, 0.009, 1, 0.76, 0.5513, 912, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "within", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def within(self, other):\n \"\"\"\n Returns true if the DE-9IM intersection matrix for the two Geometries\n is T*F**F***.\n \"\"\"\n return capi.geos_within(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L349_C8", "label": "expression", "type": "expression", "loc": [349, 352], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L348_C4", "vector": [8, 2, 0.5231, 0.006, 2, 0.03, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns true if the DE-9IM intersection matrix for the two Geometries\n is T*F**F***.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L353_C8", "label": "return", "type": "return", "loc": [353, 353], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L348_C4", "vector": [13, 2, 0.5269, 0.0015, 2, 0.03, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.geos_within(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L356_C4", "label": "get_srid", "type": "function", "loc": [356, 360], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.5343, 0.0075, 1, 0.76, 0.5641, 892, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_srid", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_srid(self):\n \"Gets the SRID for the geometry, returns None if no SRID is set.\"\n s = capi.geos_get_srid(self.ptr)\n if s == 0: return None\n else: return s"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L357_C8", "label": "expression", "type": "expression", "loc": [357, 357], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L356_C4", "vector": [8, 2, 0.5328, 0.0015, 2, 0.39, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Gets the SRID for the geometry, returns None if no SRID is set.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L358_C8", "label": "s = geos_get_srid()", "type": "assigned_variable", "loc": [358, 358], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L356_C4", "vector": [14, 2, 0.5343, 0.0015, 2, 0.39, 0.5, 553, 3, 1, 0, 0, 779, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "geos_get_srid", "annotation": ""}, "snippet": " s = capi.geos_get_srid(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L359_C8", "label": "if", "type": "if", "loc": [359, 360], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L356_C4", "vector": [4, 2, 0.5366, 0.003, 2, 0.39, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if s == 0: return None\n else: return s"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L359_C19", "label": "return", "type": "return", "loc": [359, 359], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L359_C8", "vector": [13, 3, 0.5358, 0.0015, 3, 0.26, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if s == 0: return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L360_C14", "label": "return", "type": "return", "loc": [360, 360], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L359_C8", "vector": [13, 3, 0.5373, 0.0015, 3, 0.26, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " else: return s"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L362_C4", "label": "set_srid", "type": "function", "loc": [362, 364], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.5418, 0.0045, 1, 0.76, 0.5769, 324, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_srid", "arg_names": ["self", "srid"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_srid(self, srid):\n \"Sets the SRID for the geometry.\"\n capi.geos_set_srid(self.ptr, srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L363_C8", "label": "expression", "type": "expression", "loc": [363, 363], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L362_C4", "vector": [8, 2, 0.5418, 0.0015, 2, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Sets the SRID for the geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L364_C8", "label": "geos_set_srid()", "type": "expression", "loc": [364, 364], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L362_C4", "vector": [8, 2, 0.5433, 0.0015, 2, 0.38, 1.0, 340, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "geos_set_srid", "arg_names": [], "import_names": [], "rhs_call_name": "geos_set_srid", "annotation": ""}, "snippet": " capi.geos_set_srid(self.ptr, srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L365_C4", "label": "srid = property()", "type": "assigned_variable", "loc": [365, 365], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [14, 1, 0.5448, 0.0015, 1, 0.76, 0.5897, 357, 3, 2, 0, 0, 244, 10, 1], "semantic": {"name": "srid", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " srid = property(get_srid, set_srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L369_C4", "label": "ewkt", "type": "function", "loc": [369, 376], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.556, 0.0119, 1, 0.76, 0.6026, 484, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "ewkt", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def ewkt(self):\n \"\"\"\n Returns the EWKT (WKT + SRID) of the Geometry. Note that Z values\n are *not* included in this representation because GEOS does not yet\n support serializing them.\n \"\"\"\n if self.get_srid(): return 'SRID=%s;%s' % (self.srid, self.wkt)\n else: return self.wkt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L370_C8", "label": "expression", "type": "expression", "loc": [370, 374], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L369_C4", "vector": [8, 2, 0.5552, 0.0075, 2, 0.51, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the EWKT (WKT + SRID) of the Geometry. Note that Z values\n are *not* included in this representation because GEOS does not yet\n support serializing them.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L375_C8", "label": "if", "type": "if", "loc": [375, 376], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L369_C4", "vector": [4, 2, 0.5604, 0.003, 2, 0.51, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.get_srid(): return 'SRID=%s;%s' % (self.srid, self.wkt)\n else: return self.wkt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L375_C28", "label": "return", "type": "return", "loc": [375, 375], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L375_C8", "vector": [13, 3, 0.5597, 0.0015, 3, 0.07, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.get_srid(): return 'SRID=%s;%s' % (self.srid, self.wkt)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L376_C14", "label": "return", "type": "return", "loc": [376, 376], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L375_C8", "vector": [13, 3, 0.5612, 0.0015, 3, 0.07, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " else: return self.wkt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L379_C4", "label": "wkt", "type": "function", "loc": [379, 381], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.5672, 0.0045, 1, 0.76, 0.6154, 836, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "wkt", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wkt(self):\n \"Returns the WKT (Well-Known Text) representation of this Geometry.\"\n return wkt_w().write(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L380_C8", "label": "expression", "type": "expression", "loc": [380, 380], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L379_C4", "vector": [8, 2, 0.5672, 0.0015, 2, 0.93, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the WKT (Well-Known Text) representation of this Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L381_C8", "label": "return", "type": "return", "loc": [381, 381], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L379_C4", "vector": [13, 2, 0.5687, 0.0015, 2, 0.93, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return wkt_w().write(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L384_C4", "label": "hex", "type": "function", "loc": [384, 393], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.5799, 0.0149, 1, 0.76, 0.6282, 224, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "hex", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def hex(self):\n \"\"\"\n Returns the WKB of this Geometry in hexadecimal form. Please note\n that the SRID and Z values are not included in this representation\n because it is not a part of the OGC specification (use the `hexewkb`\n property instead).\n \"\"\"\n # A possible faster, all-python, implementation:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L385_C8", "label": "expression", "type": "expression", "loc": [385, 390], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L384_C4", "vector": [8, 2, 0.5784, 0.009, 2, 0.96, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the WKB of this Geometry in hexadecimal form. Please note\n that the SRID and Z values are not included in this representation\n because it is not a part of the OGC specification (use the `hexewkb`\n property instead).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L393_C8", "label": "return", "type": "return", "loc": [393, 393], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L384_C4", "vector": [13, 2, 0.5866, 0.0015, 2, 0.96, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return wkb_w().write_hex(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L396_C4", "label": "hexewkb", "type": "function", "loc": [396, 408], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.6, 0.0194, 1, 0.76, 0.641, 179, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "hexewkb", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def hexewkb(self):\n \"\"\"\n Returns the EWKB of this Geometry in hexadecimal form. This is an\n extension of the WKB specification that includes SRID and Z values\n that are a part of this geometry.\n \"\"\"\n if self.hasz:\n if not GEOS_PREPARE:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L397_C8", "label": "expression", "type": "expression", "loc": [397, 401], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L396_C4", "vector": [8, 2, 0.5955, 0.0075, 2, 0.16, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the EWKB of this Geometry in hexadecimal form. This is an\n extension of the WKB specification that includes SRID and Z values\n that are a part of this geometry.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L402_C8", "label": "if", "type": "if", "loc": [402, 408], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L396_C4", "vector": [4, 2, 0.6045, 0.0104, 2, 0.16, 1.0, 0, 7, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.hasz:\n if not GEOS_PREPARE:\n # See: http://trac.osgeo.org/geos/ticket/216\n raise GEOSException('Upgrade GEOS to 3.1 to get valid 3D HEXEWKB.')\n return ewkb_w3d().write_hex(self)\n else:\n return ewkb_w().write_hex(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L403_C12", "label": "if", "type": "if", "loc": [403, 405], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L402_C8", "vector": [4, 3, 0.603, 0.0045, 3, 0.83, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not GEOS_PREPARE:\n # See: http://trac.osgeo.org/geos/ticket/216\n raise GEOSException('Upgrade GEOS to 3.1 to get valid 3D HEXEWKB.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L406_C12", "label": "return", "type": "return", "loc": [406, 406], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L402_C8", "vector": [13, 3, 0.606, 0.0015, 3, 0.83, 0.5, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ewkb_w3d().write_hex(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L408_C12", "label": "return", "type": "return", "loc": [408, 408], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L402_C8", "vector": [13, 3, 0.609, 0.0015, 3, 0.83, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ewkb_w().write_hex(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L411_C4", "label": "json", "type": "function", "loc": [411, 419], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.6194, 0.0134, 1, 0.76, 0.6538, 463, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "json", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def json(self):\n \"\"\"\n Returns GeoJSON representation of this Geometry if GDAL 1.5+\n is installed.\n \"\"\"\n if gdal.GEOJSON:\n return self.ogr.json\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L412_C8", "label": "expression", "type": "expression", "loc": [412, 415], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L411_C4", "vector": [8, 2, 0.6172, 0.006, 2, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns GeoJSON representation of this Geometry if GDAL 1.5+\n is installed.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L416_C8", "label": "if", "type": "if", "loc": [416, 419], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L411_C4", "vector": [4, 2, 0.6231, 0.006, 2, 0.44, 1.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if gdal.GEOJSON:\n return self.ogr.json\n else:\n raise GEOSException('GeoJSON output only supported on GDAL 1.5+.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L417_C12", "label": "return", "type": "return", "loc": [417, 417], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L416_C8", "vector": [13, 3, 0.6224, 0.0015, 3, 0.59, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.ogr.json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L420_C4", "label": "geojson =", "type": "assigned_variable", "loc": [420, 420], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [14, 1, 0.6269, 0.0015, 1, 0.76, 0.6667, 89, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geojson", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geojson = json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L423_C4", "label": "wkb", "type": "function", "loc": [423, 429], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.6358, 0.0104, 1, 0.76, 0.6795, 848, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "wkb", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wkb(self):\n \"\"\"\n Returns the WKB (Well-Known Binary) representation of this Geometry\n as a Python buffer. SRID and Z values are not included, use the\n `ewkb` property instead.\n \"\"\"\n return wkb_w().write(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L424_C8", "label": "expression", "type": "expression", "loc": [424, 428], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L423_C4", "vector": [8, 2, 0.6358, 0.0075, 2, 0.35, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the WKB (Well-Known Binary) representation of this Geometry\n as a Python buffer. SRID and Z values are not included, use the\n `ewkb` property instead.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L429_C8", "label": "return", "type": "return", "loc": [429, 429], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L423_C4", "vector": [13, 2, 0.6403, 0.0015, 2, 0.35, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return wkb_w().write(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L432_C4", "label": "ewkb", "type": "function", "loc": [432, 444], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.6537, 0.0194, 1, 0.76, 0.6923, 867, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "ewkb", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def ewkb(self):\n \"\"\"\n Return the EWKB representation of this Geometry as a Python buffer.\n This is an extension of the WKB specification that includes any SRID\n and Z values that are a part of this geometry.\n \"\"\"\n if self.hasz:\n if not GEOS_PREPARE:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L433_C8", "label": "expression", "type": "expression", "loc": [433, 437], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L432_C4", "vector": [8, 2, 0.6493, 0.0075, 2, 0.59, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Return the EWKB representation of this Geometry as a Python buffer.\n This is an extension of the WKB specification that includes any SRID\n and Z values that are a part of this geometry.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L438_C8", "label": "if", "type": "if", "loc": [438, 444], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L432_C4", "vector": [4, 2, 0.6582, 0.0104, 2, 0.59, 1.0, 0, 7, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.hasz:\n if not GEOS_PREPARE:\n # See: http://trac.osgeo.org/geos/ticket/216\n raise GEOSException('Upgrade GEOS to 3.1 to get valid 3D EWKB.')\n return ewkb_w3d().write(self)\n else:\n return ewkb_w().write(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L439_C12", "label": "if", "type": "if", "loc": [439, 441], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L438_C8", "vector": [4, 3, 0.6567, 0.0045, 3, 0.97, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not GEOS_PREPARE:\n # See: http://trac.osgeo.org/geos/ticket/216\n raise GEOSException('Upgrade GEOS to 3.1 to get valid 3D EWKB.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L442_C12", "label": "return", "type": "return", "loc": [442, 442], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L438_C8", "vector": [13, 3, 0.6597, 0.0015, 3, 0.97, 0.5, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ewkb_w3d().write(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L444_C12", "label": "return", "type": "return", "loc": [444, 444], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L438_C8", "vector": [13, 3, 0.6627, 0.0015, 3, 0.97, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ewkb_w().write(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L447_C4", "label": "kml", "type": "function", "loc": [447, 450], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.6694, 0.006, 1, 0.76, 0.7051, 168, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "kml", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def kml(self):\n \"Returns the KML representation of this Geometry.\"\n gtype = self.geom_type\n return '<%s>%s</%s>' % (gtype, self.coord_seq.kml, gtype)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L448_C8", "label": "expression", "type": "expression", "loc": [448, 448], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L447_C4", "vector": [8, 2, 0.6687, 0.0015, 2, 0.29, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the KML representation of this Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L449_C8", "label": "gtype =", "type": "assigned_variable", "loc": [449, 449], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L447_C4", "vector": [14, 2, 0.6701, 0.0015, 2, 0.29, 0.5, 377, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "gtype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " gtype = self.geom_type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L450_C8", "label": "return", "type": "return", "loc": [450, 450], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L447_C4", "vector": [13, 2, 0.6716, 0.0015, 2, 0.29, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '<%s>%s</%s>' % (gtype, self.coord_seq.kml, gtype)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L453_C4", "label": "prepared", "type": "function", "loc": [453, 461], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.6821, 0.0134, 1, 0.76, 0.7179, 126, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "prepared", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def prepared(self):\n \"\"\"\n Returns a PreparedGeometry corresponding to this geometry -- it is\n optimized for the contains, intersects, and covers operations.\n \"\"\"\n if GEOS_PREPARE:\n return PreparedGeometry(self)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L454_C8", "label": "expression", "type": "expression", "loc": [454, 457], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L453_C4", "vector": [8, 2, 0.6799, 0.006, 2, 0.03, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a PreparedGeometry corresponding to this geometry -- it is\n optimized for the contains, intersects, and covers operations.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L458_C8", "label": "if", "type": "if", "loc": [458, 461], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L453_C4", "vector": [4, 2, 0.6858, 0.006, 2, 0.03, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if GEOS_PREPARE:\n return PreparedGeometry(self)\n else:\n raise GEOSException('GEOS 3.1+ required for prepared geometry support.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L459_C12", "label": "return", "type": "return", "loc": [459, 459], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L458_C8", "vector": [13, 3, 0.6851, 0.0015, 3, 0.97, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return PreparedGeometry(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L465_C4", "label": "ogr", "type": "function", "loc": [465, 473], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.7, 0.0134, 1, 0.76, 0.7308, 707, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "ogr", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def ogr(self):\n \"Returns the OGR Geometry for this Geometry.\"\n if gdal.HAS_GDAL:\n if self.srid:\n return gdal.OGRGeometry(self.wkb, self.srid)\n else:\n return gdal.OGRGeometry(self.wkb)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L466_C8", "label": "expression", "type": "expression", "loc": [466, 466], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L465_C4", "vector": [8, 2, 0.6955, 0.0015, 2, 0.29, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the OGR Geometry for this Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L467_C8", "label": "if", "type": "if", "loc": [467, 473], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L465_C4", "vector": [4, 2, 0.7015, 0.0104, 2, 0.29, 1.0, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if gdal.HAS_GDAL:\n if self.srid:\n return gdal.OGRGeometry(self.wkb, self.srid)\n else:\n return gdal.OGRGeometry(self.wkb)\n else:\n raise GEOSException('GDAL required to convert to an OGRGeometry.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L468_C12", "label": "if", "type": "if", "loc": [468, 471], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L467_C8", "vector": [4, 3, 0.7007, 0.006, 3, 0.97, 0.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.srid:\n return gdal.OGRGeometry(self.wkb, self.srid)\n else:\n return gdal.OGRGeometry(self.wkb)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L469_C16", "label": "return", "type": "return", "loc": [469, 469], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L468_C12", "vector": [13, 4, 0.7, 0.0015, 4, 0.91, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return gdal.OGRGeometry(self.wkb, self.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L471_C16", "label": "return", "type": "return", "loc": [471, 471], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L468_C12", "vector": [13, 4, 0.703, 0.0015, 4, 0.91, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return gdal.OGRGeometry(self.wkb)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L476_C4", "label": "srs", "type": "function", "loc": [476, 484], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.7164, 0.0134, 1, 0.76, 0.7436, 95, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "srs", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def srs(self):\n \"Returns the OSR SpatialReference for SRID of this Geometry.\"\n if gdal.HAS_GDAL:\n if self.srid:\n return gdal.SpatialReference(self.srid)\n else:\n return None\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L477_C8", "label": "expression", "type": "expression", "loc": [477, 477], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L476_C4", "vector": [8, 2, 0.7119, 0.0015, 2, 0.34, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the OSR SpatialReference for SRID of this Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L478_C8", "label": "if", "type": "if", "loc": [478, 484], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L476_C4", "vector": [4, 2, 0.7179, 0.0104, 2, 0.34, 1.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if gdal.HAS_GDAL:\n if self.srid:\n return gdal.SpatialReference(self.srid)\n else:\n return None\n else:\n raise GEOSException('GDAL required to return a SpatialReference object.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L479_C12", "label": "if", "type": "if", "loc": [479, 482], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L478_C8", "vector": [4, 3, 0.7172, 0.006, 3, 0.06, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.srid:\n return gdal.SpatialReference(self.srid)\n else:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L480_C16", "label": "return", "type": "return", "loc": [480, 480], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L479_C12", "vector": [13, 4, 0.7164, 0.0015, 4, 0.37, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return gdal.SpatialReference(self.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L482_C16", "label": "return", "type": "return", "loc": [482, 482], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L479_C12", "vector": [13, 4, 0.7194, 0.0015, 4, 0.37, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L487_C4", "label": "crs", "type": "function", "loc": [487, 489], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.7284, 0.0045, 1, 0.76, 0.7564, 695, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "crs", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def crs(self):\n \"Alias for `srs` property.\"\n return self.srs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L488_C8", "label": "expression", "type": "expression", "loc": [488, 488], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L487_C4", "vector": [8, 2, 0.7284, 0.0015, 2, 0.56, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Alias for `srs` property.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L489_C8", "label": "return", "type": "return", "loc": [489, 489], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L487_C4", "vector": [13, 2, 0.7299, 0.0015, 2, 0.56, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.srs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L491_C4", "label": "transform", "type": "function", "loc": [491, 517], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.7522, 0.0403, 1, 0.76, 0.7692, 48, 0, 3, 1, 0, 0, 0, 8], "semantic": {"name": "transform", "arg_names": ["self", "ct", "clone"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def transform(self, ct, clone=False):\n \"\"\"\n Requires GDAL. Transforms the geometry according to the given\n transformation object, which may be an integer SRID, and WKT or\n PROJ.4 string. By default, the geometry is transformed in-place and\n nothing is returned. However if the `clone` keyword is set, then this\n geometry will not be modified and a transformed clone will be returned\n instead."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L492_C8", "label": "expression", "type": "expression", "loc": [492, 499], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L491_C4", "vector": [8, 2, 0.7396, 0.0119, 2, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Requires GDAL. Transforms the geometry according to the given\n transformation object, which may be an integer SRID, and WKT or\n PROJ.4 string. By default, the geometry is transformed in-place and\n nothing is returned. However if the `clone` keyword is set, then this\n geometry will not be modified and a transformed clone will be returned\n instead.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L500_C8", "label": "srid =", "type": "assigned_variable", "loc": [500, 500], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L491_C4", "vector": [14, 2, 0.7463, 0.0015, 2, 0.13, 0.5, 357, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "srid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " srid = self.srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L501_C8", "label": "if", "type": "if", "loc": [501, 517], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L491_C4", "vector": [4, 2, 0.7597, 0.0254, 2, 0.13, 1.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if gdal.HAS_GDAL and srid:\n # Creating an OGR Geometry, which is then transformed.\n g = gdal.OGRGeometry(self.wkb, srid)\n g.transform(ct)\n # Getting a new GEOS pointer\n ptr = wkb_r().read(g.wkb)\n if clone:\n # User wants a cloned transformed geometry returned."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L503_C12", "label": "g = OGRGeometry()", "type": "assigned_variable", "loc": [503, 503], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L501_C8", "vector": [14, 3, 0.7507, 0.0015, 3, 0.04, 0.0, 384, 3, 2, 0, 0, 488, 10, 1], "semantic": {"name": "g", "arg_names": [], "import_names": [], "rhs_call_name": "OGRGeometry", "annotation": ""}, "snippet": " g = gdal.OGRGeometry(self.wkb, srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L504_C12", "label": "transform()", "type": "expression", "loc": [504, 504], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L501_C8", "vector": [8, 3, 0.7522, 0.0015, 3, 0.04, 0.25, 48, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "transform", "arg_names": [], "import_names": [], "rhs_call_name": "transform", "annotation": ""}, "snippet": " g.transform(ct)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L506_C12", "label": "ptr = read()", "type": "assigned_variable", "loc": [506, 506], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L501_C8", "vector": [14, 3, 0.7552, 0.0015, 3, 0.04, 0.5, 676, 3, 1, 0, 0, 453, 10, 2], "semantic": {"name": "ptr", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " ptr = wkb_r().read(g.wkb)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L507_C12", "label": "if", "type": "if", "loc": [507, 509], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L501_C8", "vector": [4, 3, 0.7582, 0.0045, 3, 0.04, 0.75, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if clone:\n # User wants a cloned transformed geometry returned.\n return GEOSGeometry(ptr, srid=g.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L509_C16", "label": "return", "type": "return", "loc": [509, 509], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L507_C12", "vector": [13, 4, 0.7597, 0.0015, 4, 0.57, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return GEOSGeometry(ptr, srid=g.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L510_C12", "label": "if", "type": "if", "loc": [510, 517], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L501_C8", "vector": [4, 3, 0.7664, 0.0119, 3, 0.04, 1.0, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ptr:\n # Reassigning pointer, and performing post-initialization setup\n # again due to the reassignment.\n capi.destroy_geom(self.ptr)\n self.ptr = ptr\n self._post_init(g.srid)\n else:\n raise GEOSException('Transformed WKB was invalid.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L513_C16", "label": "destroy_geom()", "type": "expression", "loc": [513, 513], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L510_C12", "vector": [8, 4, 0.7657, 0.0015, 4, 0.12, 0.0, 266, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "destroy_geom", "arg_names": [], "import_names": [], "rhs_call_name": "destroy_geom", "annotation": ""}, "snippet": " capi.destroy_geom(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L514_C16", "label": "self.ptr =", "type": "assigned_variable", "loc": [514, 514], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L510_C12", "vector": [14, 4, 0.7672, 0.0015, 4, 0.12, 0.5, 386, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.ptr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ptr = ptr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L515_C16", "label": "_post_init()", "type": "expression", "loc": [515, 515], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L510_C12", "vector": [8, 4, 0.7687, 0.0015, 4, 0.12, 1.0, 831, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_post_init", "arg_names": [], "import_names": [], "rhs_call_name": "_post_init", "annotation": ""}, "snippet": " self._post_init(g.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L520_C4", "label": "_topology", "type": "function", "loc": [520, 522], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.7776, 0.0045, 1, 0.76, 0.7821, 985, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "_topology", "arg_names": ["self", "gptr"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _topology(self, gptr):\n \"Helper routine to return Geometry from the given pointer.\"\n return GEOSGeometry(gptr, srid=self.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L521_C8", "label": "expression", "type": "expression", "loc": [521, 521], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L520_C4", "vector": [8, 2, 0.7776, 0.0015, 2, 0.1, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Helper routine to return Geometry from the given pointer.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L522_C8", "label": "return", "type": "return", "loc": [522, 522], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L520_C4", "vector": [13, 2, 0.7791, 0.0015, 2, 0.1, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return GEOSGeometry(gptr, srid=self.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L525_C4", "label": "boundary", "type": "function", "loc": [525, 527], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.7851, 0.0045, 1, 0.76, 0.7949, 780, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "boundary", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def boundary(self):\n \"Returns the boundary as a newly allocated Geometry object.\"\n return self._topology(capi.geos_boundary(self.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L526_C8", "label": "expression", "type": "expression", "loc": [526, 526], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L525_C4", "vector": [8, 2, 0.7851, 0.0015, 2, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the boundary as a newly allocated Geometry object.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L527_C8", "label": "return", "type": "return", "loc": [527, 527], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L525_C4", "vector": [13, 2, 0.7866, 0.0015, 2, 0.41, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._topology(capi.geos_boundary(self.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L529_C4", "label": "buffer", "type": "function", "loc": [529, 537], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.7955, 0.0134, 1, 0.76, 0.8077, 640, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "buffer", "arg_names": ["self", "width", "quadsegs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def buffer(self, width, quadsegs=8):\n \"\"\"\n Returns a geometry that represents all points whose distance from this\n Geometry is less than or equal to distance. Calculations are in the\n Spatial Reference System of this Geometry. The optional third parameter sets\n the number of segment used to approximate a quarter circle (defaults to 8).\n (Text from PostGIS documentation at ch. 6.1.3)\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L530_C8", "label": "expression", "type": "expression", "loc": [530, 536], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L529_C4", "vector": [8, 2, 0.7955, 0.0104, 2, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a geometry that represents all points whose distance from this\n Geometry is less than or equal to distance. Calculations are in the\n Spatial Reference System of this Geometry. The optional third parameter sets\n the number of segment used to approximate a quarter circle (defaults to 8).\n (Text from PostGIS documentation at ch. 6.1.3)\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L537_C8", "label": "return", "type": "return", "loc": [537, 537], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L529_C4", "vector": [13, 2, 0.8015, 0.0015, 2, 0.38, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._topology(capi.geos_buffer(self.ptr, width, quadsegs))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L540_C4", "label": "centroid", "type": "function", "loc": [540, 546], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.8104, 0.0104, 1, 0.76, 0.8205, 439, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "centroid", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def centroid(self):\n \"\"\"\n The centroid is equal to the centroid of the set of component Geometries\n of highest dimension (since the lower-dimension geometries contribute zero\n \"weight\" to the centroid).\n \"\"\"\n return self._topology(capi.geos_centroid(self.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L541_C8", "label": "expression", "type": "expression", "loc": [541, 545], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L540_C4", "vector": [8, 2, 0.8104, 0.0075, 2, 0.39, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n The centroid is equal to the centroid of the set of component Geometries\n of highest dimension (since the lower-dimension geometries contribute zero\n \"weight\" to the centroid).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L546_C8", "label": "return", "type": "return", "loc": [546, 546], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L540_C4", "vector": [13, 2, 0.8149, 0.0015, 2, 0.39, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._topology(capi.geos_centroid(self.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L549_C4", "label": "convex_hull", "type": "function", "loc": [549, 554], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.8231, 0.009, 1, 0.76, 0.8333, 1, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "convex_hull", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def convex_hull(self):\n \"\"\"\n Returns the smallest convex Polygon that contains all the points\n in the Geometry.\n \"\"\"\n return self._topology(capi.geos_convexhull(self.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L550_C8", "label": "expression", "type": "expression", "loc": [550, 553], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L549_C4", "vector": [8, 2, 0.8231, 0.006, 2, 0.8, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the smallest convex Polygon that contains all the points\n in the Geometry.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L554_C8", "label": "return", "type": "return", "loc": [554, 554], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L549_C4", "vector": [13, 2, 0.8269, 0.0015, 2, 0.8, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._topology(capi.geos_convexhull(self.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L556_C4", "label": "difference", "type": "function", "loc": [556, 561], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.8336, 0.009, 1, 0.76, 0.8462, 498, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "difference", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def difference(self, other):\n \"\"\"\n Returns a Geometry representing the points making up this Geometry\n that do not make up other.\n \"\"\"\n return self._topology(capi.geos_difference(self.ptr, other.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L557_C8", "label": "expression", "type": "expression", "loc": [557, 560], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L556_C4", "vector": [8, 2, 0.8336, 0.006, 2, 0.6, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a Geometry representing the points making up this Geometry\n that do not make up other.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L561_C8", "label": "return", "type": "return", "loc": [561, 561], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L556_C4", "vector": [13, 2, 0.8373, 0.0015, 2, 0.6, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._topology(capi.geos_difference(self.ptr, other.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L564_C4", "label": "envelope", "type": "function", "loc": [564, 566], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.8433, 0.0045, 1, 0.76, 0.859, 48, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "envelope", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def envelope(self):\n \"Return the envelope for this geometry (a polygon).\"\n return self._topology(capi.geos_envelope(self.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L565_C8", "label": "expression", "type": "expression", "loc": [565, 565], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L564_C4", "vector": [8, 2, 0.8433, 0.0015, 2, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Return the envelope for this geometry (a polygon).\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L566_C8", "label": "return", "type": "return", "loc": [566, 566], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L564_C4", "vector": [13, 2, 0.8448, 0.0015, 2, 0.85, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._topology(capi.geos_envelope(self.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L568_C4", "label": "intersection", "type": "function", "loc": [568, 570], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.8493, 0.0045, 1, 0.76, 0.8718, 568, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "intersection", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def intersection(self, other):\n \"Returns a Geometry representing the points shared by this Geometry and other.\"\n return self._topology(capi.geos_intersection(self.ptr, other.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L569_C8", "label": "expression", "type": "expression", "loc": [569, 569], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L568_C4", "vector": [8, 2, 0.8493, 0.0015, 2, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a Geometry representing the points shared by this Geometry and other.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L570_C8", "label": "return", "type": "return", "loc": [570, 570], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L568_C4", "vector": [13, 2, 0.8507, 0.0015, 2, 0.88, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._topology(capi.geos_intersection(self.ptr, other.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L573_C4", "label": "point_on_surface", "type": "function", "loc": [573, 575], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.8567, 0.0045, 1, 0.76, 0.8846, 858, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "point_on_surface", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def point_on_surface(self):\n \"Computes an interior point of this Geometry.\"\n return self._topology(capi.geos_pointonsurface(self.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L574_C8", "label": "expression", "type": "expression", "loc": [574, 574], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L573_C4", "vector": [8, 2, 0.8567, 0.0015, 2, 0.39, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Computes an interior point of this Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L575_C8", "label": "return", "type": "return", "loc": [575, 575], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L573_C4", "vector": [13, 2, 0.8582, 0.0015, 2, 0.39, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._topology(capi.geos_pointonsurface(self.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L577_C4", "label": "relate", "type": "function", "loc": [577, 579], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.8627, 0.0045, 1, 0.76, 0.8974, 525, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "relate", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def relate(self, other):\n \"Returns the DE-9IM intersection matrix for this Geometry and the other.\"\n return capi.geos_relate(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L578_C8", "label": "expression", "type": "expression", "loc": [578, 578], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L577_C4", "vector": [8, 2, 0.8627, 0.0015, 2, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the DE-9IM intersection matrix for this Geometry and the other.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L579_C8", "label": "return", "type": "return", "loc": [579, 579], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L577_C4", "vector": [13, 2, 0.8642, 0.0015, 2, 0.76, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.geos_relate(self.ptr, other.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L581_C4", "label": "simplify", "type": "function", "loc": [581, 596], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.8784, 0.0239, 1, 0.76, 0.9103, 278, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "simplify", "arg_names": ["self", "tolerance", "preserve_topology"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def simplify(self, tolerance=0.0, preserve_topology=False):\n \"\"\"\n Returns the Geometry, simplified using the Douglas-Peucker algorithm\n to the specified tolerance (higher tolerance => less points). If no\n tolerance provided, defaults to 0.\n\n By default, this function does not preserve topology - e.g. polygons can\n be split, collapse to lines or disappear holes can be created or"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L582_C8", "label": "expression", "type": "expression", "loc": [582, 592], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L581_C4", "vector": [8, 2, 0.8761, 0.0164, 2, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the Geometry, simplified using the Douglas-Peucker algorithm\n to the specified tolerance (higher tolerance => less points). If no\n tolerance provided, defaults to 0.\n\n By default, this function does not preserve topology - e.g. polygons can\n be split, collapse to lines or disappear holes can be created or\n disappear, and lines can cross. By specifying preserve_topology=True,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L593_C8", "label": "if", "type": "if", "loc": [593, 596], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L581_C4", "vector": [4, 2, 0.8873, 0.006, 2, 0.84, 1.0, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if preserve_topology:\n return self._topology(capi.geos_preservesimplify(self.ptr, tolerance))\n else:\n return self._topology(capi.geos_simplify(self.ptr, tolerance))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L594_C12", "label": "return", "type": "return", "loc": [594, 594], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L593_C8", "vector": [13, 3, 0.8866, 0.0015, 3, 0.66, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._topology(capi.geos_preservesimplify(self.ptr, tolerance))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L596_C12", "label": "return", "type": "return", "loc": [596, 596], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L593_C8", "vector": [13, 3, 0.8896, 0.0015, 3, 0.66, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._topology(capi.geos_simplify(self.ptr, tolerance))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L598_C4", "label": "sym_difference", "type": "function", "loc": [598, 603], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.8963, 0.009, 1, 0.76, 0.9231, 37, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "sym_difference", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def sym_difference(self, other):\n \"\"\"\n Returns a set combining the points in this Geometry not in other,\n and the points in other not in this Geometry.\n \"\"\"\n return self._topology(capi.geos_symdifference(self.ptr, other.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L599_C8", "label": "expression", "type": "expression", "loc": [599, 602], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L598_C4", "vector": [8, 2, 0.8963, 0.006, 2, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a set combining the points in this Geometry not in other,\n and the points in other not in this Geometry.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L603_C8", "label": "return", "type": "return", "loc": [603, 603], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L598_C4", "vector": [13, 2, 0.9, 0.0015, 2, 0.67, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._topology(capi.geos_symdifference(self.ptr, other.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L605_C4", "label": "union", "type": "function", "loc": [605, 607], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.9045, 0.0045, 1, 0.76, 0.9359, 140, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "union", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def union(self, other):\n \"Returns a Geometry representing all the points in this Geometry and other.\"\n return self._topology(capi.geos_union(self.ptr, other.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L606_C8", "label": "expression", "type": "expression", "loc": [606, 606], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L605_C4", "vector": [8, 2, 0.9045, 0.0015, 2, 0.71, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a Geometry representing all the points in this Geometry and other.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L607_C8", "label": "return", "type": "return", "loc": [607, 607], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L605_C4", "vector": [13, 2, 0.906, 0.0015, 2, 0.71, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._topology(capi.geos_union(self.ptr, other.ptr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L611_C4", "label": "area", "type": "function", "loc": [611, 613], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.9134, 0.0045, 1, 0.76, 0.9487, 715, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "area", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def area(self):\n \"Returns the area of the Geometry.\"\n return capi.geos_area(self.ptr, byref(c_double()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L612_C8", "label": "expression", "type": "expression", "loc": [612, 612], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L611_C4", "vector": [8, 2, 0.9134, 0.0015, 2, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the area of the Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L613_C8", "label": "return", "type": "return", "loc": [613, 613], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L611_C4", "vector": [13, 2, 0.9149, 0.0015, 2, 0.94, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.geos_area(self.ptr, byref(c_double()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L615_C4", "label": "distance", "type": "function", "loc": [615, 623], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.9239, 0.0134, 1, 0.76, 0.9615, 145, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "distance", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def distance(self, other):\n \"\"\"\n Returns the distance between the closest points on this Geometry\n and the other. Units will be in those of the coordinate system of\n the Geometry.\n \"\"\"\n if not isinstance(other, GEOSGeometry):\n raise TypeError('distance() works only on other GEOS Geometries.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L616_C8", "label": "expression", "type": "expression", "loc": [616, 620], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L615_C4", "vector": [8, 2, 0.9224, 0.0075, 2, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the distance between the closest points on this Geometry\n and the other. Units will be in those of the coordinate system of\n the Geometry.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L621_C8", "label": "if", "type": "if", "loc": [621, 622], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L615_C4", "vector": [4, 2, 0.9276, 0.003, 2, 0.49, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(other, GEOSGeometry):\n raise TypeError('distance() works only on other GEOS Geometries.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L623_C8", "label": "return", "type": "return", "loc": [623, 623], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L615_C4", "vector": [13, 2, 0.9299, 0.0015, 2, 0.49, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.geos_distance(self.ptr, other.ptr, byref(c_double()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L626_C4", "label": "extent", "type": "function", "loc": [626, 638], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.9433, 0.0194, 1, 0.76, 0.9744, 962, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "extent", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def extent(self):\n \"\"\"\n Returns the extent of this geometry as a 4-tuple, consisting of\n (xmin, ymin, xmax, ymax).\n \"\"\"\n env = self.envelope\n if isinstance(env, Point):\n xmin, ymin = env.tuple"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L627_C8", "label": "expression", "type": "expression", "loc": [627, 630], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L626_C4", "vector": [8, 2, 0.9381, 0.006, 2, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the extent of this geometry as a 4-tuple, consisting of\n (xmin, ymin, xmax, ymax).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L631_C8", "label": "env =", "type": "assigned_variable", "loc": [631, 631], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L626_C4", "vector": [14, 2, 0.9418, 0.0015, 2, 0.72, 0.3333, 803, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "env", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " env = self.envelope"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L632_C8", "label": "if", "type": "if", "loc": [632, 637], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L626_C4", "vector": [4, 2, 0.947, 0.009, 2, 0.72, 0.6667, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(env, Point):\n xmin, ymin = env.tuple\n xmax, ymax = xmin, ymin\n else:\n xmin, ymin = env[0][0]\n xmax, ymax = env[0][2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L633_C12", "label": "xmin, ymin =", "type": "assigned_variable", "loc": [633, 633], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L632_C8", "vector": [14, 3, 0.9448, 0.0015, 3, 0.89, 0.0, 72, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "xmin, ymin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xmin, ymin = env.tuple"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L634_C12", "label": "xmax, ymax =", "type": "assigned_variable", "loc": [634, 634], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L632_C8", "vector": [14, 3, 0.9463, 0.0015, 3, 0.89, 0.3333, 344, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "xmax, ymax", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xmax, ymax = xmin, ymin"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L636_C12", "label": "xmin, ymin =", "type": "assigned_variable", "loc": [636, 636], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L632_C8", "vector": [14, 3, 0.9493, 0.0015, 3, 0.89, 0.6667, 72, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "xmin, ymin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xmin, ymin = env[0][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L637_C12", "label": "xmax, ymax =", "type": "assigned_variable", "loc": [637, 637], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L632_C8", "vector": [14, 3, 0.9507, 0.0015, 3, 0.89, 1.0, 344, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "xmax, ymax", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xmax, ymax = env[0][2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L638_C8", "label": "return", "type": "return", "loc": [638, 638], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L626_C4", "vector": [13, 2, 0.9522, 0.0015, 2, 0.72, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (xmin, ymin, xmax, ymax)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L641_C4", "label": "length", "type": "function", "loc": [641, 646], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.9604, 0.009, 1, 0.76, 0.9872, 221, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "length", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def length(self):\n \"\"\"\n Returns the length of this Geometry (e.g., 0 for point, or the\n circumfrence of a Polygon).\n \"\"\"\n return capi.geos_length(self.ptr, byref(c_double()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L642_C8", "label": "expression", "type": "expression", "loc": [642, 645], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L641_C4", "vector": [8, 2, 0.9604, 0.006, 2, 0.04, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the length of this Geometry (e.g., 0 for point, or the\n circumfrence of a Polygon).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L646_C8", "label": "return", "type": "return", "loc": [646, 646], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L641_C4", "vector": [13, 2, 0.9642, 0.0015, 2, 0.04, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.geos_length(self.ptr, byref(c_double()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L648_C4", "label": "clone", "type": "function", "loc": [648, 650], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "vector": [2, 1, 0.9687, 0.0045, 1, 0.76, 1.0, 911, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "clone", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clone(self):\n \"Clones this Geometry.\"\n return GEOSGeometry(capi.geom_clone(self.ptr), srid=self.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L649_C8", "label": "expression", "type": "expression", "loc": [649, 649], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L648_C4", "vector": [8, 2, 0.9687, 0.0015, 2, 0.7, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Clones this Geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L650_C8", "label": "return", "type": "return", "loc": [650, 650], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L648_C4", "vector": [13, 2, 0.9701, 0.0015, 2, 0.7, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return GEOSGeometry(capi.geom_clone(self.ptr), srid=self.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:ImportFrom_L654_C0", "label": "from django.contrib.gis.geos.linestring import LineString, LinearRing", "type": "import", "loc": [654, 654], "level": 0, "parent": null, "vector": [1, 0, 0.9761, 0.0015, 0, 0.66, 0.7222, 662, 0, 2, 0, 0, 662, 0, 0], "semantic": {"name": "django.contrib.gis.geos.linestring", "arg_names": [], "import_names": ["LineString", "LinearRing"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.linestring import LineString, LinearRing"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:ImportFrom_L655_C0", "label": "from django.contrib.gis.geos.point import Point", "type": "import", "loc": [655, 655], "level": 0, "parent": null, "vector": [1, 0, 0.9776, 0.0015, 0, 0.66, 0.7778, 711, 0, 1, 0, 0, 711, 0, 0], "semantic": {"name": "django.contrib.gis.geos.point", "arg_names": [], "import_names": ["Point"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.point import Point"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:ImportFrom_L656_C0", "label": "from django.contrib.gis.geos.polygon import Polygon", "type": "import", "loc": [656, 656], "level": 0, "parent": null, "vector": [1, 0, 0.9791, 0.0015, 0, 0.66, 0.8333, 745, 0, 1, 0, 0, 745, 0, 0], "semantic": {"name": "django.contrib.gis.geos.polygon", "arg_names": [], "import_names": ["Polygon"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.polygon import Polygon"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:ImportFrom_L657_C0", "label": "from django.contrib.gis.geos.collections import GeometryCollection, MultiPoint, MultiLineString\u2026", "type": "import", "loc": [657, 657], "level": 0, "parent": null, "vector": [1, 0, 0.9806, 0.0015, 0, 0.66, 0.8889, 54, 0, 4, 0, 0, 54, 0, 0], "semantic": {"name": "django.contrib.gis.geos.collections", "arg_names": [], "import_names": ["GeometryCollection", "MultiPoint", "MultiLineString", "MultiPolygon"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.collections import GeometryCollection, MultiPoint, MultiLineString, MultiPolygon"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L658_C0", "label": "GEOS_CLASSES =", "type": "assigned_variable", "loc": [658, 666], "level": 0, "parent": null, "vector": [14, 0, 0.9881, 0.0134, 0, 0.66, 0.9444, 135, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "GEOS_CLASSES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "GEOS_CLASSES = {0 : Point,\n 1 : LineString,\n 2 : LinearRing,\n 3 : Polygon,\n 4 : MultiPoint,\n 5 : MultiLineString,\n 6 : MultiPolygon,\n 7 : GeometryCollection,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L669_C0", "label": "if", "type": "if", "loc": [669, 670], "level": 0, "parent": null, "vector": [4, 0, 0.9993, 0.003, 0, 0.66, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if GEOS_PREPARE:\n from django.contrib.gis.geos.prepared import PreparedGeometry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98740:ImportFrom_L670_C4", "label": "from django.contrib.gis.geos.prepared import PreparedGeometry", "type": "import", "loc": [670, 670], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L669_C0", "vector": [1, 1, 1.0, 0.0015, 1, 0.59, 0.0, 867, 0, 1, 0, 0, 867, 0, 0], "semantic": {"name": "django.contrib.gis.geos.prepared", "arg_names": [], "import_names": ["PreparedGeometry"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.geos.prepared import PreparedGeometry"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L57_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L59_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L61_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L62_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L62_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L64_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L64_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L64_C40"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L62_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L65_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L62_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L66_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L66_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L68_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L66_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L69_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L71_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L74_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L76_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L74_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L80_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L81_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L86_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L88_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L95_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L95_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L98_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L98_C43"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L95_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L95_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L107_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L107_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L112_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L112_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L138_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L143_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L143_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L143_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L143_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L143_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L152_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L152_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L157_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L158_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L157_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L159_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L159_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L160_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L159_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L162_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L172_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L173_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L172_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L174_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L177_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L177_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L178_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L177_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L187_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L188_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L193_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L193_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L194_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L193_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L196_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L196_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L197_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L196_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L199_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L201_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L202_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L203_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L203_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L204_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L203_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L206_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L209_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L209_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L210_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L209_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L211_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L211_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L212_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L216_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L216_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L217_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L216_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L218_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L221_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L221_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L222_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L221_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L223_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L226_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L226_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L227_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L226_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L231_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L231_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L232_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L231_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L233_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L236_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L236_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L237_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L236_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L238_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L241_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L241_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L242_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L241_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L243_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L245_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L246_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L247_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L251_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L251_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L252_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L251_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L256_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L259_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L259_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L260_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L259_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L261_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L264_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L264_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L265_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L264_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L266_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L269_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L269_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L270_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L269_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L271_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L274_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L274_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L275_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L274_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L276_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L279_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L280_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L283_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L285_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L288_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L288_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L289_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L288_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L290_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L292_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L292_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L293_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L292_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L298_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L300_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L300_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L301_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L300_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L305_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L307_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L307_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L308_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L307_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L312_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L314_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L314_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L315_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L314_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L319_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L321_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L321_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L322_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L321_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L323_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L325_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L326_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L330_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L332_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L332_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L333_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L332_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L337_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L332_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L339_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L341_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L341_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L342_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L341_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L346_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L348_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L348_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L349_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L348_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L353_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L356_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L356_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L357_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L356_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L358_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L356_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L359_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L359_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L359_C19"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L359_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L360_C14"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L362_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L362_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L363_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L362_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L364_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L365_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L369_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L370_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L375_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L375_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L375_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L375_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L376_C14"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L379_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L379_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L380_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L379_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L381_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L384_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L385_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L393_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L396_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L396_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L397_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L396_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L402_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L402_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L403_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L402_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L406_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L402_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L408_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L411_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L411_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L412_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L411_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L416_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L416_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L417_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L420_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L423_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L423_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L424_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L423_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L429_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L432_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L432_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L433_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L432_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L438_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L438_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L439_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L438_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L442_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L438_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L444_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L447_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L447_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L448_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L447_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L449_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L447_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L450_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L453_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L453_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L454_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L453_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L458_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L458_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L459_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L465_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L465_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L466_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L465_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L467_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L467_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L468_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L468_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L469_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L468_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L471_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L476_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L476_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L477_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L476_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L478_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L478_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L479_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L479_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L480_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L479_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L482_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L487_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L487_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L488_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L487_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L489_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L491_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L491_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L492_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L491_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L500_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L491_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L501_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L501_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L503_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L501_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L504_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L501_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L506_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L501_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L507_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L507_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L509_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L501_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L510_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L510_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L513_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L510_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L514_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L510_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L515_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L520_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L520_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L521_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L520_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L522_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L525_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L525_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L526_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L525_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L527_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L529_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L529_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L530_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L529_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L537_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L540_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L540_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L541_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L540_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L546_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L549_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L549_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L550_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L549_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L554_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L556_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L556_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L557_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L556_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L561_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L564_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L564_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L565_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L564_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L566_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L568_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L568_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L569_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L568_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L570_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L573_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L573_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L574_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L573_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L575_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L577_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L577_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L578_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L577_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L579_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L581_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L581_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L582_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L581_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L593_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L593_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L594_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L593_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L596_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L598_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L598_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L599_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L598_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L603_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L605_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L605_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L606_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L605_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L607_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L611_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L611_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L612_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L611_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L613_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L615_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L615_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L616_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L615_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L621_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L615_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L623_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L626_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L626_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L627_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L626_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L631_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L626_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L632_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L632_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L633_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L632_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L634_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L632_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L636_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L632_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L637_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L626_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L638_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L641_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L641_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L642_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L641_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L646_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L648_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L648_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L649_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:FunctionDef_L648_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Return_L650_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:If_L669_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:ImportFrom_L670_C4"}] |
from ctypes import c_uint
from django.contrib.gis.geos.error import GEOSException
from django.contrib.gis.geos.geometry import GEOSGeometry
from django.contrib.gis.geos import prototypes as capi
class Point(GEOSGeometry):
_minlength = 2
_maxlength = 3
def __init__(self, x, y=None, z=None, srid=None):
"""
The Point object may be initialized with either a tuple, or individual
parameters.
For Example:
>>> p = Point((5, 23)) # 2D point, passed in as a tuple
>>> p = Point(5, 23, 8) # 3D point, passed in with individual parameters
"""
if isinstance(x, (tuple, list)):
# Here a tuple or list was passed in under the `x` parameter.
ndim = len(x)
coords = x
elif isinstance(x, (int, float, long)) and isinstance(y, (int, float, long)):
# Here X, Y, and (optionally) Z were passed in individually, as parameters.
if isinstance(z, (int, float, long)):
ndim = 3
coords = [x, y, z]
else:
ndim = 2
coords = [x, y]
else:
raise TypeError('Invalid parameters given for Point initialization.')
point = self._create_point(ndim, coords)
# Initializing using the address returned from the GEOS
# createPoint factory.
super(Point, self).__init__(point, srid=srid)
def _create_point(self, ndim, coords):
"""
Create a coordinate sequence, set X, Y, [Z], and create point
"""
if ndim < 2 or ndim > 3:
raise TypeError('Invalid point dimension: %s' % str(ndim))
cs = capi.create_cs(c_uint(1), c_uint(ndim))
i = iter(coords)
capi.cs_setx(cs, 0, i.next())
capi.cs_sety(cs, 0, i.next())
if ndim == 3: capi.cs_setz(cs, 0, i.next())
return capi.create_point(cs)
def _set_list(self, length, items):
ptr = self._create_point(length, items)
if ptr:
capi.destroy_geom(self.ptr)
self._ptr = ptr
self._set_cs()
else:
# can this happen?
raise GEOSException('Geometry resulting from slice deletion was invalid.')
def _set_single(self, index, value):
self._cs.setOrdinate(index, 0, value)
def __iter__(self):
"Allows iteration over coordinates of this Point."
for i in xrange(len(self)):
yield self[i]
def __len__(self):
"Returns the number of dimensions for this Point (either 0, 2 or 3)."
if self.empty: return 0
if self.hasz: return 3
else: return 2
def _get_single_external(self, index):
if index == 0:
return self.x
elif index == 1:
return self.y
elif index == 2:
return self.z
_get_single_internal = _get_single_external
def get_x(self):
"Returns the X component of the Point."
return self._cs.getOrdinate(0, 0)
def set_x(self, value):
"Sets the X component of the Point."
self._cs.setOrdinate(0, 0, value)
def get_y(self):
"Returns the Y component of the Point."
return self._cs.getOrdinate(1, 0)
def set_y(self, value):
"Sets the Y component of the Point."
self._cs.setOrdinate(1, 0, value)
def get_z(self):
"Returns the Z component of the Point."
if self.hasz:
return self._cs.getOrdinate(2, 0)
else:
return None
def set_z(self, value):
"Sets the Z component of the Point."
if self.hasz:
self._cs.setOrdinate(2, 0, value)
else:
raise GEOSException('Cannot set Z on 2D Point.')
# X, Y, Z properties
x = property(get_x, set_x)
y = property(get_y, set_y)
z = property(get_z, set_z)
### Tuple setting and retrieval routines. ###
def get_coords(self):
"Returns a tuple of the point."
return self._cs.tuple
def set_coords(self, tup):
"Sets the coordinates of the point with the given tuple."
self._cs[0] = tup
# The tuple and coords properties
tuple = property(get_coords, set_coords)
coords = tuple
| ajibawa-2023/Python-Code-Large/train/row_98741 | 89 | 135 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98741:ImportFrom_L1_C0", "label": "from ctypes import c_uint", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0074, 0.0074, 0, 0.66, 0.0, 182, 0, 1, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_uint"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ctypes import c_uint"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:ImportFrom_L2_C0", "label": "from django.contrib.gis.geos.error import GEOSException", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0148, 0.0074, 0, 0.66, 0.25, 827, 0, 1, 0, 0, 827, 0, 0], "semantic": {"name": "django.contrib.gis.geos.error", "arg_names": [], "import_names": ["GEOSException"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.error import GEOSException"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:ImportFrom_L3_C0", "label": "from django.contrib.gis.geos.geometry import GEOSGeometry", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0222, 0.0074, 0, 0.66, 0.5, 843, 0, 1, 0, 0, 843, 0, 0], "semantic": {"name": "django.contrib.gis.geos.geometry", "arg_names": [], "import_names": ["GEOSGeometry"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.geometry import GEOSGeometry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:ImportFrom_L4_C0", "label": "from django.contrib.gis.geos import capi", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0296, 0.0074, 0, 0.66, 0.75, 886, 0, 1, 0, 0, 886, 0, 0], "semantic": {"name": "django.contrib.gis.geos", "arg_names": [], "import_names": ["capi"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos import prototypes as capi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "label": "Point", "type": "class", "loc": [6, 135], "level": 0, "parent": null, "vector": [3, 0, 0.5222, 0.963, 0, 0.66, 1.0, 652, 0, 15, 0, 0, 958, 0, 40], "semantic": {"name": "Point", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Point(GEOSGeometry):\n _minlength = 2\n _maxlength = 3\n\n def __init__(self, x, y=None, z=None, srid=None):\n \"\"\"\n The Point object may be initialized with either a tuple, or individual\n parameters."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L7_C4", "label": "_minlength =", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "vector": [14, 1, 0.0519, 0.0074, 1, 0.77, 0.0, 990, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "_minlength", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _minlength = 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L8_C4", "label": "_maxlength =", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "vector": [14, 1, 0.0593, 0.0074, 1, 0.77, 0.0455, 385, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "_maxlength", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _maxlength = 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L10_C4", "label": "__init__", "type": "function", "loc": [10, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "vector": [2, 1, 0.1778, 0.2148, 1, 0.77, 0.0909, 555, 0, 5, 0, 0, 0, 0, 9], "semantic": {"name": "__init__", "arg_names": ["self", "x", "y", "z", "srid"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, x, y=None, z=None, srid=None):\n \"\"\"\n The Point object may be initialized with either a tuple, or individual\n parameters.\n\n For Example:\n >>> p = Point((5, 23)) # 2D point, passed in as a tuple\n >>> p = Point(5, 23, 8) # 3D point, passed in with individual parameters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L11_C8", "label": "expression", "type": "expression", "loc": [11, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L10_C4", "vector": [8, 2, 0.1074, 0.0593, 2, 0.64, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n The Point object may be initialized with either a tuple, or individual\n parameters.\n\n For Example:\n >>> p = Point((5, 23)) # 2D point, passed in as a tuple\n >>> p = Point(5, 23, 8) # 3D point, passed in with individual parameters\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L19_C8", "label": "if", "type": "if", "loc": [19, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L10_C4", "vector": [4, 2, 0.1889, 0.1037, 2, 0.64, 0.3333, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(x, (tuple, list)):\n # Here a tuple or list was passed in under the `x` parameter.\n ndim = len(x)\n coords = x\n elif isinstance(x, (int, float, long)) and isinstance(y, (int, float, long)):\n # Here X, Y, and (optionally) Z were passed in individually, as parameters.\n if isinstance(z, (int, float, long)):\n ndim = 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L21_C12", "label": "ndim = len()", "type": "assigned_variable", "loc": [21, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L19_C8", "vector": [14, 3, 0.1556, 0.0074, 3, 0.88, 0.0, 129, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "ndim", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " ndim = len(x)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L22_C12", "label": "coords =", "type": "assigned_variable", "loc": [22, 22], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L19_C8", "vector": [14, 3, 0.163, 0.0074, 3, 0.88, 0.5, 216, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "coords", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " coords = x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L23_C8", "label": "if", "type": "if", "loc": [23, 32], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L19_C8", "vector": [4, 3, 0.2037, 0.0741, 3, 0.88, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(x, (int, float, long)) and isinstance(y, (int, float, long)):\n # Here X, Y, and (optionally) Z were passed in individually, as parameters.\n if isinstance(z, (int, float, long)):\n ndim = 3\n coords = [x, y, z]\n else:\n ndim = 2\n coords = [x, y]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L25_C12", "label": "if", "type": "if", "loc": [25, 30], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L23_C8", "vector": [4, 4, 0.2037, 0.0444, 4, 0.8, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(z, (int, float, long)):\n ndim = 3\n coords = [x, y, z]\n else:\n ndim = 2\n coords = [x, y]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L26_C16", "label": "ndim =", "type": "assigned_variable", "loc": [26, 26], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L25_C12", "vector": [14, 5, 0.1926, 0.0074, 5, 0.76, 0.0, 129, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "ndim", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ndim = 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L27_C16", "label": "coords =", "type": "assigned_variable", "loc": [27, 27], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L25_C12", "vector": [14, 5, 0.2, 0.0074, 5, 0.76, 0.3333, 216, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "coords", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " coords = [x, y, z]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L29_C16", "label": "ndim =", "type": "assigned_variable", "loc": [29, 29], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L25_C12", "vector": [14, 5, 0.2148, 0.0074, 5, 0.76, 0.6667, 129, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "ndim", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ndim = 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L30_C16", "label": "coords =", "type": "assigned_variable", "loc": [30, 30], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L25_C12", "vector": [14, 5, 0.2222, 0.0074, 5, 0.76, 1.0, 216, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "coords", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " coords = [x, y]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L34_C8", "label": "point = _create_point()", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L10_C4", "vector": [14, 2, 0.2519, 0.0074, 2, 0.64, 0.6667, 16, 3, 2, 0, 0, 313, 10, 1], "semantic": {"name": "point", "arg_names": [], "import_names": [], "rhs_call_name": "_create_point", "annotation": ""}, "snippet": " point = self._create_point(ndim, coords)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L38_C8", "label": "__init__()", "type": "expression", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L10_C4", "vector": [8, 2, 0.2815, 0.0074, 2, 0.64, 1.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(Point, self).__init__(point, srid=srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L40_C4", "label": "_create_point", "type": "function", "loc": [40, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "vector": [2, 1, 0.3444, 0.1037, 1, 0.77, 0.1364, 313, 0, 3, 1, 0, 0, 0, 13], "semantic": {"name": "_create_point", "arg_names": ["self", "ndim", "coords"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _create_point(self, ndim, coords):\n \"\"\"\n Create a coordinate sequence, set X, Y, [Z], and create point\n \"\"\"\n if ndim < 2 or ndim > 3:\n raise TypeError('Invalid point dimension: %s' % str(ndim))\n\n cs = capi.create_cs(c_uint(1), c_uint(ndim))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L41_C8", "label": "expression", "type": "expression", "loc": [41, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L40_C4", "vector": [8, 2, 0.3111, 0.0222, 2, 0.09, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Create a coordinate sequence, set X, Y, [Z], and create point\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L44_C8", "label": "if", "type": "if", "loc": [44, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L40_C4", "vector": [4, 2, 0.3296, 0.0148, 2, 0.09, 0.1429, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ndim < 2 or ndim > 3:\n raise TypeError('Invalid point dimension: %s' % str(ndim))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L47_C8", "label": "cs = create_cs()", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L40_C4", "vector": [14, 2, 0.3481, 0.0074, 2, 0.09, 0.2857, 256, 3, 2, 0, 0, 360, 10, 3], "semantic": {"name": "cs", "arg_names": [], "import_names": [], "rhs_call_name": "create_cs", "annotation": ""}, "snippet": " cs = capi.create_cs(c_uint(1), c_uint(ndim))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L48_C8", "label": "i = iter()", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L40_C4", "vector": [14, 2, 0.3556, 0.0074, 2, 0.09, 0.4286, 826, 3, 1, 0, 0, 557, 10, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "iter", "annotation": ""}, "snippet": " i = iter(coords)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L49_C8", "label": "cs_setx()", "type": "expression", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L40_C4", "vector": [8, 2, 0.363, 0.0074, 2, 0.09, 0.5714, 344, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "cs_setx", "arg_names": [], "import_names": [], "rhs_call_name": "cs_setx", "annotation": ""}, "snippet": " capi.cs_setx(cs, 0, i.next())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L50_C8", "label": "cs_sety()", "type": "expression", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L40_C4", "vector": [8, 2, 0.3704, 0.0074, 2, 0.09, 0.7143, 300, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "cs_sety", "arg_names": [], "import_names": [], "rhs_call_name": "cs_sety", "annotation": ""}, "snippet": " capi.cs_sety(cs, 0, i.next())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L51_C8", "label": "if", "type": "if", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L40_C4", "vector": [4, 2, 0.3778, 0.0074, 2, 0.09, 0.8571, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ndim == 3: capi.cs_setz(cs, 0, i.next())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L51_C22", "label": "cs_setz()", "type": "expression", "loc": [51, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L51_C8", "vector": [8, 3, 0.3778, 0.0074, 3, 0.46, 0.0, 952, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "cs_setz", "arg_names": [], "import_names": [], "rhs_call_name": "cs_setz", "annotation": ""}, "snippet": " if ndim == 3: capi.cs_setz(cs, 0, i.next())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Return_L53_C8", "label": "return", "type": "return", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L40_C4", "vector": [13, 2, 0.3926, 0.0074, 2, 0.09, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return capi.create_point(cs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L55_C4", "label": "_set_list", "type": "function", "loc": [55, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "vector": [2, 1, 0.437, 0.0667, 1, 0.77, 0.1818, 305, 0, 3, 0, 0, 0, 0, 4], "semantic": {"name": "_set_list", "arg_names": ["self", "length", "items"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_list(self, length, items):\n ptr = self._create_point(length, items)\n if ptr:\n capi.destroy_geom(self.ptr)\n self._ptr = ptr\n self._set_cs()\n else:\n # can this happen?"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L56_C8", "label": "ptr = _create_point()", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L55_C4", "vector": [14, 2, 0.4148, 0.0074, 2, 0.19, 0.0, 676, 3, 2, 0, 0, 313, 10, 1], "semantic": {"name": "ptr", "arg_names": [], "import_names": [], "rhs_call_name": "_create_point", "annotation": ""}, "snippet": " ptr = self._create_point(length, items)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L57_C8", "label": "if", "type": "if", "loc": [57, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L55_C4", "vector": [4, 2, 0.4444, 0.0519, 2, 0.19, 1.0, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ptr:\n capi.destroy_geom(self.ptr)\n self._ptr = ptr\n self._set_cs()\n else:\n # can this happen?\n raise GEOSException('Geometry resulting from slice deletion was invalid.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L58_C12", "label": "destroy_geom()", "type": "expression", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L57_C8", "vector": [8, 3, 0.4296, 0.0074, 3, 0.44, 0.0, 266, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "destroy_geom", "arg_names": [], "import_names": [], "rhs_call_name": "destroy_geom", "annotation": ""}, "snippet": " capi.destroy_geom(self.ptr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L59_C12", "label": "self._ptr =", "type": "assigned_variable", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L57_C8", "vector": [14, 3, 0.437, 0.0074, 3, 0.44, 0.5, 479, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._ptr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._ptr = ptr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L60_C12", "label": "_set_cs()", "type": "expression", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L57_C8", "vector": [8, 3, 0.4444, 0.0074, 3, 0.44, 1.0, 372, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_set_cs", "arg_names": [], "import_names": [], "rhs_call_name": "_set_cs", "annotation": ""}, "snippet": " self._set_cs()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L65_C4", "label": "_set_single", "type": "function", "loc": [65, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "vector": [2, 1, 0.4852, 0.0148, 1, 0.77, 0.2273, 950, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "_set_single", "arg_names": ["self", "index", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_single(self, index, value):\n self._cs.setOrdinate(index, 0, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L66_C8", "label": "setOrdinate()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L65_C4", "vector": [8, 2, 0.4889, 0.0074, 2, 0.76, 0.0, 640, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setOrdinate", "arg_names": [], "import_names": [], "rhs_call_name": "setOrdinate", "annotation": ""}, "snippet": " self._cs.setOrdinate(index, 0, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L68_C4", "label": "__iter__", "type": "function", "loc": [68, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "vector": [2, 1, 0.5148, 0.0296, 1, 0.77, 0.2727, 891, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n \"Allows iteration over coordinates of this Point.\"\n for i in xrange(len(self)):\n yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L69_C8", "label": "expression", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L68_C4", "vector": [8, 2, 0.5111, 0.0074, 2, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Allows iteration over coordinates of this Point.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:For_L70_C8", "label": "for i", "type": "for", "loc": [70, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L68_C4", "vector": [6, 2, 0.5222, 0.0148, 2, 0.45, 1.0, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange(len(self)):\n yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L71_C12", "label": "expression", "type": "expression", "loc": [71, 71], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:For_L70_C8", "vector": [8, 3, 0.5259, 0.0074, 3, 0.96, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L73_C4", "label": "__len__", "type": "function", "loc": [73, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "vector": [2, 1, 0.5556, 0.037, 1, 0.77, 0.3182, 76, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__len__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __len__(self):\n \"Returns the number of dimensions for this Point (either 0, 2 or 3).\"\n if self.empty: return 0\n if self.hasz: return 3\n else: return 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L74_C8", "label": "expression", "type": "expression", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L73_C4", "vector": [8, 2, 0.5481, 0.0074, 2, 0.47, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the number of dimensions for this Point (either 0, 2 or 3).\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L75_C8", "label": "if", "type": "if", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L73_C4", "vector": [4, 2, 0.5556, 0.0074, 2, 0.47, 0.5, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.empty: return 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Return_L75_C23", "label": "return", "type": "return", "loc": [75, 75], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L75_C8", "vector": [13, 3, 0.5556, 0.0074, 3, 0.65, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.empty: return 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L76_C8", "label": "if", "type": "if", "loc": [76, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L73_C4", "vector": [4, 2, 0.5667, 0.0148, 2, 0.47, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.hasz: return 3\n else: return 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Return_L76_C22", "label": "return", "type": "return", "loc": [76, 76], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L76_C8", "vector": [13, 3, 0.563, 0.0074, 3, 0.56, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.hasz: return 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Return_L77_C14", "label": "return", "type": "return", "loc": [77, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L76_C8", "vector": [13, 3, 0.5704, 0.0074, 3, 0.56, 1.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " else: return 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L79_C4", "label": "_get_single_external", "type": "function", "loc": [79, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "vector": [2, 1, 0.6074, 0.0519, 1, 0.77, 0.3636, 470, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "_get_single_external", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_single_external(self, index):\n if index == 0:\n return self.x\n elif index == 1:\n return self.y\n elif index == 2:\n return self.z"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L80_C8", "label": "if", "type": "if", "loc": [80, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L79_C4", "vector": [4, 2, 0.6111, 0.0444, 2, 0.94, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if index == 0:\n return self.x\n elif index == 1:\n return self.y\n elif index == 2:\n return self.z"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Return_L81_C12", "label": "return", "type": "return", "loc": [81, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L80_C8", "vector": [13, 3, 0.6, 0.0074, 3, 0.61, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L82_C8", "label": "if", "type": "if", "loc": [82, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L80_C8", "vector": [4, 3, 0.6185, 0.0296, 3, 0.61, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif index == 1:\n return self.y\n elif index == 2:\n return self.z"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Return_L83_C12", "label": "return", "type": "return", "loc": [83, 83], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L82_C8", "vector": [13, 4, 0.6148, 0.0074, 4, 0.38, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.y"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L84_C8", "label": "if", "type": "if", "loc": [84, 85], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L82_C8", "vector": [4, 4, 0.6259, 0.0148, 4, 0.38, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif index == 2:\n return self.z"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Return_L85_C12", "label": "return", "type": "return", "loc": [85, 85], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L84_C8", "vector": [13, 5, 0.6296, 0.0074, 5, 0.66, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.z"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L87_C4", "label": "_get_single_internal =", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "vector": [14, 1, 0.6444, 0.0074, 1, 0.77, 0.4091, 98, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_get_single_internal", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _get_single_internal = _get_single_external"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L89_C4", "label": "get_x", "type": "function", "loc": [89, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "vector": [2, 1, 0.6667, 0.0222, 1, 0.77, 0.4545, 146, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_x", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_x(self):\n \"Returns the X component of the Point.\"\n return self._cs.getOrdinate(0, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L90_C8", "label": "expression", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L89_C4", "vector": [8, 2, 0.6667, 0.0074, 2, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the X component of the Point.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Return_L91_C8", "label": "return", "type": "return", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L89_C4", "vector": [13, 2, 0.6741, 0.0074, 2, 0.84, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._cs.getOrdinate(0, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L93_C4", "label": "set_x", "type": "function", "loc": [93, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "vector": [2, 1, 0.6963, 0.0222, 1, 0.77, 0.5, 516, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_x", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_x(self, value):\n \"Sets the X component of the Point.\"\n self._cs.setOrdinate(0, 0, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L94_C8", "label": "expression", "type": "expression", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L93_C4", "vector": [8, 2, 0.6963, 0.0074, 2, 0.82, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Sets the X component of the Point.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L95_C8", "label": "setOrdinate()", "type": "expression", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L93_C4", "vector": [8, 2, 0.7037, 0.0074, 2, 0.82, 1.0, 640, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setOrdinate", "arg_names": [], "import_names": [], "rhs_call_name": "setOrdinate", "annotation": ""}, "snippet": " self._cs.setOrdinate(0, 0, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L97_C4", "label": "get_y", "type": "function", "loc": [97, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "vector": [2, 1, 0.7259, 0.0222, 1, 0.77, 0.5455, 233, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_y", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_y(self):\n \"Returns the Y component of the Point.\"\n return self._cs.getOrdinate(1, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L98_C8", "label": "expression", "type": "expression", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L97_C4", "vector": [8, 2, 0.7259, 0.0074, 2, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the Y component of the Point.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Return_L99_C8", "label": "return", "type": "return", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L97_C4", "vector": [13, 2, 0.7333, 0.0074, 2, 0.57, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._cs.getOrdinate(1, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L101_C4", "label": "set_y", "type": "function", "loc": [101, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "vector": [2, 1, 0.7556, 0.0222, 1, 0.77, 0.5909, 556, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_y", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_y(self, value):\n \"Sets the Y component of the Point.\"\n self._cs.setOrdinate(1, 0, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L102_C8", "label": "expression", "type": "expression", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L101_C4", "vector": [8, 2, 0.7556, 0.0074, 2, 0.16, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Sets the Y component of the Point.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L103_C8", "label": "setOrdinate()", "type": "expression", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L101_C4", "vector": [8, 2, 0.763, 0.0074, 2, 0.16, 1.0, 640, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setOrdinate", "arg_names": [], "import_names": [], "rhs_call_name": "setOrdinate", "annotation": ""}, "snippet": " self._cs.setOrdinate(1, 0, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L105_C4", "label": "get_z", "type": "function", "loc": [105, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "vector": [2, 1, 0.7963, 0.0444, 1, 0.77, 0.6364, 360, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_z", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_z(self):\n \"Returns the Z component of the Point.\"\n if self.hasz:\n return self._cs.getOrdinate(2, 0)\n else:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L106_C8", "label": "expression", "type": "expression", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L105_C4", "vector": [8, 2, 0.7852, 0.0074, 2, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the Z component of the Point.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L107_C8", "label": "if", "type": "if", "loc": [107, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L105_C4", "vector": [4, 2, 0.8037, 0.0296, 2, 0.07, 1.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.hasz:\n return self._cs.getOrdinate(2, 0)\n else:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Return_L108_C12", "label": "return", "type": "return", "loc": [108, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L107_C8", "vector": [13, 3, 0.8, 0.0074, 3, 0.24, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._cs.getOrdinate(2, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Return_L110_C12", "label": "return", "type": "return", "loc": [110, 110], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L107_C8", "vector": [13, 3, 0.8148, 0.0074, 3, 0.24, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L112_C4", "label": "set_z", "type": "function", "loc": [112, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "vector": [2, 1, 0.8481, 0.0444, 1, 0.77, 0.6818, 66, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "set_z", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_z(self, value):\n \"Sets the Z component of the Point.\"\n if self.hasz:\n self._cs.setOrdinate(2, 0, value)\n else:\n raise GEOSException('Cannot set Z on 2D Point.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L113_C8", "label": "expression", "type": "expression", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L112_C4", "vector": [8, 2, 0.837, 0.0074, 2, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Sets the Z component of the Point.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L114_C8", "label": "if", "type": "if", "loc": [114, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L112_C4", "vector": [4, 2, 0.8556, 0.0296, 2, 0.43, 1.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.hasz:\n self._cs.setOrdinate(2, 0, value)\n else:\n raise GEOSException('Cannot set Z on 2D Point.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L115_C12", "label": "setOrdinate()", "type": "expression", "loc": [115, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L114_C8", "vector": [8, 3, 0.8519, 0.0074, 3, 0.89, 0.0, 640, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setOrdinate", "arg_names": [], "import_names": [], "rhs_call_name": "setOrdinate", "annotation": ""}, "snippet": " self._cs.setOrdinate(2, 0, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L120_C4", "label": "x = property()", "type": "assigned_variable", "loc": [120, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "vector": [14, 1, 0.8889, 0.0074, 1, 0.77, 0.7273, 190, 3, 2, 0, 0, 244, 10, 1], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " x = property(get_x, set_x)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L121_C4", "label": "y = property()", "type": "assigned_variable", "loc": [121, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "vector": [14, 1, 0.8963, 0.0074, 1, 0.77, 0.7727, 304, 3, 2, 0, 0, 244, 10, 1], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " y = property(get_y, set_y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L122_C4", "label": "z = property()", "type": "assigned_variable", "loc": [122, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "vector": [14, 1, 0.9037, 0.0074, 1, 0.77, 0.8182, 859, 3, 2, 0, 0, 244, 10, 1], "semantic": {"name": "z", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " z = property(get_z, set_z)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L125_C4", "label": "get_coords", "type": "function", "loc": [125, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "vector": [2, 1, 0.9333, 0.0222, 1, 0.77, 0.8636, 626, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_coords", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_coords(self):\n \"Returns a tuple of the point.\"\n return self._cs.tuple"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L126_C8", "label": "expression", "type": "expression", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L125_C4", "vector": [8, 2, 0.9333, 0.0074, 2, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a tuple of the point.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Return_L127_C8", "label": "return", "type": "return", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L125_C4", "vector": [13, 2, 0.9407, 0.0074, 2, 0.46, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._cs.tuple"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L129_C4", "label": "set_coords", "type": "function", "loc": [129, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "vector": [2, 1, 0.963, 0.0222, 1, 0.77, 0.9091, 448, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "set_coords", "arg_names": ["self", "tup"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_coords(self, tup):\n \"Sets the coordinates of the point with the given tuple.\"\n self._cs[0] = tup"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L130_C8", "label": "expression", "type": "expression", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L129_C4", "vector": [8, 2, 0.963, 0.0074, 2, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Sets the coordinates of the point with the given tuple.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L131_C8", "label": "assign", "type": "assigned_variable", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L129_C4", "vector": [14, 2, 0.9704, 0.0074, 2, 0.49, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._cs[0] = tup"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L134_C4", "label": "tuple = property()", "type": "assigned_variable", "loc": [134, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "vector": [14, 1, 0.9926, 0.0074, 1, 0.77, 0.9545, 259, 3, 2, 0, 0, 244, 10, 1], "semantic": {"name": "tuple", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " tuple = property(get_coords, set_coords)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L135_C4", "label": "coords =", "type": "assigned_variable", "loc": [135, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "vector": [14, 1, 1.0, 0.0074, 1, 0.77, 1.0, 216, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "coords", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " coords = tuple"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L19_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L21_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L19_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L22_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L19_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L23_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L25_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L25_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L26_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L25_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L27_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L25_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L29_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L25_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L30_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L51_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L51_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Return_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L58_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L60_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L65_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:For_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:For_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L71_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L75_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Return_L75_C23"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L76_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Return_L76_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L76_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Return_L77_C14"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L80_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Return_L81_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L80_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Return_L83_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L84_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Return_L85_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Return_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Return_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L107_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Return_L108_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L107_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Return_L110_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:If_L114_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L115_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L122_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L125_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L126_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L125_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Return_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Expr_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L135_C4"}] |
"""
The GeoDjango GEOS module. Please consult the GeoDjango documentation
for more details:
http://geodjango.org/docs/geos.html
"""
from django.contrib.gis.geos.geometry import GEOSGeometry, wkt_regex, hex_regex
from django.contrib.gis.geos.point import Point
from django.contrib.gis.geos.linestring import LineString, LinearRing
from django.contrib.gis.geos.polygon import Polygon
from django.contrib.gis.geos.collections import GeometryCollection, MultiPoint, MultiLineString, MultiPolygon
from django.contrib.gis.geos.error import GEOSException, GEOSIndexError
from django.contrib.gis.geos.io import WKTReader, WKTWriter, WKBReader, WKBWriter
from django.contrib.gis.geos.factory import fromfile, fromstr
from django.contrib.gis.geos.libgeos import geos_version, geos_version_info, GEOS_PREPARE
| ajibawa-2023/Python-Code-Large/train/row_98742 | 10 | 14 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98742:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.2143, 0.3571, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThe GeoDjango GEOS module. Please consult the GeoDjango documentation\nfor more details: \n http://geodjango.org/docs/geos.html\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98742:ImportFrom_L6_C0", "label": "from django.contrib.gis.geos.geometry import GEOSGeometry, wkt_regex, hex_regex", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.4286, 0.0714, 0, 0.66, 0.1111, 843, 0, 3, 0, 0, 843, 0, 0], "semantic": {"name": "django.contrib.gis.geos.geometry", "arg_names": [], "import_names": ["GEOSGeometry", "wkt_regex", "hex_regex"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.geometry import GEOSGeometry, wkt_regex, hex_regex"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98742:ImportFrom_L7_C0", "label": "from django.contrib.gis.geos.point import Point", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.0714, 0, 0.66, 0.2222, 711, 0, 1, 0, 0, 711, 0, 0], "semantic": {"name": "django.contrib.gis.geos.point", "arg_names": [], "import_names": ["Point"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.point import Point"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98742:ImportFrom_L8_C0", "label": "from django.contrib.gis.geos.linestring import LineString, LinearRing", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.5714, 0.0714, 0, 0.66, 0.3333, 662, 0, 2, 0, 0, 662, 0, 0], "semantic": {"name": "django.contrib.gis.geos.linestring", "arg_names": [], "import_names": ["LineString", "LinearRing"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.linestring import LineString, LinearRing"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98742:ImportFrom_L9_C0", "label": "from django.contrib.gis.geos.polygon import Polygon", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.6429, 0.0714, 0, 0.66, 0.4444, 745, 0, 1, 0, 0, 745, 0, 0], "semantic": {"name": "django.contrib.gis.geos.polygon", "arg_names": [], "import_names": ["Polygon"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.polygon import Polygon"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98742:ImportFrom_L10_C0", "label": "from django.contrib.gis.geos.collections import GeometryCollection, MultiPoint, MultiLineString\u2026", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.7143, 0.0714, 0, 0.66, 0.5556, 54, 0, 4, 0, 0, 54, 0, 0], "semantic": {"name": "django.contrib.gis.geos.collections", "arg_names": [], "import_names": ["GeometryCollection", "MultiPoint", "MultiLineString", "MultiPolygon"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.collections import GeometryCollection, MultiPoint, MultiLineString, MultiPolygon"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98742:ImportFrom_L11_C0", "label": "from django.contrib.gis.geos.error import GEOSException, GEOSIndexError", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.7857, 0.0714, 0, 0.66, 0.6667, 827, 0, 2, 0, 0, 827, 0, 0], "semantic": {"name": "django.contrib.gis.geos.error", "arg_names": [], "import_names": ["GEOSException", "GEOSIndexError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.error import GEOSException, GEOSIndexError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98742:ImportFrom_L12_C0", "label": "from django.contrib.gis.geos.io import WKTReader, WKTWriter, WKBReader\u2026", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.8571, 0.0714, 0, 0.66, 0.7778, 946, 0, 4, 0, 0, 946, 0, 0], "semantic": {"name": "django.contrib.gis.geos.io", "arg_names": [], "import_names": ["WKTReader", "WKTWriter", "WKBReader", "WKBWriter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.io import WKTReader, WKTWriter, WKBReader, WKBWriter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98742:ImportFrom_L13_C0", "label": "from django.contrib.gis.geos.factory import fromfile, fromstr", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.9286, 0.0714, 0, 0.66, 0.8889, 454, 0, 2, 0, 0, 454, 0, 0], "semantic": {"name": "django.contrib.gis.geos.factory", "arg_names": [], "import_names": ["fromfile", "fromstr"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.factory import fromfile, fromstr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98742:ImportFrom_L14_C0", "label": "from django.contrib.gis.geos.libgeos import geos_version, geos_version_info, GEOS_PREPARE", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 1.0, 0.0714, 0, 0.66, 1.0, 64, 0, 3, 0, 0, 64, 0, 0], "semantic": {"name": "django.contrib.gis.geos.libgeos", "arg_names": [], "import_names": ["geos_version", "geos_version_info", "GEOS_PREPARE"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.libgeos import geos_version, geos_version_info, GEOS_PREPARE"}] | [] |
from django.contrib.gis.geos.geometry import GEOSGeometry, wkt_regex, hex_regex
def fromfile(file_h):
"""
Given a string file name, returns a GEOSGeometry. The file may contain WKB,
WKT, or HEX.
"""
# If given a file name, get a real handle.
if isinstance(file_h, basestring):
file_h = open(file_h, 'rb')
# Reading in the file's contents,
buf = file_h.read()
# If we get WKB need to wrap in buffer(), so run through regexes.
if wkt_regex.match(buf) or hex_regex.match(buf):
return GEOSGeometry(buf)
else:
return GEOSGeometry(buffer(buf))
def fromstr(string, **kwargs):
"Given a string value, returns a GEOSGeometry object."
return GEOSGeometry(string, **kwargs)
| ajibawa-2023/Python-Code-Large/train/row_98743 | 12 | 23 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98743:ImportFrom_L1_C0", "label": "from django.contrib.gis.geos.geometry import GEOSGeometry, wkt_regex, hex_regex", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0435, 0.0435, 0, 0.66, 0.0, 843, 0, 3, 0, 0, 843, 0, 0], "semantic": {"name": "django.contrib.gis.geos.geometry", "arg_names": [], "import_names": ["GEOSGeometry", "wkt_regex", "hex_regex"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos.geometry import GEOSGeometry, wkt_regex, hex_regex"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98743:FunctionDef_L3_C0", "label": "fromfile", "type": "function", "loc": [3, 19], "level": 0, "parent": null, "vector": [2, 0, 0.4783, 0.7391, 0, 0.66, 0.5, 768, 0, 1, 1, 0, 0, 0, 8], "semantic": {"name": "fromfile", "arg_names": ["file_h"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def fromfile(file_h):\n \"\"\"\n Given a string file name, returns a GEOSGeometry. The file may contain WKB,\n WKT, or HEX.\n \"\"\"\n # If given a file name, get a real handle.\n if isinstance(file_h, basestring): \n file_h = open(file_h, 'rb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98743:Expr_L4_C4", "label": "expression", "type": "expression", "loc": [4, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98743:FunctionDef_L3_C0", "vector": [8, 1, 0.2391, 0.1739, 1, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Given a string file name, returns a GEOSGeometry. The file may contain WKB,\n WKT, or HEX.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98743:If_L9_C4", "label": "if", "type": "if", "loc": [9, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98743:FunctionDef_L3_C0", "vector": [4, 1, 0.413, 0.087, 1, 0.75, 0.3333, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(file_h, basestring): \n file_h = open(file_h, 'rb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98743:Assign_L10_C8", "label": "file_h = open()", "type": "assigned_variable", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98743:If_L9_C4", "vector": [14, 2, 0.4348, 0.0435, 2, 0.13, 0.0, 956, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "file_h", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " file_h = open(file_h, 'rb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98743:Assign_L13_C4", "label": "buf = read()", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98743:FunctionDef_L3_C0", "vector": [14, 1, 0.5652, 0.0435, 1, 0.75, 0.6667, 840, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "buf", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " buf = file_h.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98743:If_L16_C4", "label": "if", "type": "if", "loc": [16, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98743:FunctionDef_L3_C0", "vector": [4, 1, 0.7609, 0.1739, 1, 0.75, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if wkt_regex.match(buf) or hex_regex.match(buf):\n return GEOSGeometry(buf)\n else:\n return GEOSGeometry(buffer(buf))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98743:Return_L17_C8", "label": "return", "type": "return", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98743:If_L16_C4", "vector": [13, 2, 0.7391, 0.0435, 2, 0.75, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return GEOSGeometry(buf)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98743:Return_L19_C8", "label": "return", "type": "return", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98743:If_L16_C4", "vector": [13, 2, 0.8261, 0.0435, 2, 0.75, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return GEOSGeometry(buffer(buf))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98743:FunctionDef_L21_C0", "label": "fromstr", "type": "function", "loc": [21, 23], "level": 0, "parent": null, "vector": [2, 0, 0.9565, 0.1304, 0, 0.66, 1.0, 946, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "fromstr", "arg_names": ["string", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def fromstr(string, **kwargs):\n \"Given a string value, returns a GEOSGeometry object.\"\n return GEOSGeometry(string, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98743:Expr_L22_C4", "label": "expression", "type": "expression", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98743:FunctionDef_L21_C0", "vector": [8, 1, 0.9565, 0.0435, 1, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Given a string value, returns a GEOSGeometry object.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98743:Return_L23_C4", "label": "return", "type": "return", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98743:FunctionDef_L21_C0", "vector": [13, 1, 1.0, 0.0435, 1, 0.46, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return GEOSGeometry(string, **kwargs)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98743:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98743:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98743:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98743:If_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98743:If_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98743:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98743:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98743:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98743:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98743:If_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98743:If_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98743:Return_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98743:If_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98743:Return_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98743:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98743:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98743:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98743:Return_L23_C4"}] |
from optparse import make_option
from django.core.management.base import CommandError
from django.core.management.commands.inspectdb import Command as InspectDBCommand
class Command(InspectDBCommand):
db_module = 'django.contrib.gis.db'
gis_tables = {}
def get_field_type(self, connection, table_name, row):
field_type, field_params, field_notes = super(Command, self).get_field_type(connection, table_name, row)
if field_type == 'GeometryField':
geo_col = row[0]
# Getting a more specific field type and any additional parameters
# from the `get_geometry_type` routine for the spatial backend.
field_type, geo_params = connection.introspection.get_geometry_type(table_name, geo_col)
field_params.update(geo_params)
# Adding the table name and column to the `gis_tables` dictionary, this
# allows us to track which tables need a GeoManager.
if table_name in self.gis_tables:
self.gis_tables[table_name].append(geo_col)
else:
self.gis_tables[table_name] = [geo_col]
return field_type, field_params, field_notes
def get_meta(self, table_name):
meta_lines = super(Command, self).get_meta(table_name)
if table_name in self.gis_tables:
# If the table is a geographic one, then we need make
# GeoManager the default manager for the model.
meta_lines.insert(0, ' objects = models.GeoManager()')
return meta_lines
| ajibawa-2023/Python-Code-Large/train/row_98744 | 21 | 32 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98744:ImportFrom_L1_C0", "label": "from optparse import make_option", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0312, 0.0312, 0, 0.66, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["make_option"], "rhs_call_name": "", "annotation": ""}, "snippet": "from optparse import make_option"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98744:ImportFrom_L3_C0", "label": "from django.core.management.base import CommandError", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0938, 0.0312, 0, 0.66, 0.3333, 931, 0, 1, 0, 0, 931, 0, 0], "semantic": {"name": "django.core.management.base", "arg_names": [], "import_names": ["CommandError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.management.base import CommandError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98744:ImportFrom_L4_C0", "label": "from django.core.management.commands.inspectdb import InspectDBCommand", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.0312, 0, 0.66, 0.6667, 296, 0, 1, 0, 0, 296, 0, 0], "semantic": {"name": "django.core.management.commands.inspectdb", "arg_names": [], "import_names": ["InspectDBCommand"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.management.commands.inspectdb import Command as InspectDBCommand"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98744:ClassDef_L6_C0", "label": "Command", "type": "class", "loc": [6, 32], "level": 0, "parent": null, "vector": [3, 0, 0.5938, 0.8438, 0, 0.66, 1.0, 73, 0, 2, 0, 0, 559, 0, 8], "semantic": {"name": "Command", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Command(InspectDBCommand):\n db_module = 'django.contrib.gis.db'\n gis_tables = {}\n\n def get_field_type(self, connection, table_name, row):\n field_type, field_params, field_notes = super(Command, self).get_field_type(connection, table_name, row)\n if field_type == 'GeometryField':\n geo_col = row[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98744:Assign_L7_C4", "label": "db_module =", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98744:ClassDef_L6_C0", "vector": [14, 1, 0.2188, 0.0312, 1, 0.44, 0.0, 406, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "db_module", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " db_module = 'django.contrib.gis.db'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98744:Assign_L8_C4", "label": "gis_tables =", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98744:ClassDef_L6_C0", "vector": [14, 1, 0.25, 0.0312, 1, 0.44, 0.3333, 623, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "gis_tables", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " gis_tables = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98744:FunctionDef_L10_C4", "label": "get_field_type", "type": "function", "loc": [10, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98744:ClassDef_L6_C0", "vector": [2, 1, 0.5312, 0.4688, 1, 0.44, 0.6667, 691, 0, 4, 1, 0, 0, 0, 5], "semantic": {"name": "get_field_type", "arg_names": ["self", "connection", "table_name", "row"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_field_type(self, connection, table_name, row):\n field_type, field_params, field_notes = super(Command, self).get_field_type(connection, table_name, row)\n if field_type == 'GeometryField':\n geo_col = row[0]\n # Getting a more specific field type and any additional parameters\n # from the `get_geometry_type` routine for the spatial backend.\n field_type, geo_params = connection.introspection.get_geometry_type(table_name, geo_col)\n field_params.update(geo_params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98744:Assign_L11_C8", "label": "field_type, field_params, field_notes = get_field_type()", "type": "assigned_variable", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98744:FunctionDef_L10_C4", "vector": [14, 2, 0.3438, 0.0312, 2, 0.4, 0.0, 31, 3, 3, 0, 0, 691, 10, 2], "semantic": {"name": "field_type, field_params, field_notes", "arg_names": [], "import_names": [], "rhs_call_name": "get_field_type", "annotation": ""}, "snippet": " field_type, field_params, field_notes = super(Command, self).get_field_type(connection, table_name, row)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98744:If_L12_C8", "label": "if", "type": "if", "loc": [12, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98744:FunctionDef_L10_C4", "vector": [4, 2, 0.5469, 0.375, 2, 0.4, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if field_type == 'GeometryField':\n geo_col = row[0]\n # Getting a more specific field type and any additional parameters\n # from the `get_geometry_type` routine for the spatial backend.\n field_type, geo_params = connection.introspection.get_geometry_type(table_name, geo_col)\n field_params.update(geo_params)\n # Adding the table name and column to the `gis_tables` dictionary, this\n # allows us to track which tables need a GeoManager."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98744:Assign_L13_C12", "label": "geo_col =", "type": "assigned_variable", "loc": [13, 13], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98744:If_L12_C8", "vector": [14, 3, 0.4062, 0.0312, 3, 0.97, 0.0, 139, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geo_col", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geo_col = row[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98744:Assign_L16_C12", "label": "field_type, geo_params = get_geometry_type()", "type": "assigned_variable", "loc": [16, 16], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98744:If_L12_C8", "vector": [14, 3, 0.5, 0.0312, 3, 0.97, 0.3333, 672, 3, 2, 0, 0, 844, 10, 1], "semantic": {"name": "field_type, geo_params", "arg_names": [], "import_names": [], "rhs_call_name": "get_geometry_type", "annotation": ""}, "snippet": " field_type, geo_params = connection.introspection.get_geometry_type(table_name, geo_col)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98744:Expr_L17_C12", "label": "update()", "type": "expression", "loc": [17, 17], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98744:If_L12_C8", "vector": [8, 3, 0.5312, 0.0312, 3, 0.97, 0.6667, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " field_params.update(geo_params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98744:If_L20_C12", "label": "if", "type": "if", "loc": [20, 23], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98744:If_L12_C8", "vector": [4, 3, 0.6719, 0.125, 3, 0.97, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if table_name in self.gis_tables:\n self.gis_tables[table_name].append(geo_col)\n else:\n self.gis_tables[table_name] = [geo_col]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98744:Expr_L21_C16", "label": "append()", "type": "expression", "loc": [21, 21], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98744:If_L20_C12", "vector": [8, 4, 0.6562, 0.0312, 4, 0.5, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.gis_tables[table_name].append(geo_col)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98744:Assign_L23_C16", "label": "assign", "type": "assigned_variable", "loc": [23, 23], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98744:If_L20_C12", "vector": [14, 4, 0.7188, 0.0312, 4, 0.5, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.gis_tables[table_name] = [geo_col]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98744:Return_L24_C8", "label": "return", "type": "return", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98744:FunctionDef_L10_C4", "vector": [13, 2, 0.75, 0.0312, 2, 0.4, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return field_type, field_params, field_notes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98744:FunctionDef_L26_C4", "label": "get_meta", "type": "function", "loc": [26, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98744:ClassDef_L6_C0", "vector": [2, 1, 0.9062, 0.2188, 1, 0.44, 1.0, 671, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "get_meta", "arg_names": ["self", "table_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_meta(self, table_name):\n meta_lines = super(Command, self).get_meta(table_name)\n if table_name in self.gis_tables:\n # If the table is a geographic one, then we need make\n # GeoManager the default manager for the model.\n meta_lines.insert(0, ' objects = models.GeoManager()')\n return meta_lines"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98744:Assign_L27_C8", "label": "meta_lines = get_meta()", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98744:FunctionDef_L26_C4", "vector": [14, 2, 0.8438, 0.0312, 2, 0.76, 0.0, 250, 3, 1, 0, 0, 671, 10, 2], "semantic": {"name": "meta_lines", "arg_names": [], "import_names": [], "rhs_call_name": "get_meta", "annotation": ""}, "snippet": " meta_lines = super(Command, self).get_meta(table_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98744:If_L28_C8", "label": "if", "type": "if", "loc": [28, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98744:FunctionDef_L26_C4", "vector": [4, 2, 0.9219, 0.125, 2, 0.76, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if table_name in self.gis_tables:\n # If the table is a geographic one, then we need make\n # GeoManager the default manager for the model.\n meta_lines.insert(0, ' objects = models.GeoManager()')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98744:Expr_L31_C12", "label": "insert()", "type": "expression", "loc": [31, 31], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98744:If_L28_C8", "vector": [8, 3, 0.9688, 0.0312, 3, 0.89, 0.0, 368, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " meta_lines.insert(0, ' objects = models.GeoManager()')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98744:Return_L32_C8", "label": "return", "type": "return", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98744:FunctionDef_L26_C4", "vector": [13, 2, 1.0, 0.0312, 2, 0.76, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return meta_lines"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98744:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98744:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98744:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98744:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98744:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98744:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98744:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98744:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98744:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98744:If_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98744:If_L12_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98744:Assign_L13_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98744:If_L12_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98744:Assign_L16_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98744:If_L12_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98744:Expr_L17_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98744:If_L12_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98744:If_L20_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98744:If_L20_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98744:Expr_L21_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98744:If_L20_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98744:Assign_L23_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98744:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98744:Return_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98744:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98744:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98744:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98744:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98744:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98744:If_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98744:If_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98744:Expr_L31_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98744:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98744:Return_L32_C8"}] |
from django.core.management.base import BaseCommand, CommandError
class ArgsCommand(BaseCommand):
"""
Command class for commands that take multiple arguments.
"""
args = '<arg arg ...>'
def handle(self, *args, **options):
if not args:
raise CommandError('Must provide the following arguments: %s' % self.args)
return self.handle_args(*args, **options)
def handle_args(self, *args, **options):
raise NotImplementedError()
| ajibawa-2023/Python-Code-Large/train/row_98746 | 8 | 15 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98746:ImportFrom_L1_C0", "label": "from django.core.management.base import BaseCommand, CommandError", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0667, 0.0667, 0, 0.66, 0.0, 931, 0, 2, 0, 0, 931, 0, 0], "semantic": {"name": "django.core.management.base", "arg_names": [], "import_names": ["BaseCommand", "CommandError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.management.base import BaseCommand, CommandError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98746:ClassDef_L3_C0", "label": "ArgsCommand", "type": "class", "loc": [3, 15], "level": 0, "parent": null, "vector": [3, 0, 0.6, 0.8667, 0, 0.66, 1.0, 116, 0, 2, 0, 0, 564, 0, 3], "semantic": {"name": "ArgsCommand", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ArgsCommand(BaseCommand):\n \"\"\"\n Command class for commands that take multiple arguments.\n \"\"\"\n args = '<arg arg ...>'\n\n def handle(self, *args, **options):\n if not args:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98746:Expr_L4_C4", "label": "expression", "type": "expression", "loc": [4, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98746:ClassDef_L3_C0", "vector": [8, 1, 0.3333, 0.2, 1, 0.42, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Command class for commands that take multiple arguments.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98746:Assign_L7_C4", "label": "args =", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98746:ClassDef_L3_C0", "vector": [14, 1, 0.4667, 0.0667, 1, 0.42, 0.3333, 805, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = '<arg arg ...>'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98746:FunctionDef_L9_C4", "label": "handle", "type": "function", "loc": [9, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98746:ClassDef_L3_C0", "vector": [2, 1, 0.7, 0.2667, 1, 0.42, 0.6667, 346, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "handle", "arg_names": ["self", "args", "options"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle(self, *args, **options):\n if not args:\n raise CommandError('Must provide the following arguments: %s' % self.args)\n return self.handle_args(*args, **options)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98746:If_L10_C8", "label": "if", "type": "if", "loc": [10, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98746:FunctionDef_L9_C4", "vector": [4, 2, 0.7, 0.1333, 2, 0.7, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not args:\n raise CommandError('Must provide the following arguments: %s' % self.args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98746:Return_L12_C8", "label": "return", "type": "return", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98746:FunctionDef_L9_C4", "vector": [13, 2, 0.8, 0.0667, 2, 0.7, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.handle_args(*args, **options)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98746:FunctionDef_L14_C4", "label": "handle_args", "type": "function", "loc": [14, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98746:ClassDef_L3_C0", "vector": [2, 1, 0.9667, 0.1333, 1, 0.42, 1.0, 165, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "handle_args", "arg_names": ["self", "args", "options"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_args(self, *args, **options):\n raise NotImplementedError()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98746:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98746:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98746:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98746:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98746:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98746:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98746:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98746:If_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98746:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98746:Return_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98746:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98746:FunctionDef_L14_C4"}] |
from django import forms
from django.utils.translation import ugettext_lazy as _
# While this couples the geographic forms to the GEOS library,
# it decouples from database (by not importing SpatialBackend).
from django.contrib.gis.geos import GEOSGeometry
class GeometryField(forms.Field):
"""
This is the basic form field for a Geometry. Any textual input that is
accepted by GEOSGeometry is accepted by this form. By default,
this includes WKT, HEXEWKB, WKB (in a buffer), and GeoJSON.
"""
widget = forms.Textarea
default_error_messages = {
'no_geom' : _(u'No geometry value provided.'),
'invalid_geom' : _(u'Invalid geometry value.'),
'invalid_geom_type' : _(u'Invalid geometry type.'),
'transform_error' : _(u'An error occurred when transforming the geometry '
'to the SRID of the geometry form field.'),
}
def __init__(self, **kwargs):
# Pop out attributes from the database field, or use sensible
# defaults (e.g., allow None).
self.srid = kwargs.pop('srid', None)
self.geom_type = kwargs.pop('geom_type', 'GEOMETRY')
self.null = kwargs.pop('null', True)
super(GeometryField, self).__init__(**kwargs)
def clean(self, value):
"""
Validates that the input value can be converted to a Geometry
object (which is returned). A ValidationError is raised if
the value cannot be instantiated as a Geometry.
"""
if not value:
if self.null and not self.required:
# The geometry column allows NULL and is not required.
return None
else:
raise forms.ValidationError(self.error_messages['no_geom'])
# Trying to create a Geometry object from the form value.
try:
geom = GEOSGeometry(value)
except:
raise forms.ValidationError(self.error_messages['invalid_geom'])
# Ensuring that the geometry is of the correct type (indicated
# using the OGC string label).
if str(geom.geom_type).upper() != self.geom_type and not self.geom_type == 'GEOMETRY':
raise forms.ValidationError(self.error_messages['invalid_geom_type'])
# Transforming the geometry if the SRID was set.
if self.srid:
if not geom.srid:
# Should match that of the field if not given.
geom.srid = self.srid
elif self.srid != -1 and self.srid != geom.srid:
try:
geom.transform(self.srid)
except:
raise forms.ValidationError(self.error_messages['transform_error'])
return geom
| ajibawa-2023/Python-Code-Large/train/row_98747 | 27 | 67 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98747:ImportFrom_L1_C0", "label": "from django import forms", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0149, 0.0149, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["forms"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django import forms"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:ImportFrom_L2_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0299, 0.0149, 0, 0.66, 0.3333, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names": [], "import_names": ["_"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.translation import ugettext_lazy as _"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:ImportFrom_L6_C0", "label": "from django.contrib.gis.geos import GEOSGeometry", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0896, 0.0149, 0, 0.66, 0.6667, 886, 0, 1, 0, 0, 886, 0, 0], "semantic": {"name": "django.contrib.gis.geos", "arg_names": [], "import_names": ["GEOSGeometry"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geos import GEOSGeometry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:ClassDef_L8_C0", "label": "GeometryField", "type": "class", "loc": [8, 67], "level": 0, "parent": null, "vector": [3, 0, 0.5597, 0.8955, 0, 0.66, 1.0, 100, 0, 2, 0, 0, 320, 0, 17], "semantic": {"name": "GeometryField", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GeometryField(forms.Field):\n \"\"\"\n This is the basic form field for a Geometry. Any textual input that is\n accepted by GEOSGeometry is accepted by this form. By default,\n this includes WKT, HEXEWKB, WKB (in a buffer), and GeoJSON.\n \"\"\"\n widget = forms.Textarea\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:Expr_L9_C4", "label": "expression", "type": "expression", "loc": [9, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98747:ClassDef_L8_C0", "vector": [8, 1, 0.1642, 0.0746, 1, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n This is the basic form field for a Geometry. Any textual input that is\n accepted by GEOSGeometry is accepted by this form. By default,\n this includes WKT, HEXEWKB, WKB (in a buffer), and GeoJSON.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:Assign_L14_C4", "label": "widget =", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98747:ClassDef_L8_C0", "vector": [14, 1, 0.209, 0.0149, 1, 0.05, 0.25, 972, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "widget", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " widget = forms.Textarea"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:Assign_L16_C4", "label": "default_error_messages =", "type": "assigned_variable", "loc": [16, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98747:ClassDef_L8_C0", "vector": [14, 1, 0.2836, 0.1045, 1, 0.05, 0.5, 166, 0, 0, 0, 0, 0, 6, 4], "semantic": {"name": "default_error_messages", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " default_error_messages = {\n 'no_geom' : _(u'No geometry value provided.'),\n 'invalid_geom' : _(u'Invalid geometry value.'),\n 'invalid_geom_type' : _(u'Invalid geometry type.'),\n 'transform_error' : _(u'An error occurred when transforming the geometry '\n 'to the SRID of the geometry form field.'),\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:FunctionDef_L24_C4", "label": "__init__", "type": "function", "loc": [24, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98747:ClassDef_L8_C0", "vector": [2, 1, 0.403, 0.1045, 1, 0.05, 0.75, 555, 0, 2, 0, 0, 0, 0, 5], "semantic": {"name": "__init__", "arg_names": ["self", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, **kwargs):\n # Pop out attributes from the database field, or use sensible\n # defaults (e.g., allow None).\n self.srid = kwargs.pop('srid', None)\n self.geom_type = kwargs.pop('geom_type', 'GEOMETRY')\n self.null = kwargs.pop('null', True)\n super(GeometryField, self).__init__(**kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:Assign_L27_C8", "label": "self.srid = pop()", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98747:FunctionDef_L24_C4", "vector": [14, 2, 0.403, 0.0149, 2, 0.51, 0.0, 289, 3, 2, 0, 0, 969, 10, 1], "semantic": {"name": "self.srid", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " self.srid = kwargs.pop('srid', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:Assign_L28_C8", "label": "self.geom_type = pop()", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98747:FunctionDef_L24_C4", "vector": [14, 2, 0.4179, 0.0149, 2, 0.51, 0.3333, 326, 3, 2, 0, 0, 969, 10, 1], "semantic": {"name": "self.geom_type", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " self.geom_type = kwargs.pop('geom_type', 'GEOMETRY')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:Assign_L29_C8", "label": "self.null = pop()", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98747:FunctionDef_L24_C4", "vector": [14, 2, 0.4328, 0.0149, 2, 0.51, 0.6667, 67, 3, 2, 0, 0, 969, 10, 1], "semantic": {"name": "self.null", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " self.null = kwargs.pop('null', True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:Expr_L30_C8", "label": "__init__()", "type": "expression", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98747:FunctionDef_L24_C4", "vector": [8, 2, 0.4478, 0.0149, 2, 0.51, 1.0, 555, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(GeometryField, self).__init__(**kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:FunctionDef_L32_C4", "label": "clean", "type": "function", "loc": [32, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98747:ClassDef_L8_C0", "vector": [2, 1, 0.7388, 0.5373, 1, 0.05, 1.0, 517, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "clean", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clean(self, value):\n \"\"\"\n Validates that the input value can be converted to a Geometry\n object (which is returned). A ValidationError is raised if\n the value cannot be instantiated as a Geometry.\n \"\"\"\n if not value:\n if self.null and not self.required:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:Expr_L33_C8", "label": "expression", "type": "expression", "loc": [33, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98747:FunctionDef_L32_C4", "vector": [8, 2, 0.5224, 0.0746, 2, 0.4, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Validates that the input value can be converted to a Geometry\n object (which is returned). A ValidationError is raised if\n the value cannot be instantiated as a Geometry.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:If_L38_C8", "label": "if", "type": "if", "loc": [38, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98747:FunctionDef_L32_C4", "vector": [4, 2, 0.6045, 0.0896, 2, 0.4, 0.2, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not value:\n if self.null and not self.required:\n # The geometry column allows NULL and is not required.\n return None\n else:\n raise forms.ValidationError(self.error_messages['no_geom'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:If_L39_C12", "label": "if", "type": "if", "loc": [39, 43], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98747:If_L38_C8", "vector": [4, 3, 0.6119, 0.0746, 3, 0.32, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.null and not self.required:\n # The geometry column allows NULL and is not required.\n return None\n else:\n raise forms.ValidationError(self.error_messages['no_geom'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:Return_L41_C16", "label": "return", "type": "return", "loc": [41, 41], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98747:If_L39_C12", "vector": [13, 4, 0.6119, 0.0149, 4, 0.02, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:Try_L46_C8", "label": "try", "type": "try", "loc": [46, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98747:FunctionDef_L32_C4", "vector": [7, 2, 0.709, 0.0597, 2, 0.4, 0.4, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n geom = GEOSGeometry(value)\n except:\n raise forms.ValidationError(self.error_messages['invalid_geom'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:Assign_L47_C12", "label": "geom = GEOSGeometry()", "type": "assigned_variable", "loc": [47, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98747:Try_L46_C8", "vector": [14, 3, 0.7015, 0.0149, 3, 0.23, 0.0, 5, 3, 1, 0, 0, 958, 10, 1], "semantic": {"name": "geom", "arg_names": [], "import_names": [], "rhs_call_name": "GEOSGeometry", "annotation": ""}, "snippet": " geom = GEOSGeometry(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:If_L53_C8", "label": "if", "type": "if", "loc": [53, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98747:FunctionDef_L32_C4", "vector": [4, 2, 0.7985, 0.0299, 2, 0.4, 0.6, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if str(geom.geom_type).upper() != self.geom_type and not self.geom_type == 'GEOMETRY':\n raise forms.ValidationError(self.error_messages['invalid_geom_type'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:If_L57_C8", "label": "if", "type": "if", "loc": [57, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98747:FunctionDef_L32_C4", "vector": [4, 2, 0.9104, 0.1343, 2, 0.4, 0.8, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.srid:\n if not geom.srid:\n # Should match that of the field if not given.\n geom.srid = self.srid\n elif self.srid != -1 and self.srid != geom.srid:\n try:\n geom.transform(self.srid)\n except:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:If_L58_C12", "label": "if", "type": "if", "loc": [58, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98747:If_L57_C8", "vector": [4, 3, 0.9179, 0.1194, 3, 0.53, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not geom.srid:\n # Should match that of the field if not given.\n geom.srid = self.srid\n elif self.srid != -1 and self.srid != geom.srid:\n try:\n geom.transform(self.srid)\n except:\n raise forms.ValidationError(self.error_messages['transform_error'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:Assign_L60_C16", "label": "geom.srid =", "type": "assigned_variable", "loc": [60, 60], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98747:If_L58_C12", "vector": [14, 4, 0.8955, 0.0149, 4, 0.6, 0.0, 479, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geom.srid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geom.srid = self.srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:If_L61_C12", "label": "if", "type": "if", "loc": [61, 65], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98747:If_L58_C12", "vector": [4, 4, 0.9403, 0.0746, 4, 0.6, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self.srid != -1 and self.srid != geom.srid:\n try:\n geom.transform(self.srid)\n except:\n raise forms.ValidationError(self.error_messages['transform_error'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:Try_L62_C16", "label": "try", "type": "try", "loc": [62, 65], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98747:If_L61_C12", "vector": [7, 5, 0.9478, 0.0597, 5, 0.05, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n geom.transform(self.srid)\n except:\n raise forms.ValidationError(self.error_messages['transform_error'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:Expr_L63_C20", "label": "transform()", "type": "expression", "loc": [63, 63], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98747:Try_L62_C16", "vector": [8, 6, 0.9403, 0.0149, 6, 0.19, 0.0, 48, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "transform", "arg_names": [], "import_names": [], "rhs_call_name": "transform", "annotation": ""}, "snippet": " geom.transform(self.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98747:Return_L67_C8", "label": "return", "type": "return", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98747:FunctionDef_L32_C4", "vector": [13, 2, 1.0, 0.0149, 2, 0.4, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return geom"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98747:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98747:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98747:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98747:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98747:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98747:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98747:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98747:FunctionDef_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98747:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98747:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98747:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98747:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98747:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98747:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98747:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98747:Expr_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98747:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98747:FunctionDef_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98747:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98747:Expr_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98747:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98747:If_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98747:If_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98747:If_L39_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98747:If_L39_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98747:Return_L41_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98747:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98747:Try_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98747:Try_L46_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98747:Assign_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98747:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98747:If_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98747:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98747:If_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98747:If_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98747:If_L58_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98747:If_L58_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98747:Assign_L60_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98747:If_L58_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98747:If_L61_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98747:If_L61_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98747:Try_L62_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98747:Try_L62_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98747:Expr_L63_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98747:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98747:Return_L67_C8"}] |
from django.forms import *
from django.contrib.gis.forms.fields import GeometryField
| ajibawa-2023/Python-Code-Large/train/row_98748 | 2 | 2 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98748:ImportFrom_L1_C0", "label": "from django.forms import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.5, 0, 0.66, 0.0, 666, 0, 1, 0, 0, 666, 0, 0], "semantic": {"name": "django.forms", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.forms import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98748:ImportFrom_L2_C0", "label": "from django.contrib.gis.forms.fields import GeometryField", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 1.0, 0.5, 0, 0.66, 1.0, 391, 0, 1, 0, 0, 391, 0, 0], "semantic": {"name": "django.contrib.gis.forms.fields", "arg_names": [], "import_names": ["GeometryField"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.forms.fields import GeometryField"}] | [] |
from django.db import connection
if hasattr(connection.ops, 'spatial_version'):
from warnings import warn
warn('The `django.contrib.gis.db.backend` module was refactored and '
'renamed to `django.contrib.gis.db.backends` in 1.2. '
'All functionality of `SpatialBackend` '
'has been moved to the `ops` attribute of the spatial database '
'backend. A `SpatialBackend` alias is provided here for '
'backwards-compatibility, but will be removed in 1.3.')
SpatialBackend = connection.ops
| ajibawa-2023/Python-Code-Large/train/row_98749 | 5 | 11 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98749:ImportFrom_L1_C0", "label": "from django.db import connection", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0909, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["connection"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db import connection"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98749:If_L3_C0", "label": "if", "type": "if", "loc": [3, 11], "level": 0, "parent": null, "vector": [4, 0, 0.6364, 0.8182, 0, 0.66, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if hasattr(connection.ops, 'spatial_version'):\n from warnings import warn\n warn('The `django.contrib.gis.db.backend` module was refactored and '\n 'renamed to `django.contrib.gis.db.backends` in 1.2. '\n 'All functionality of `SpatialBackend` '\n 'has been moved to the `ops` attribute of the spatial database '\n 'backend. A `SpatialBackend` alias is provided here for '\n 'backwards-compatibility, but will be removed in 1.3.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98749:ImportFrom_L4_C4", "label": "from warnings import warn", "type": "import", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98749:If_L3_C0", "vector": [1, 1, 0.3636, 0.0909, 1, 0.91, 0.0, 358, 0, 1, 0, 0, 358, 0, 0], "semantic": {"name": "warnings", "arg_names": [], "import_names": ["warn"], "rhs_call_name": "", "annotation": ""}, "snippet": " from warnings import warn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98749:Expr_L5_C4", "label": "warn()", "type": "expression", "loc": [5, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98749:If_L3_C0", "vector": [8, 1, 0.6818, 0.5455, 1, 0.91, 0.5, 960, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warn", "arg_names": [], "import_names": [], "rhs_call_name": "warn", "annotation": ""}, "snippet": " warn('The `django.contrib.gis.db.backend` module was refactored and '\n 'renamed to `django.contrib.gis.db.backends` in 1.2. '\n 'All functionality of `SpatialBackend` '\n 'has been moved to the `ops` attribute of the spatial database '\n 'backend. A `SpatialBackend` alias is provided here for '\n 'backwards-compatibility, but will be removed in 1.3.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98749:Assign_L11_C4", "label": "SpatialBackend =", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98749:If_L3_C0", "vector": [14, 1, 1.0, 0.0909, 1, 0.91, 1.0, 577, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "SpatialBackend", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " SpatialBackend = connection.ops"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98749:If_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98749:ImportFrom_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98749:If_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98749:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98749:If_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98749:Assign_L11_C4"}] |
from django.db import connections
from django.db.models.query import QuerySet, Q, ValuesQuerySet, ValuesListQuerySet
from django.contrib.gis.db.models import aggregates
from django.contrib.gis.db.models.fields import get_srid_info, GeometryField, PointField, LineStringField
from django.contrib.gis.db.models.sql import AreaField, DistanceField, GeomField, GeoQuery, GeoWhereNode
from django.contrib.gis.geometry.backend import Geometry
from django.contrib.gis.measure import Area, Distance
class GeoQuerySet(QuerySet):
"The Geographic QuerySet."
### Methods overloaded from QuerySet ###
def __init__(self, model=None, query=None, using=None):
super(GeoQuerySet, self).__init__(model=model, query=query, using=using)
self.query = query or GeoQuery(self.model)
def values(self, *fields):
return self._clone(klass=GeoValuesQuerySet, setup=True, _fields=fields)
def values_list(self, *fields, **kwargs):
flat = kwargs.pop('flat', False)
if kwargs:
raise TypeError('Unexpected keyword arguments to values_list: %s'
% (kwargs.keys(),))
if flat and len(fields) > 1:
raise TypeError("'flat' is not valid when values_list is called with more than one field.")
return self._clone(klass=GeoValuesListQuerySet, setup=True, flat=flat,
_fields=fields)
### GeoQuerySet Methods ###
def area(self, tolerance=0.05, **kwargs):
"""
Returns the area of the geographic field in an `area` attribute on
each element of this GeoQuerySet.
"""
# Peforming setup here rather than in `_spatial_attribute` so that
# we can get the units for `AreaField`.
procedure_args, geo_field = self._spatial_setup('area', field_name=kwargs.get('field_name', None))
s = {'procedure_args' : procedure_args,
'geo_field' : geo_field,
'setup' : False,
}
connection = connections[self.db]
backend = connection.ops
if backend.oracle:
s['procedure_fmt'] = '%(geo_col)s,%(tolerance)s'
s['procedure_args']['tolerance'] = tolerance
s['select_field'] = AreaField('sq_m') # Oracle returns area in units of meters.
elif backend.postgis or backend.spatialite:
if backend.geography:
# Geography fields support area calculation, returns square meters.
s['select_field'] = AreaField('sq_m')
elif not geo_field.geodetic(connection):
# Getting the area units of the geographic field.
s['select_field'] = AreaField(Area.unit_attname(geo_field.units_name(connection)))
else:
# TODO: Do we want to support raw number areas for geodetic fields?
raise Exception('Area on geodetic coordinate systems not supported.')
return self._spatial_attribute('area', s, **kwargs)
def centroid(self, **kwargs):
"""
Returns the centroid of the geographic field in a `centroid`
attribute on each element of this GeoQuerySet.
"""
return self._geom_attribute('centroid', **kwargs)
def collect(self, **kwargs):
"""
Performs an aggregate collect operation on the given geometry field.
This is analagous to a union operation, but much faster because
boundaries are not dissolved.
"""
return self._spatial_aggregate(aggregates.Collect, **kwargs)
def difference(self, geom, **kwargs):
"""
Returns the spatial difference of the geographic field in a `difference`
attribute on each element of this GeoQuerySet.
"""
return self._geomset_attribute('difference', geom, **kwargs)
def distance(self, geom, **kwargs):
"""
Returns the distance from the given geographic field name to the
given geometry in a `distance` attribute on each element of the
GeoQuerySet.
Keyword Arguments:
`spheroid` => If the geometry field is geodetic and PostGIS is
the spatial database, then the more accurate
spheroid calculation will be used instead of the
quicker sphere calculation.
`tolerance` => Used only for Oracle. The tolerance is
in meters -- a default of 5 centimeters (0.05)
is used.
"""
return self._distance_attribute('distance', geom, **kwargs)
def envelope(self, **kwargs):
"""
Returns a Geometry representing the bounding box of the
Geometry field in an `envelope` attribute on each element of
the GeoQuerySet.
"""
return self._geom_attribute('envelope', **kwargs)
def extent(self, **kwargs):
"""
Returns the extent (aggregate) of the features in the GeoQuerySet. The
extent will be returned as a 4-tuple, consisting of (xmin, ymin, xmax, ymax).
"""
return self._spatial_aggregate(aggregates.Extent, **kwargs)
def extent3d(self, **kwargs):
"""
Returns the aggregate extent, in 3D, of the features in the
GeoQuerySet. It is returned as a 6-tuple, comprising:
(xmin, ymin, zmin, xmax, ymax, zmax).
"""
return self._spatial_aggregate(aggregates.Extent3D, **kwargs)
def force_rhr(self, **kwargs):
"""
Returns a modified version of the Polygon/MultiPolygon in which
all of the vertices follow the Right-Hand-Rule. By default,
this is attached as the `force_rhr` attribute on each element
of the GeoQuerySet.
"""
return self._geom_attribute('force_rhr', **kwargs)
def geojson(self, precision=8, crs=False, bbox=False, **kwargs):
"""
Returns a GeoJSON representation of the geomtry field in a `geojson`
attribute on each element of the GeoQuerySet.
The `crs` and `bbox` keywords may be set to True if the users wants
the coordinate reference system and the bounding box to be included
in the GeoJSON representation of the geometry.
"""
backend = connections[self.db].ops
if not backend.geojson:
raise NotImplementedError('Only PostGIS 1.3.4+ supports GeoJSON serialization.')
if not isinstance(precision, (int, long)):
raise TypeError('Precision keyword must be set with an integer.')
# Setting the options flag -- which depends on which version of
# PostGIS we're using.
if backend.spatial_version >= (1, 4, 0):
options = 0
if crs and bbox: options = 3
elif bbox: options = 1
elif crs: options = 2
else:
options = 0
if crs and bbox: options = 3
elif crs: options = 1
elif bbox: options = 2
s = {'desc' : 'GeoJSON',
'procedure_args' : {'precision' : precision, 'options' : options},
'procedure_fmt' : '%(geo_col)s,%(precision)s,%(options)s',
}
return self._spatial_attribute('geojson', s, **kwargs)
def geohash(self, precision=20, **kwargs):
"""
Returns a GeoHash representation of the given field in a `geohash`
attribute on each element of the GeoQuerySet.
The `precision` keyword may be used to custom the number of
_characters_ used in the output GeoHash, the default is 20.
"""
s = {'desc' : 'GeoHash',
'procedure_args': {'precision': precision},
'procedure_fmt': '%(geo_col)s,%(precision)s',
}
return self._spatial_attribute('geohash', s, **kwargs)
def gml(self, precision=8, version=2, **kwargs):
"""
Returns GML representation of the given field in a `gml` attribute
on each element of the GeoQuerySet.
"""
backend = connections[self.db].ops
s = {'desc' : 'GML', 'procedure_args' : {'precision' : precision}}
if backend.postgis:
# PostGIS AsGML() aggregate function parameter order depends on the
# version -- uggh.
if backend.spatial_version > (1, 3, 1):
procedure_fmt = '%(version)s,%(geo_col)s,%(precision)s'
else:
procedure_fmt = '%(geo_col)s,%(precision)s,%(version)s'
s['procedure_args'] = {'precision' : precision, 'version' : version}
return self._spatial_attribute('gml', s, **kwargs)
def intersection(self, geom, **kwargs):
"""
Returns the spatial intersection of the Geometry field in
an `intersection` attribute on each element of this
GeoQuerySet.
"""
return self._geomset_attribute('intersection', geom, **kwargs)
def kml(self, **kwargs):
"""
Returns KML representation of the geometry field in a `kml`
attribute on each element of this GeoQuerySet.
"""
s = {'desc' : 'KML',
'procedure_fmt' : '%(geo_col)s,%(precision)s',
'procedure_args' : {'precision' : kwargs.pop('precision', 8)},
}
return self._spatial_attribute('kml', s, **kwargs)
def length(self, **kwargs):
"""
Returns the length of the geometry field as a `Distance` object
stored in a `length` attribute on each element of this GeoQuerySet.
"""
return self._distance_attribute('length', None, **kwargs)
def make_line(self, **kwargs):
"""
Creates a linestring from all of the PointField geometries in the
this GeoQuerySet and returns it. This is a spatial aggregate
method, and thus returns a geometry rather than a GeoQuerySet.
"""
return self._spatial_aggregate(aggregates.MakeLine, geo_field_type=PointField, **kwargs)
def mem_size(self, **kwargs):
"""
Returns the memory size (number of bytes) that the geometry field takes
in a `mem_size` attribute on each element of this GeoQuerySet.
"""
return self._spatial_attribute('mem_size', {}, **kwargs)
def num_geom(self, **kwargs):
"""
Returns the number of geometries if the field is a
GeometryCollection or Multi* Field in a `num_geom`
attribute on each element of this GeoQuerySet; otherwise
the sets with None.
"""
return self._spatial_attribute('num_geom', {}, **kwargs)
def num_points(self, **kwargs):
"""
Returns the number of points in the first linestring in the
Geometry field in a `num_points` attribute on each element of
this GeoQuerySet; otherwise sets with None.
"""
return self._spatial_attribute('num_points', {}, **kwargs)
def perimeter(self, **kwargs):
"""
Returns the perimeter of the geometry field as a `Distance` object
stored in a `perimeter` attribute on each element of this GeoQuerySet.
"""
return self._distance_attribute('perimeter', None, **kwargs)
def point_on_surface(self, **kwargs):
"""
Returns a Point geometry guaranteed to lie on the surface of the
Geometry field in a `point_on_surface` attribute on each element
of this GeoQuerySet; otherwise sets with None.
"""
return self._geom_attribute('point_on_surface', **kwargs)
def reverse_geom(self, **kwargs):
"""
Reverses the coordinate order of the geometry, and attaches as a
`reverse` attribute on each element of this GeoQuerySet.
"""
s = {'select_field' : GeomField(),}
kwargs.setdefault('model_att', 'reverse_geom')
if connections[self.db].ops.oracle:
s['geo_field_type'] = LineStringField
return self._spatial_attribute('reverse', s, **kwargs)
def scale(self, x, y, z=0.0, **kwargs):
"""
Scales the geometry to a new size by multiplying the ordinates
with the given x,y,z scale factors.
"""
if connections[self.db].ops.spatialite:
if z != 0.0:
raise NotImplementedError('SpatiaLite does not support 3D scaling.')
s = {'procedure_fmt' : '%(geo_col)s,%(x)s,%(y)s',
'procedure_args' : {'x' : x, 'y' : y},
'select_field' : GeomField(),
}
else:
s = {'procedure_fmt' : '%(geo_col)s,%(x)s,%(y)s,%(z)s',
'procedure_args' : {'x' : x, 'y' : y, 'z' : z},
'select_field' : GeomField(),
}
return self._spatial_attribute('scale', s, **kwargs)
def snap_to_grid(self, *args, **kwargs):
"""
Snap all points of the input geometry to the grid. How the
geometry is snapped to the grid depends on how many arguments
were given:
- 1 argument : A single size to snap both the X and Y grids to.
- 2 arguments: X and Y sizes to snap the grid to.
- 4 arguments: X, Y sizes and the X, Y origins.
"""
if False in [isinstance(arg, (float, int, long)) for arg in args]:
raise TypeError('Size argument(s) for the grid must be a float or integer values.')
nargs = len(args)
if nargs == 1:
size = args[0]
procedure_fmt = '%(geo_col)s,%(size)s'
procedure_args = {'size' : size}
elif nargs == 2:
xsize, ysize = args
procedure_fmt = '%(geo_col)s,%(xsize)s,%(ysize)s'
procedure_args = {'xsize' : xsize, 'ysize' : ysize}
elif nargs == 4:
xsize, ysize, xorigin, yorigin = args
procedure_fmt = '%(geo_col)s,%(xorigin)s,%(yorigin)s,%(xsize)s,%(ysize)s'
procedure_args = {'xsize' : xsize, 'ysize' : ysize,
'xorigin' : xorigin, 'yorigin' : yorigin}
else:
raise ValueError('Must provide 1, 2, or 4 arguments to `snap_to_grid`.')
s = {'procedure_fmt' : procedure_fmt,
'procedure_args' : procedure_args,
'select_field' : GeomField(),
}
return self._spatial_attribute('snap_to_grid', s, **kwargs)
def svg(self, relative=False, precision=8, **kwargs):
"""
Returns SVG representation of the geographic field in a `svg`
attribute on each element of this GeoQuerySet.
Keyword Arguments:
`relative` => If set to True, this will evaluate the path in
terms of relative moves (rather than absolute).
`precision` => May be used to set the maximum number of decimal
digits used in output (defaults to 8).
"""
relative = int(bool(relative))
if not isinstance(precision, (int, long)):
raise TypeError('SVG precision keyword argument must be an integer.')
s = {'desc' : 'SVG',
'procedure_fmt' : '%(geo_col)s,%(rel)s,%(precision)s',
'procedure_args' : {'rel' : relative,
'precision' : precision,
}
}
return self._spatial_attribute('svg', s, **kwargs)
def sym_difference(self, geom, **kwargs):
"""
Returns the symmetric difference of the geographic field in a
`sym_difference` attribute on each element of this GeoQuerySet.
"""
return self._geomset_attribute('sym_difference', geom, **kwargs)
def translate(self, x, y, z=0.0, **kwargs):
"""
Translates the geometry to a new location using the given numeric
parameters as offsets.
"""
if connections[self.db].ops.spatialite:
if z != 0.0:
raise NotImplementedError('SpatiaLite does not support 3D translation.')
s = {'procedure_fmt' : '%(geo_col)s,%(x)s,%(y)s',
'procedure_args' : {'x' : x, 'y' : y},
'select_field' : GeomField(),
}
else:
s = {'procedure_fmt' : '%(geo_col)s,%(x)s,%(y)s,%(z)s',
'procedure_args' : {'x' : x, 'y' : y, 'z' : z},
'select_field' : GeomField(),
}
return self._spatial_attribute('translate', s, **kwargs)
def transform(self, srid=4326, **kwargs):
"""
Transforms the given geometry field to the given SRID. If no SRID is
provided, the transformation will default to using 4326 (WGS84).
"""
if not isinstance(srid, (int, long)):
raise TypeError('An integer SRID must be provided.')
field_name = kwargs.get('field_name', None)
tmp, geo_field = self._spatial_setup('transform', field_name=field_name)
# Getting the selection SQL for the given geographic field.
field_col = self._geocol_select(geo_field, field_name)
# Why cascading substitutions? Because spatial backends like
# Oracle and MySQL already require a function call to convert to text, thus
# when there's also a transformation we need to cascade the substitutions.
# For example, 'SDO_UTIL.TO_WKTGEOMETRY(SDO_CS.TRANSFORM( ... )'
geo_col = self.query.custom_select.get(geo_field, field_col)
# Setting the key for the field's column with the custom SELECT SQL to
# override the geometry column returned from the database.
custom_sel = '%s(%s, %s)' % (connections[self.db].ops.transform, geo_col, srid)
# TODO: Should we have this as an alias?
# custom_sel = '(%s(%s, %s)) AS %s' % (SpatialBackend.transform, geo_col, srid, qn(geo_field.name))
self.query.transformed_srid = srid # So other GeoQuerySet methods
self.query.custom_select[geo_field] = custom_sel
return self._clone()
def union(self, geom, **kwargs):
"""
Returns the union of the geographic field with the given
Geometry in a `union` attribute on each element of this GeoQuerySet.
"""
return self._geomset_attribute('union', geom, **kwargs)
def unionagg(self, **kwargs):
"""
Performs an aggregate union on the given geometry field. Returns
None if the GeoQuerySet is empty. The `tolerance` keyword is for
Oracle backends only.
"""
return self._spatial_aggregate(aggregates.Union, **kwargs)
### Private API -- Abstracted DRY routines. ###
def _spatial_setup(self, att, desc=None, field_name=None, geo_field_type=None):
"""
Performs set up for executing the spatial function.
"""
# Does the spatial backend support this?
connection = connections[self.db]
func = getattr(connection.ops, att, False)
if desc is None: desc = att
if not func:
raise NotImplementedError('%s stored procedure not available on '
'the %s backend.' %
(desc, connection.ops.name))
# Initializing the procedure arguments.
procedure_args = {'function' : func}
# Is there a geographic field in the model to perform this
# operation on?
geo_field = self.query._geo_field(field_name)
if not geo_field:
raise TypeError('%s output only available on GeometryFields.' % func)
# If the `geo_field_type` keyword was used, then enforce that
# type limitation.
if not geo_field_type is None and not isinstance(geo_field, geo_field_type):
raise TypeError('"%s" stored procedures may only be called on %ss.' % (func, geo_field_type.__name__))
# Setting the procedure args.
procedure_args['geo_col'] = self._geocol_select(geo_field, field_name)
return procedure_args, geo_field
def _spatial_aggregate(self, aggregate, field_name=None,
geo_field_type=None, tolerance=0.05):
"""
DRY routine for calling aggregate spatial stored procedures and
returning their result to the caller of the function.
"""
# Getting the field the geographic aggregate will be called on.
geo_field = self.query._geo_field(field_name)
if not geo_field:
raise TypeError('%s aggregate only available on GeometryFields.' % aggregate.name)
# Checking if there are any geo field type limitations on this
# aggregate (e.g. ST_Makeline only operates on PointFields).
if not geo_field_type is None and not isinstance(geo_field, geo_field_type):
raise TypeError('%s aggregate may only be called on %ss.' % (aggregate.name, geo_field_type.__name__))
# Getting the string expression of the field name, as this is the
# argument taken by `Aggregate` objects.
agg_col = field_name or geo_field.name
# Adding any keyword parameters for the Aggregate object. Oracle backends
# in particular need an additional `tolerance` parameter.
agg_kwargs = {}
if connections[self.db].ops.oracle: agg_kwargs['tolerance'] = tolerance
# Calling the QuerySet.aggregate, and returning only the value of the aggregate.
return self.aggregate(geoagg=aggregate(agg_col, **agg_kwargs))['geoagg']
def _spatial_attribute(self, att, settings, field_name=None, model_att=None):
"""
DRY routine for calling a spatial stored procedure on a geometry column
and attaching its output as an attribute of the model.
Arguments:
att:
The name of the spatial attribute that holds the spatial
SQL function to call.
settings:
Dictonary of internal settings to customize for the spatial procedure.
Public Keyword Arguments:
field_name:
The name of the geographic field to call the spatial
function on. May also be a lookup to a geometry field
as part of a foreign key relation.
model_att:
The name of the model attribute to attach the output of
the spatial function to.
"""
# Default settings.
settings.setdefault('desc', None)
settings.setdefault('geom_args', ())
settings.setdefault('geom_field', None)
settings.setdefault('procedure_args', {})
settings.setdefault('procedure_fmt', '%(geo_col)s')
settings.setdefault('select_params', [])
connection = connections[self.db]
backend = connection.ops
# Performing setup for the spatial column, unless told not to.
if settings.get('setup', True):
default_args, geo_field = self._spatial_setup(att, desc=settings['desc'], field_name=field_name,
geo_field_type=settings.get('geo_field_type', None))
for k, v in default_args.iteritems(): settings['procedure_args'].setdefault(k, v)
else:
geo_field = settings['geo_field']
# The attribute to attach to the model.
if not isinstance(model_att, basestring): model_att = att
# Special handling for any argument that is a geometry.
for name in settings['geom_args']:
# Using the field's get_placeholder() routine to get any needed
# transformation SQL.
geom = geo_field.get_prep_value(settings['procedure_args'][name])
params = geo_field.get_db_prep_lookup('contains', geom, connection=connection)
geom_placeholder = geo_field.get_placeholder(geom, connection)
# Replacing the procedure format with that of any needed
# transformation SQL.
old_fmt = '%%(%s)s' % name
new_fmt = geom_placeholder % '%%s'
settings['procedure_fmt'] = settings['procedure_fmt'].replace(old_fmt, new_fmt)
settings['select_params'].extend(params)
# Getting the format for the stored procedure.
fmt = '%%(function)s(%s)' % settings['procedure_fmt']
# If the result of this function needs to be converted.
if settings.get('select_field', False):
sel_fld = settings['select_field']
if isinstance(sel_fld, GeomField) and backend.select:
self.query.custom_select[model_att] = backend.select
if connection.ops.oracle:
sel_fld.empty_strings_allowed = False
self.query.extra_select_fields[model_att] = sel_fld
# Finally, setting the extra selection attribute with
# the format string expanded with the stored procedure
# arguments.
return self.extra(select={model_att : fmt % settings['procedure_args']},
select_params=settings['select_params'])
def _distance_attribute(self, func, geom=None, tolerance=0.05, spheroid=False, **kwargs):
"""
DRY routine for GeoQuerySet distance attribute routines.
"""
# Setting up the distance procedure arguments.
procedure_args, geo_field = self._spatial_setup(func, field_name=kwargs.get('field_name', None))
# If geodetic defaulting distance attribute to meters (Oracle and
# PostGIS spherical distances return meters). Otherwise, use the
# units of the geometry field.
connection = connections[self.db]
geodetic = geo_field.geodetic(connection)
geography = geo_field.geography
if geodetic:
dist_att = 'm'
else:
dist_att = Distance.unit_attname(geo_field.units_name(connection))
# Shortcut booleans for what distance function we're using and
# whether the geometry field is 3D.
distance = func == 'distance'
length = func == 'length'
perimeter = func == 'perimeter'
if not (distance or length or perimeter):
raise ValueError('Unknown distance function: %s' % func)
geom_3d = geo_field.dim == 3
# The field's get_db_prep_lookup() is used to get any
# extra distance parameters. Here we set up the
# parameters that will be passed in to field's function.
lookup_params = [geom or 'POINT (0 0)', 0]
# Getting the spatial backend operations.
backend = connection.ops
# If the spheroid calculation is desired, either by the `spheroid`
# keyword or when calculating the length of geodetic field, make
# sure the 'spheroid' distance setting string is passed in so we
# get the correct spatial stored procedure.
if spheroid or (backend.postgis and geodetic and
(not geography) and length):
lookup_params.append('spheroid')
lookup_params = geo_field.get_prep_value(lookup_params)
params = geo_field.get_db_prep_lookup('distance_lte', lookup_params, connection=connection)
# The `geom_args` flag is set to true if a geometry parameter was
# passed in.
geom_args = bool(geom)
if backend.oracle:
if distance:
procedure_fmt = '%(geo_col)s,%(geom)s,%(tolerance)s'
elif length or perimeter:
procedure_fmt = '%(geo_col)s,%(tolerance)s'
procedure_args['tolerance'] = tolerance
else:
# Getting whether this field is in units of degrees since the field may have
# been transformed via the `transform` GeoQuerySet method.
if self.query.transformed_srid:
u, unit_name, s = get_srid_info(self.query.transformed_srid, connection)
geodetic = unit_name in geo_field.geodetic_units
if backend.spatialite and geodetic:
raise ValueError('SQLite does not support linear distance calculations on geodetic coordinate systems.')
if distance:
if self.query.transformed_srid:
# Setting the `geom_args` flag to false because we want to handle
# transformation SQL here, rather than the way done by default
# (which will transform to the original SRID of the field rather
# than to what was transformed to).
geom_args = False
procedure_fmt = '%s(%%(geo_col)s, %s)' % (backend.transform, self.query.transformed_srid)
if geom.srid is None or geom.srid == self.query.transformed_srid:
# If the geom parameter srid is None, it is assumed the coordinates
# are in the transformed units. A placeholder is used for the
# geometry parameter. `GeomFromText` constructor is also needed
# to wrap geom placeholder for SpatiaLite.
if backend.spatialite:
procedure_fmt += ', %s(%%%%s, %s)' % (backend.from_text, self.query.transformed_srid)
else:
procedure_fmt += ', %%s'
else:
# We need to transform the geom to the srid specified in `transform()`,
# so wrapping the geometry placeholder in transformation SQL.
# SpatiaLite also needs geometry placeholder wrapped in `GeomFromText`
# constructor.
if backend.spatialite:
procedure_fmt += ', %s(%s(%%%%s, %s), %s)' % (backend.transform, backend.from_text,
geom.srid, self.query.transformed_srid)
else:
procedure_fmt += ', %s(%%%%s, %s)' % (backend.transform, self.query.transformed_srid)
else:
# `transform()` was not used on this GeoQuerySet.
procedure_fmt = '%(geo_col)s,%(geom)s'
if not geography and geodetic:
# Spherical distance calculation is needed (because the geographic
# field is geodetic). However, the PostGIS ST_distance_sphere/spheroid()
# procedures may only do queries from point columns to point geometries
# some error checking is required.
if not backend.geography:
if not isinstance(geo_field, PointField):
raise ValueError('Spherical distance calculation only supported on PointFields.')
if not str(Geometry(buffer(params[0].ewkb)).geom_type) == 'Point':
raise ValueError('Spherical distance calculation only supported with Point Geometry parameters')
# The `function` procedure argument needs to be set differently for
# geodetic distance calculations.
if spheroid:
# Call to distance_spheroid() requires spheroid param as well.
procedure_fmt += ",'%(spheroid)s'"
procedure_args.update({'function' : backend.distance_spheroid, 'spheroid' : params[1]})
else:
procedure_args.update({'function' : backend.distance_sphere})
elif length or perimeter:
procedure_fmt = '%(geo_col)s'
if not geography and geodetic and length:
# There's no `length_sphere`, and `length_spheroid` also
# works on 3D geometries.
procedure_fmt += ",'%(spheroid)s'"
procedure_args.update({'function' : backend.length_spheroid, 'spheroid' : params[1]})
elif geom_3d and backend.postgis:
# Use 3D variants of perimeter and length routines on PostGIS.
if perimeter:
procedure_args.update({'function' : backend.perimeter3d})
elif length:
procedure_args.update({'function' : backend.length3d})
# Setting up the settings for `_spatial_attribute`.
s = {'select_field' : DistanceField(dist_att),
'setup' : False,
'geo_field' : geo_field,
'procedure_args' : procedure_args,
'procedure_fmt' : procedure_fmt,
}
if geom_args:
s['geom_args'] = ('geom',)
s['procedure_args']['geom'] = geom
elif geom:
# The geometry is passed in as a parameter because we handled
# transformation conditions in this routine.
s['select_params'] = [backend.Adapter(geom)]
return self._spatial_attribute(func, s, **kwargs)
def _geom_attribute(self, func, tolerance=0.05, **kwargs):
"""
DRY routine for setting up a GeoQuerySet method that attaches a
Geometry attribute (e.g., `centroid`, `point_on_surface`).
"""
s = {'select_field' : GeomField(),}
if connections[self.db].ops.oracle:
s['procedure_fmt'] = '%(geo_col)s,%(tolerance)s'
s['procedure_args'] = {'tolerance' : tolerance}
return self._spatial_attribute(func, s, **kwargs)
def _geomset_attribute(self, func, geom, tolerance=0.05, **kwargs):
"""
DRY routine for setting up a GeoQuerySet method that attaches a
Geometry attribute and takes a Geoemtry parameter. This is used
for geometry set-like operations (e.g., intersection, difference,
union, sym_difference).
"""
s = {'geom_args' : ('geom',),
'select_field' : GeomField(),
'procedure_fmt' : '%(geo_col)s,%(geom)s',
'procedure_args' : {'geom' : geom},
}
if connections[self.db].ops.oracle:
s['procedure_fmt'] += ',%(tolerance)s'
s['procedure_args']['tolerance'] = tolerance
return self._spatial_attribute(func, s, **kwargs)
def _geocol_select(self, geo_field, field_name):
"""
Helper routine for constructing the SQL to select the geographic
column. Takes into account if the geographic field is in a
ForeignKey relation to the current model.
"""
opts = self.model._meta
if not geo_field in opts.fields:
# Is this operation going to be on a related geographic field?
# If so, it'll have to be added to the select related information
# (e.g., if 'location__point' was given as the field name).
self.query.add_select_related([field_name])
compiler = self.query.get_compiler(self.db)
compiler.pre_sql_setup()
rel_table, rel_col = self.query.related_select_cols[self.query.related_select_fields.index(geo_field)]
return compiler._field_column(geo_field, rel_table)
elif not geo_field in opts.local_fields:
# This geographic field is inherited from another model, so we have to
# use the db table for the _parent_ model instead.
tmp_fld, parent_model, direct, m2m = opts.get_field_by_name(geo_field.name)
return self.query.get_compiler(self.db)._field_column(geo_field, parent_model._meta.db_table)
else:
return self.query.get_compiler(self.db)._field_column(geo_field)
class GeoValuesQuerySet(ValuesQuerySet):
def __init__(self, *args, **kwargs):
super(GeoValuesQuerySet, self).__init__(*args, **kwargs)
# This flag tells `resolve_columns` to run the values through
# `convert_values`. This ensures that Geometry objects instead
# of string values are returned with `values()` or `values_list()`.
self.query.geo_values = True
class GeoValuesListQuerySet(GeoValuesQuerySet, ValuesListQuerySet):
pass
| ajibawa-2023/Python-Code-Large/train/row_98750 | 338 | 777 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98750:ImportFrom_L1_C0", "label": "from django.db import connections", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0013, 0.0013, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["connections"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db import connections"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:ImportFrom_L2_C0", "label": "from django.db.models.query import QuerySet, Q, ValuesQuerySet\u2026", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0026, 0.0013, 0, 0.66, 0.1111, 793, 0, 4, 0, 0, 793, 0, 0], "semantic": {"name": "django.db.models.query", "arg_names": [], "import_names": ["QuerySet", "Q", "ValuesQuerySet", "ValuesListQuerySet"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.models.query import QuerySet, Q, ValuesQuerySet, ValuesListQuerySet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:ImportFrom_L4_C0", "label": "from django.contrib.gis.db.models import aggregates", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0051, 0.0013, 0, 0.66, 0.2222, 472, 0, 1, 0, 0, 472, 0, 0], "semantic": {"name": "django.contrib.gis.db.models", "arg_names": [], "import_names": ["aggregates"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.models import aggregates"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:ImportFrom_L5_C0", "label": "from django.contrib.gis.db.models.fields import get_srid_info, GeometryField, PointField\u2026", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0064, 0.0013, 0, 0.66, 0.3333, 708, 0, 4, 0, 0, 708, 0, 0], "semantic": {"name": "django.contrib.gis.db.models.fields", "arg_names": [], "import_names": ["get_srid_info", "GeometryField", "PointField", "LineStringField"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.models.fields import get_srid_info, GeometryField, PointField, LineStringField"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:ImportFrom_L6_C0", "label": "from django.contrib.gis.db.models.sql import AreaField, DistanceField, GeomField\u2026", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0077, 0.0013, 0, 0.66, 0.4444, 437, 0, 5, 0, 0, 437, 0, 0], "semantic": {"name": "django.contrib.gis.db.models.sql", "arg_names": [], "import_names": ["AreaField", "DistanceField", "GeomField", "GeoQuery", "GeoWhereNode"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.models.sql import AreaField, DistanceField, GeomField, GeoQuery, GeoWhereNode"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:ImportFrom_L7_C0", "label": "from django.contrib.gis.geometry.backend import Geometry", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.009, 0.0013, 0, 0.66, 0.5556, 299, 0, 1, 0, 0, 299, 0, 0], "semantic": {"name": "django.contrib.gis.geometry.backend", "arg_names": [], "import_names": ["Geometry"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geometry.backend import Geometry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:ImportFrom_L8_C0", "label": "from django.contrib.gis.measure import Area, Distance", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0103, 0.0013, 0, 0.66, 0.6667, 844, 0, 2, 0, 0, 844, 0, 0], "semantic": {"name": "django.contrib.gis.measure", "arg_names": [], "import_names": ["Area", "Distance"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.measure import Area, Distance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "label": "GeoQuerySet", "type": "class", "loc": [10, 766], "level": 0, "parent": null, "vector": [3, 0, 0.4994, 0.9743, 0, 0.66, 0.7778, 616, 0, 40, 0, 0, 78, 0, 99], "semantic": {"name": "GeoQuerySet", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GeoQuerySet(QuerySet):\n \"The Geographic QuerySet.\"\n\n ### Methods overloaded from QuerySet ###\n def __init__(self, model=None, query=None, using=None):\n super(GeoQuerySet, self).__init__(model=model, query=query, using=using)\n self.query = query or GeoQuery(self.model)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L11_C4", "label": "expression", "type": "expression", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [8, 1, 0.0142, 0.0013, 1, 0.64, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"The Geographic QuerySet.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L14_C4", "label": "__init__", "type": "function", "loc": [14, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.0193, 0.0039, 1, 0.64, 0.025, 555, 0, 4, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "model", "query", "using"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, model=None, query=None, using=None):\n super(GeoQuerySet, self).__init__(model=model, query=query, using=using)\n self.query = query or GeoQuery(self.model)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L15_C8", "label": "__init__()", "type": "expression", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L14_C4", "vector": [8, 2, 0.0193, 0.0013, 2, 0.76, 0.0, 555, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(GeoQuerySet, self).__init__(model=model, query=query, using=using)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L16_C8", "label": "self.query =", "type": "assigned_variable", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L14_C4", "vector": [14, 2, 0.0206, 0.0013, 2, 0.76, 1.0, 241, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.query = query or GeoQuery(self.model)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L18_C4", "label": "values", "type": "function", "loc": [18, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.0238, 0.0026, 1, 0.64, 0.05, 721, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "values", "arg_names": ["self", "fields"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def values(self, *fields):\n return self._clone(klass=GeoValuesQuerySet, setup=True, _fields=fields)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L19_C8", "label": "return", "type": "return", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L18_C4", "vector": [13, 2, 0.0245, 0.0013, 2, 0.37, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._clone(klass=GeoValuesQuerySet, setup=True, _fields=fields)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L21_C4", "label": "values_list", "type": "function", "loc": [21, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.0322, 0.0116, 1, 0.64, 0.075, 253, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "values_list", "arg_names": ["self", "fields", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def values_list(self, *fields, **kwargs):\n flat = kwargs.pop('flat', False)\n if kwargs:\n raise TypeError('Unexpected keyword arguments to values_list: %s'\n % (kwargs.keys(),))\n if flat and len(fields) > 1:\n raise TypeError(\"'flat' is not valid when values_list is called with more than one field.\")\n return self._clone(klass=GeoValuesListQuerySet, setup=True, flat=flat,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L22_C8", "label": "flat = pop()", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L21_C4", "vector": [14, 2, 0.0283, 0.0013, 2, 0.08, 0.0, 363, 3, 2, 0, 0, 969, 10, 1], "semantic": {"name": "flat", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " flat = kwargs.pop('flat', False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L23_C8", "label": "if", "type": "if", "loc": [23, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L21_C4", "vector": [4, 2, 0.0309, 0.0039, 2, 0.08, 0.3333, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if kwargs:\n raise TypeError('Unexpected keyword arguments to values_list: %s'\n % (kwargs.keys(),))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L26_C8", "label": "if", "type": "if", "loc": [26, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L21_C4", "vector": [4, 2, 0.0341, 0.0026, 2, 0.08, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if flat and len(fields) > 1:\n raise TypeError(\"'flat' is not valid when values_list is called with more than one field.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L28_C8", "label": "return", "type": "return", "loc": [28, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L21_C4", "vector": [13, 2, 0.0367, 0.0026, 2, 0.08, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._clone(klass=GeoValuesListQuerySet, setup=True, flat=flat,\n _fields=fields)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L32_C4", "label": "area", "type": "function", "loc": [32, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.0592, 0.0373, 1, 0.64, 0.1, 715, 0, 3, 1, 0, 0, 0, 10], "semantic": {"name": "area", "arg_names": ["self", "tolerance", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def area(self, tolerance=0.05, **kwargs):\n \"\"\"\n Returns the area of the geographic field in an `area` attribute on\n each element of this GeoQuerySet.\n \"\"\"\n # Peforming setup here rather than in `_spatial_attribute` so that\n # we can get the units for `AreaField`.\n procedure_args, geo_field = self._spatial_setup('area', field_name=kwargs.get('field_name', None))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L33_C8", "label": "expression", "type": "expression", "loc": [33, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L32_C4", "vector": [8, 2, 0.0444, 0.0051, 2, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the area of the geographic field in an `area` attribute on\n each element of this GeoQuerySet.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L39_C8", "label": "procedure_args, geo_field = _spatial_setup()", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L32_C4", "vector": [14, 2, 0.0502, 0.0013, 2, 0.46, 0.1667, 779, 3, 2, 0, 0, 694, 10, 2], "semantic": {"name": "procedure_args, geo_field", "arg_names": [], "import_names": [], "rhs_call_name": "_spatial_setup", "annotation": ""}, "snippet": " procedure_args, geo_field = self._spatial_setup('area', field_name=kwargs.get('field_name', None))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L40_C8", "label": "s =", "type": "assigned_variable", "loc": [40, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L32_C4", "vector": [14, 2, 0.0534, 0.0051, 2, 0.46, 0.3333, 553, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = {'procedure_args' : procedure_args,\n 'geo_field' : geo_field,\n 'setup' : False,\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L44_C8", "label": "connection =", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L32_C4", "vector": [14, 2, 0.0566, 0.0013, 2, 0.46, 0.5, 351, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "connection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " connection = connections[self.db]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L45_C8", "label": "backend =", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L32_C4", "vector": [14, 2, 0.0579, 0.0013, 2, 0.46, 0.6667, 631, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "backend", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " backend = connection.ops"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L46_C8", "label": "if", "type": "if", "loc": [46, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L32_C4", "vector": [4, 2, 0.0676, 0.018, 2, 0.46, 0.8333, 0, 7, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if backend.oracle:\n s['procedure_fmt'] = '%(geo_col)s,%(tolerance)s'\n s['procedure_args']['tolerance'] = tolerance\n s['select_field'] = AreaField('sq_m') # Oracle returns area in units of meters.\n elif backend.postgis or backend.spatialite:\n if backend.geography:\n # Geography fields support area calculation, returns square meters.\n s['select_field'] = AreaField('sq_m')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L47_C12", "label": "assign", "type": "assigned_variable", "loc": [47, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L46_C8", "vector": [14, 3, 0.0605, 0.0013, 3, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s['procedure_fmt'] = '%(geo_col)s,%(tolerance)s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L48_C12", "label": "assign", "type": "assigned_variable", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L46_C8", "vector": [14, 3, 0.0618, 0.0013, 3, 0.49, 0.3333, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s['procedure_args']['tolerance'] = tolerance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L49_C12", "label": " = AreaField()", "type": "assigned_variable", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L46_C8", "vector": [14, 3, 0.0631, 0.0013, 3, 0.49, 0.6667, 0, 3, 1, 0, 0, 721, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "AreaField", "annotation": ""}, "snippet": " s['select_field'] = AreaField('sq_m') # Oracle returns area in units of meters."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L50_C8", "label": "if", "type": "if", "loc": [50, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L46_C8", "vector": [4, 3, 0.0701, 0.0129, 3, 0.49, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif backend.postgis or backend.spatialite:\n if backend.geography:\n # Geography fields support area calculation, returns square meters.\n s['select_field'] = AreaField('sq_m')\n elif not geo_field.geodetic(connection):\n # Getting the area units of the geographic field.\n s['select_field'] = AreaField(Area.unit_attname(geo_field.units_name(connection)))\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L51_C12", "label": "if", "type": "if", "loc": [51, 59], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L50_C8", "vector": [4, 4, 0.0708, 0.0116, 4, 0.98, 0.0, 0, 7, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if backend.geography:\n # Geography fields support area calculation, returns square meters.\n s['select_field'] = AreaField('sq_m')\n elif not geo_field.geodetic(connection):\n # Getting the area units of the geographic field.\n s['select_field'] = AreaField(Area.unit_attname(geo_field.units_name(connection)))\n else:\n # TODO: Do we want to support raw number areas for geodetic fields?"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L53_C16", "label": " = AreaField()", "type": "assigned_variable", "loc": [53, 53], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L51_C12", "vector": [14, 5, 0.0682, 0.0013, 5, 0.82, 0.0, 0, 3, 1, 0, 0, 721, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "AreaField", "annotation": ""}, "snippet": " s['select_field'] = AreaField('sq_m')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L54_C12", "label": "if", "type": "if", "loc": [54, 59], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L51_C12", "vector": [4, 5, 0.0727, 0.0077, 5, 0.82, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif not geo_field.geodetic(connection):\n # Getting the area units of the geographic field.\n s['select_field'] = AreaField(Area.unit_attname(geo_field.units_name(connection)))\n else:\n # TODO: Do we want to support raw number areas for geodetic fields?\n raise Exception('Area on geodetic coordinate systems not supported.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L56_C16", "label": " = AreaField()", "type": "assigned_variable", "loc": [56, 56], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L54_C12", "vector": [14, 6, 0.0721, 0.0013, 6, 0.85, 0.0, 0, 3, 1, 0, 0, 721, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "AreaField", "annotation": ""}, "snippet": " s['select_field'] = AreaField(Area.unit_attname(geo_field.units_name(connection)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L60_C8", "label": "return", "type": "return", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L32_C4", "vector": [13, 2, 0.0772, 0.0013, 2, 0.46, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._spatial_attribute('area', s, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L62_C4", "label": "centroid", "type": "function", "loc": [62, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.083, 0.0077, 1, 0.64, 0.125, 439, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "centroid", "arg_names": ["self", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def centroid(self, **kwargs):\n \"\"\"\n Returns the centroid of the geographic field in a `centroid`\n attribute on each element of this GeoQuerySet.\n \"\"\"\n return self._geom_attribute('centroid', **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L63_C8", "label": "expression", "type": "expression", "loc": [63, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L62_C4", "vector": [8, 2, 0.083, 0.0051, 2, 0.14, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the centroid of the geographic field in a `centroid`\n attribute on each element of this GeoQuerySet.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L67_C8", "label": "return", "type": "return", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L62_C4", "vector": [13, 2, 0.0862, 0.0013, 2, 0.14, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._geom_attribute('centroid', **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L69_C4", "label": "collect", "type": "function", "loc": [69, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.0927, 0.009, 1, 0.64, 0.15, 34, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "collect", "arg_names": ["self", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def collect(self, **kwargs):\n \"\"\"\n Performs an aggregate collect operation on the given geometry field.\n This is analagous to a union operation, but much faster because\n boundaries are not dissolved.\n \"\"\"\n return self._spatial_aggregate(aggregates.Collect, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L70_C8", "label": "expression", "type": "expression", "loc": [70, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L69_C4", "vector": [8, 2, 0.0927, 0.0064, 2, 0.12, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Performs an aggregate collect operation on the given geometry field.\n This is analagous to a union operation, but much faster because\n boundaries are not dissolved.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L75_C8", "label": "return", "type": "return", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L69_C4", "vector": [13, 2, 0.0965, 0.0013, 2, 0.12, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._spatial_aggregate(aggregates.Collect, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L77_C4", "label": "difference", "type": "function", "loc": [77, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.1023, 0.0077, 1, 0.64, 0.175, 498, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "difference", "arg_names": ["self", "geom", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def difference(self, geom, **kwargs):\n \"\"\"\n Returns the spatial difference of the geographic field in a `difference`\n attribute on each element of this GeoQuerySet.\n \"\"\"\n return self._geomset_attribute('difference', geom, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L78_C8", "label": "expression", "type": "expression", "loc": [78, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L77_C4", "vector": [8, 2, 0.1023, 0.0051, 2, 0.09, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the spatial difference of the geographic field in a `difference`\n attribute on each element of this GeoQuerySet.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L82_C8", "label": "return", "type": "return", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L77_C4", "vector": [13, 2, 0.1055, 0.0013, 2, 0.09, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._geomset_attribute('difference', geom, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L84_C4", "label": "distance", "type": "function", "loc": [84, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.1184, 0.0219, 1, 0.64, 0.2, 145, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "distance", "arg_names": ["self", "geom", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def distance(self, geom, **kwargs):\n \"\"\"\n Returns the distance from the given geographic field name to the\n given geometry in a `distance` attribute on each element of the\n GeoQuerySet.\n\n Keyword Arguments:\n `spheroid` => If the geometry field is geodetic and PostGIS is"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L85_C8", "label": "expression", "type": "expression", "loc": [85, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L84_C4", "vector": [8, 2, 0.1184, 0.0193, 2, 0.34, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the distance from the given geographic field name to the\n given geometry in a `distance` attribute on each element of the\n GeoQuerySet.\n\n Keyword Arguments:\n `spheroid` => If the geometry field is geodetic and PostGIS is\n the spatial database, then the more accurate"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L100_C8", "label": "return", "type": "return", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L84_C4", "vector": [13, 2, 0.1287, 0.0013, 2, 0.34, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._distance_attribute('distance', geom, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L102_C4", "label": "envelope", "type": "function", "loc": [102, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.1351, 0.009, 1, 0.64, 0.225, 48, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "envelope", "arg_names": ["self", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def envelope(self, **kwargs):\n \"\"\"\n Returns a Geometry representing the bounding box of the\n Geometry field in an `envelope` attribute on each element of\n the GeoQuerySet.\n \"\"\"\n return self._geom_attribute('envelope', **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L103_C8", "label": "expression", "type": "expression", "loc": [103, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L102_C4", "vector": [8, 2, 0.1351, 0.0064, 2, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a Geometry representing the bounding box of the\n Geometry field in an `envelope` attribute on each element of\n the GeoQuerySet.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L108_C8", "label": "return", "type": "return", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L102_C4", "vector": [13, 2, 0.139, 0.0013, 2, 0.13, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._geom_attribute('envelope', **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L110_C4", "label": "extent", "type": "function", "loc": [110, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.1448, 0.0077, 1, 0.64, 0.25, 962, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "extent", "arg_names": ["self", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def extent(self, **kwargs):\n \"\"\"\n Returns the extent (aggregate) of the features in the GeoQuerySet. The\n extent will be returned as a 4-tuple, consisting of (xmin, ymin, xmax, ymax).\n \"\"\"\n return self._spatial_aggregate(aggregates.Extent, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L111_C8", "label": "expression", "type": "expression", "loc": [111, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L110_C4", "vector": [8, 2, 0.1448, 0.0051, 2, 0.31, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the extent (aggregate) of the features in the GeoQuerySet. The\n extent will be returned as a 4-tuple, consisting of (xmin, ymin, xmax, ymax).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L115_C8", "label": "return", "type": "return", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L110_C4", "vector": [13, 2, 0.148, 0.0013, 2, 0.31, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._spatial_aggregate(aggregates.Extent, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L117_C4", "label": "extent3d", "type": "function", "loc": [117, 123], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.1544, 0.009, 1, 0.64, 0.275, 187, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "extent3d", "arg_names": ["self", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def extent3d(self, **kwargs):\n \"\"\"\n Returns the aggregate extent, in 3D, of the features in the\n GeoQuerySet. It is returned as a 6-tuple, comprising:\n (xmin, ymin, zmin, xmax, ymax, zmax).\n \"\"\"\n return self._spatial_aggregate(aggregates.Extent3D, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L118_C8", "label": "expression", "type": "expression", "loc": [118, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L117_C4", "vector": [8, 2, 0.1544, 0.0064, 2, 0.56, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the aggregate extent, in 3D, of the features in the\n GeoQuerySet. It is returned as a 6-tuple, comprising:\n (xmin, ymin, zmin, xmax, ymax, zmax).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L123_C8", "label": "return", "type": "return", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L117_C4", "vector": [13, 2, 0.1583, 0.0013, 2, 0.56, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._spatial_aggregate(aggregates.Extent3D, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L125_C4", "label": "force_rhr", "type": "function", "loc": [125, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.1654, 0.0103, 1, 0.64, 0.3, 927, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "force_rhr", "arg_names": ["self", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def force_rhr(self, **kwargs):\n \"\"\"\n Returns a modified version of the Polygon/MultiPolygon in which\n all of the vertices follow the Right-Hand-Rule. By default,\n this is attached as the `force_rhr` attribute on each element\n of the GeoQuerySet.\n \"\"\"\n return self._geom_attribute('force_rhr', **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L126_C8", "label": "expression", "type": "expression", "loc": [126, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L125_C4", "vector": [8, 2, 0.1654, 0.0077, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a modified version of the Polygon/MultiPolygon in which\n all of the vertices follow the Right-Hand-Rule. By default,\n this is attached as the `force_rhr` attribute on each element\n of the GeoQuerySet.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L132_C8", "label": "return", "type": "return", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L125_C4", "vector": [13, 2, 0.1699, 0.0013, 2, 0.98, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._geom_attribute('force_rhr', **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L134_C4", "label": "geojson", "type": "function", "loc": [134, 166], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.1931, 0.0425, 1, 0.64, 0.325, 89, 0, 5, 1, 0, 0, 0, 4], "semantic": {"name": "geojson", "arg_names": ["self", "precision", "crs", "bbox", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geojson(self, precision=8, crs=False, bbox=False, **kwargs):\n \"\"\"\n Returns a GeoJSON representation of the geomtry field in a `geojson`\n attribute on each element of the GeoQuerySet.\n\n The `crs` and `bbox` keywords may be set to True if the users wants\n the coordinate reference system and the bounding box to be included\n in the GeoJSON representation of the geometry."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L135_C8", "label": "expression", "type": "expression", "loc": [135, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L134_C4", "vector": [8, 2, 0.1782, 0.0103, 2, 0.78, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a GeoJSON representation of the geomtry field in a `geojson`\n attribute on each element of the GeoQuerySet.\n\n The `crs` and `bbox` keywords may be set to True if the users wants\n the coordinate reference system and the bounding box to be included\n in the GeoJSON representation of the geometry.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L143_C8", "label": "backend =", "type": "assigned_variable", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L134_C4", "vector": [14, 2, 0.184, 0.0013, 2, 0.78, 0.1667, 631, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "backend", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " backend = connections[self.db].ops"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L144_C8", "label": "if", "type": "if", "loc": [144, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L134_C4", "vector": [4, 2, 0.186, 0.0026, 2, 0.78, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not backend.geojson:\n raise NotImplementedError('Only PostGIS 1.3.4+ supports GeoJSON serialization.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L147_C8", "label": "if", "type": "if", "loc": [147, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L134_C4", "vector": [4, 2, 0.1898, 0.0026, 2, 0.78, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(precision, (int, long)):\n raise TypeError('Precision keyword must be set with an integer.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L152_C8", "label": "if", "type": "if", "loc": [152, 161], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L134_C4", "vector": [4, 2, 0.2014, 0.0129, 2, 0.78, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if backend.spatial_version >= (1, 4, 0):\n options = 0\n if crs and bbox: options = 3\n elif bbox: options = 1\n elif crs: options = 2\n else:\n options = 0\n if crs and bbox: options = 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L153_C12", "label": "options =", "type": "assigned_variable", "loc": [153, 153], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L152_C8", "vector": [14, 3, 0.1969, 0.0013, 3, 0.66, 0.0, 707, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "options", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " options = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L154_C12", "label": "if", "type": "if", "loc": [154, 156], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L152_C8", "vector": [4, 3, 0.1995, 0.0039, 3, 0.66, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if crs and bbox: options = 3\n elif bbox: options = 1\n elif crs: options = 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L154_C29", "label": "options =", "type": "assigned_variable", "loc": [154, 154], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L154_C12", "vector": [14, 4, 0.1982, 0.0013, 4, 0.86, 0.0, 707, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "options", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if crs and bbox: options = 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L155_C12", "label": "if", "type": "if", "loc": [155, 156], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L154_C12", "vector": [4, 4, 0.2001, 0.0026, 4, 0.86, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif bbox: options = 1\n elif crs: options = 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L155_C23", "label": "options =", "type": "assigned_variable", "loc": [155, 155], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L155_C12", "vector": [14, 5, 0.1995, 0.0013, 5, 0.08, 0.0, 707, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "options", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif bbox: options = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L156_C12", "label": "if", "type": "if", "loc": [156, 156], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L155_C12", "vector": [4, 5, 0.2008, 0.0013, 5, 0.08, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif crs: options = 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L156_C22", "label": "options =", "type": "assigned_variable", "loc": [156, 156], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L156_C12", "vector": [14, 6, 0.2008, 0.0013, 6, 0.67, 0.0, 707, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "options", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif crs: options = 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L158_C12", "label": "options =", "type": "assigned_variable", "loc": [158, 158], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L152_C8", "vector": [14, 3, 0.2033, 0.0013, 3, 0.66, 0.6667, 707, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "options", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " options = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L159_C12", "label": "if", "type": "if", "loc": [159, 161], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L152_C8", "vector": [4, 3, 0.2059, 0.0039, 3, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if crs and bbox: options = 3\n elif crs: options = 1\n elif bbox: options = 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L159_C29", "label": "options =", "type": "assigned_variable", "loc": [159, 159], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L159_C12", "vector": [14, 4, 0.2046, 0.0013, 4, 0.99, 0.0, 707, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "options", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if crs and bbox: options = 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L160_C12", "label": "if", "type": "if", "loc": [160, 161], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L159_C12", "vector": [4, 4, 0.2066, 0.0026, 4, 0.99, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif crs: options = 1\n elif bbox: options = 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L160_C22", "label": "options =", "type": "assigned_variable", "loc": [160, 160], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L160_C12", "vector": [14, 5, 0.2059, 0.0013, 5, 0.88, 0.0, 707, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "options", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif crs: options = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L161_C12", "label": "if", "type": "if", "loc": [161, 161], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L160_C12", "vector": [4, 5, 0.2072, 0.0013, 5, 0.88, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif bbox: options = 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L161_C23", "label": "options =", "type": "assigned_variable", "loc": [161, 161], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L161_C12", "vector": [14, 6, 0.2072, 0.0013, 6, 0.28, 0.0, 707, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "options", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif bbox: options = 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L162_C8", "label": "s =", "type": "assigned_variable", "loc": [162, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L134_C4", "vector": [14, 2, 0.2104, 0.0051, 2, 0.78, 0.8333, 553, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = {'desc' : 'GeoJSON',\n 'procedure_args' : {'precision' : precision, 'options' : options},\n 'procedure_fmt' : '%(geo_col)s,%(precision)s,%(options)s',\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L166_C8", "label": "return", "type": "return", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L134_C4", "vector": [13, 2, 0.2136, 0.0013, 2, 0.78, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._spatial_attribute('geojson', s, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L168_C4", "label": "geohash", "type": "function", "loc": [168, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.2239, 0.0167, 1, 0.64, 0.35, 766, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "geohash", "arg_names": ["self", "precision", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geohash(self, precision=20, **kwargs):\n \"\"\"\n Returns a GeoHash representation of the given field in a `geohash`\n attribute on each element of the GeoQuerySet.\n\n The `precision` keyword may be used to custom the number of\n _characters_ used in the output GeoHash, the default is 20.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L169_C8", "label": "expression", "type": "expression", "loc": [169, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L168_C4", "vector": [8, 2, 0.2214, 0.009, 2, 0.56, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a GeoHash representation of the given field in a `geohash`\n attribute on each element of the GeoQuerySet.\n\n The `precision` keyword may be used to custom the number of\n _characters_ used in the output GeoHash, the default is 20.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L176_C8", "label": "s =", "type": "assigned_variable", "loc": [176, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L168_C4", "vector": [14, 2, 0.2284, 0.0051, 2, 0.56, 0.5, 553, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = {'desc' : 'GeoHash', \n 'procedure_args': {'precision': precision},\n 'procedure_fmt': '%(geo_col)s,%(precision)s',\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L180_C8", "label": "return", "type": "return", "loc": [180, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L168_C4", "vector": [13, 2, 0.2317, 0.0013, 2, 0.56, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._spatial_attribute('geohash', s, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L182_C4", "label": "gml", "type": "function", "loc": [182, 198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.2445, 0.0219, 1, 0.64, 0.375, 410, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "gml", "arg_names": ["self", "precision", "version", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def gml(self, precision=8, version=2, **kwargs):\n \"\"\"\n Returns GML representation of the given field in a `gml` attribute\n on each element of the GeoQuerySet.\n \"\"\"\n backend = connections[self.db].ops\n s = {'desc' : 'GML', 'procedure_args' : {'precision' : precision}}\n if backend.postgis:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L183_C8", "label": "expression", "type": "expression", "loc": [183, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L182_C4", "vector": [8, 2, 0.2375, 0.0051, 2, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns GML representation of the given field in a `gml` attribute\n on each element of the GeoQuerySet.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L187_C8", "label": "backend =", "type": "assigned_variable", "loc": [187, 187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L182_C4", "vector": [14, 2, 0.2407, 0.0013, 2, 0.41, 0.25, 631, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "backend", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " backend = connections[self.db].ops"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L188_C8", "label": "s =", "type": "assigned_variable", "loc": [188, 188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L182_C4", "vector": [14, 2, 0.242, 0.0013, 2, 0.41, 0.5, 553, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = {'desc' : 'GML', 'procedure_args' : {'precision' : precision}}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L189_C8", "label": "if", "type": "if", "loc": [189, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L182_C4", "vector": [4, 2, 0.2477, 0.0103, 2, 0.41, 0.75, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if backend.postgis:\n # PostGIS AsGML() aggregate function parameter order depends on the\n # version -- uggh.\n if backend.spatial_version > (1, 3, 1):\n procedure_fmt = '%(version)s,%(geo_col)s,%(precision)s'\n else:\n procedure_fmt = '%(geo_col)s,%(precision)s,%(version)s'\n s['procedure_args'] = {'precision' : precision, 'version' : version}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L192_C12", "label": "if", "type": "if", "loc": [192, 195], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L189_C8", "vector": [4, 3, 0.249, 0.0051, 3, 0.27, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if backend.spatial_version > (1, 3, 1):\n procedure_fmt = '%(version)s,%(geo_col)s,%(precision)s'\n else:\n procedure_fmt = '%(geo_col)s,%(precision)s,%(version)s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L193_C16", "label": "procedure_fmt =", "type": "assigned_variable", "loc": [193, 193], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L192_C12", "vector": [14, 4, 0.2484, 0.0013, 4, 0.4, 0.0, 968, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "procedure_fmt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " procedure_fmt = '%(version)s,%(geo_col)s,%(precision)s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L195_C16", "label": "procedure_fmt =", "type": "assigned_variable", "loc": [195, 195], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L192_C12", "vector": [14, 4, 0.251, 0.0013, 4, 0.4, 1.0, 968, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "procedure_fmt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " procedure_fmt = '%(geo_col)s,%(precision)s,%(version)s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L196_C12", "label": "assign", "type": "assigned_variable", "loc": [196, 196], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L189_C8", "vector": [14, 3, 0.2523, 0.0013, 3, 0.27, 1.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s['procedure_args'] = {'precision' : precision, 'version' : version}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L198_C8", "label": "return", "type": "return", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L182_C4", "vector": [13, 2, 0.2548, 0.0013, 2, 0.41, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._spatial_attribute('gml', s, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L200_C4", "label": "intersection", "type": "function", "loc": [200, 206], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.2613, 0.009, 1, 0.64, 0.4, 568, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "intersection", "arg_names": ["self", "geom", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def intersection(self, geom, **kwargs):\n \"\"\"\n Returns the spatial intersection of the Geometry field in\n an `intersection` attribute on each element of this\n GeoQuerySet.\n \"\"\"\n return self._geomset_attribute('intersection', geom, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L201_C8", "label": "expression", "type": "expression", "loc": [201, 205], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L200_C4", "vector": [8, 2, 0.2613, 0.0064, 2, 0.31, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the spatial intersection of the Geometry field in\n an `intersection` attribute on each element of this\n GeoQuerySet.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L206_C8", "label": "return", "type": "return", "loc": [206, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L200_C4", "vector": [13, 2, 0.2651, 0.0013, 2, 0.31, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._geomset_attribute('intersection', geom, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L208_C4", "label": "kml", "type": "function", "loc": [208, 217], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.2735, 0.0129, 1, 0.64, 0.425, 168, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "kml", "arg_names": ["self", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def kml(self, **kwargs):\n \"\"\"\n Returns KML representation of the geometry field in a `kml`\n attribute on each element of this GeoQuerySet.\n \"\"\"\n s = {'desc' : 'KML',\n 'procedure_fmt' : '%(geo_col)s,%(precision)s',\n 'procedure_args' : {'precision' : kwargs.pop('precision', 8)},"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L209_C8", "label": "expression", "type": "expression", "loc": [209, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L208_C4", "vector": [8, 2, 0.2709, 0.0051, 2, 0.32, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns KML representation of the geometry field in a `kml`\n attribute on each element of this GeoQuerySet.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L213_C8", "label": "s =", "type": "assigned_variable", "loc": [213, 216], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L208_C4", "vector": [14, 2, 0.2761, 0.0051, 2, 0.32, 0.5, 553, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = {'desc' : 'KML',\n 'procedure_fmt' : '%(geo_col)s,%(precision)s',\n 'procedure_args' : {'precision' : kwargs.pop('precision', 8)},\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L217_C8", "label": "return", "type": "return", "loc": [217, 217], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L208_C4", "vector": [13, 2, 0.2793, 0.0013, 2, 0.32, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._spatial_attribute('kml', s, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L219_C4", "label": "length", "type": "function", "loc": [219, 224], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.2851, 0.0077, 1, 0.64, 0.45, 221, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "length", "arg_names": ["self", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def length(self, **kwargs):\n \"\"\"\n Returns the length of the geometry field as a `Distance` object\n stored in a `length` attribute on each element of this GeoQuerySet.\n \"\"\"\n return self._distance_attribute('length', None, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L220_C8", "label": "expression", "type": "expression", "loc": [220, 223], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L219_C4", "vector": [8, 2, 0.2851, 0.0051, 2, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the length of the geometry field as a `Distance` object\n stored in a `length` attribute on each element of this GeoQuerySet.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L224_C8", "label": "return", "type": "return", "loc": [224, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L219_C4", "vector": [13, 2, 0.2883, 0.0013, 2, 0.72, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._distance_attribute('length', None, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L226_C4", "label": "make_line", "type": "function", "loc": [226, 232], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.2947, 0.009, 1, 0.64, 0.475, 702, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "make_line", "arg_names": ["self", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def make_line(self, **kwargs):\n \"\"\"\n Creates a linestring from all of the PointField geometries in the\n this GeoQuerySet and returns it. This is a spatial aggregate\n method, and thus returns a geometry rather than a GeoQuerySet.\n \"\"\"\n return self._spatial_aggregate(aggregates.MakeLine, geo_field_type=PointField, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L227_C8", "label": "expression", "type": "expression", "loc": [227, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L226_C4", "vector": [8, 2, 0.2947, 0.0064, 2, 0.09, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Creates a linestring from all of the PointField geometries in the\n this GeoQuerySet and returns it. This is a spatial aggregate\n method, and thus returns a geometry rather than a GeoQuerySet.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L232_C8", "label": "return", "type": "return", "loc": [232, 232], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L226_C4", "vector": [13, 2, 0.2986, 0.0013, 2, 0.09, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._spatial_aggregate(aggregates.MakeLine, geo_field_type=PointField, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L234_C4", "label": "mem_size", "type": "function", "loc": [234, 239], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.3044, 0.0077, 1, 0.64, 0.5, 200, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "mem_size", "arg_names": ["self", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def mem_size(self, **kwargs):\n \"\"\"\n Returns the memory size (number of bytes) that the geometry field takes\n in a `mem_size` attribute on each element of this GeoQuerySet.\n \"\"\"\n return self._spatial_attribute('mem_size', {}, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L235_C8", "label": "expression", "type": "expression", "loc": [235, 238], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L234_C4", "vector": [8, 2, 0.3044, 0.0051, 2, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the memory size (number of bytes) that the geometry field takes\n in a `mem_size` attribute on each element of this GeoQuerySet.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L239_C8", "label": "return", "type": "return", "loc": [239, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L234_C4", "vector": [13, 2, 0.3076, 0.0013, 2, 0.94, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._spatial_attribute('mem_size', {}, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L241_C4", "label": "num_geom", "type": "function", "loc": [241, 248], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.3147, 0.0103, 1, 0.64, 0.525, 574, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "num_geom", "arg_names": ["self", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def num_geom(self, **kwargs):\n \"\"\"\n Returns the number of geometries if the field is a\n GeometryCollection or Multi* Field in a `num_geom`\n attribute on each element of this GeoQuerySet; otherwise\n the sets with None.\n \"\"\"\n return self._spatial_attribute('num_geom', {}, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L242_C8", "label": "expression", "type": "expression", "loc": [242, 247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L241_C4", "vector": [8, 2, 0.3147, 0.0077, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the number of geometries if the field is a\n GeometryCollection or Multi* Field in a `num_geom`\n attribute on each element of this GeoQuerySet; otherwise\n the sets with None.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L248_C8", "label": "return", "type": "return", "loc": [248, 248], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L241_C4", "vector": [13, 2, 0.3192, 0.0013, 2, 0.98, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._spatial_attribute('num_geom', {}, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L250_C4", "label": "num_points", "type": "function", "loc": [250, 256], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.3256, 0.009, 1, 0.64, 0.55, 754, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "num_points", "arg_names": ["self", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def num_points(self, **kwargs):\n \"\"\"\n Returns the number of points in the first linestring in the\n Geometry field in a `num_points` attribute on each element of\n this GeoQuerySet; otherwise sets with None.\n \"\"\"\n return self._spatial_attribute('num_points', {}, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L251_C8", "label": "expression", "type": "expression", "loc": [251, 255], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L250_C4", "vector": [8, 2, 0.3256, 0.0064, 2, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the number of points in the first linestring in the\n Geometry field in a `num_points` attribute on each element of\n this GeoQuerySet; otherwise sets with None.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L256_C8", "label": "return", "type": "return", "loc": [256, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L250_C4", "vector": [13, 2, 0.3295, 0.0013, 2, 0.07, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._spatial_attribute('num_points', {}, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L258_C4", "label": "perimeter", "type": "function", "loc": [258, 263], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.3353, 0.0077, 1, 0.64, 0.575, 896, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "perimeter", "arg_names": ["self", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def perimeter(self, **kwargs):\n \"\"\"\n Returns the perimeter of the geometry field as a `Distance` object\n stored in a `perimeter` attribute on each element of this GeoQuerySet.\n \"\"\"\n return self._distance_attribute('perimeter', None, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L259_C8", "label": "expression", "type": "expression", "loc": [259, 262], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L258_C4", "vector": [8, 2, 0.3353, 0.0051, 2, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the perimeter of the geometry field as a `Distance` object\n stored in a `perimeter` attribute on each element of this GeoQuerySet.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L263_C8", "label": "return", "type": "return", "loc": [263, 263], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L258_C4", "vector": [13, 2, 0.3385, 0.0013, 2, 0.18, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._distance_attribute('perimeter', None, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L265_C4", "label": "point_on_surface", "type": "function", "loc": [265, 271], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.3449, 0.009, 1, 0.64, 0.6, 858, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "point_on_surface", "arg_names": ["self", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def point_on_surface(self, **kwargs):\n \"\"\"\n Returns a Point geometry guaranteed to lie on the surface of the\n Geometry field in a `point_on_surface` attribute on each element\n of this GeoQuerySet; otherwise sets with None.\n \"\"\"\n return self._geom_attribute('point_on_surface', **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L266_C8", "label": "expression", "type": "expression", "loc": [266, 270], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L265_C4", "vector": [8, 2, 0.3449, 0.0064, 2, 0.03, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a Point geometry guaranteed to lie on the surface of the\n Geometry field in a `point_on_surface` attribute on each element\n of this GeoQuerySet; otherwise sets with None.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L271_C8", "label": "return", "type": "return", "loc": [271, 271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L265_C4", "vector": [13, 2, 0.3488, 0.0013, 2, 0.03, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._geom_attribute('point_on_surface', **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L273_C4", "label": "reverse_geom", "type": "function", "loc": [273, 282], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.3571, 0.0129, 1, 0.64, 0.625, 638, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "reverse_geom", "arg_names": ["self", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def reverse_geom(self, **kwargs):\n \"\"\"\n Reverses the coordinate order of the geometry, and attaches as a\n `reverse` attribute on each element of this GeoQuerySet.\n \"\"\"\n s = {'select_field' : GeomField(),}\n kwargs.setdefault('model_att', 'reverse_geom')\n if connections[self.db].ops.oracle:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L274_C8", "label": "expression", "type": "expression", "loc": [274, 277], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L273_C4", "vector": [8, 2, 0.3546, 0.0051, 2, 0.64, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Reverses the coordinate order of the geometry, and attaches as a\n `reverse` attribute on each element of this GeoQuerySet.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L278_C8", "label": "s =", "type": "assigned_variable", "loc": [278, 278], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L273_C4", "vector": [14, 2, 0.3578, 0.0013, 2, 0.64, 0.25, 553, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = {'select_field' : GeomField(),}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L279_C8", "label": "setdefault()", "type": "expression", "loc": [279, 279], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L273_C4", "vector": [8, 2, 0.3591, 0.0013, 2, 0.64, 0.5, 262, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " kwargs.setdefault('model_att', 'reverse_geom')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L280_C8", "label": "if", "type": "if", "loc": [280, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L273_C4", "vector": [4, 2, 0.361, 0.0026, 2, 0.64, 0.75, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if connections[self.db].ops.oracle:\n s['geo_field_type'] = LineStringField"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L281_C12", "label": "assign", "type": "assigned_variable", "loc": [281, 281], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L280_C8", "vector": [14, 3, 0.3616, 0.0013, 3, 0.53, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s['geo_field_type'] = LineStringField"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L282_C8", "label": "return", "type": "return", "loc": [282, 282], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L273_C4", "vector": [13, 2, 0.3629, 0.0013, 2, 0.64, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._spatial_attribute('reverse', s, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L284_C4", "label": "scale", "type": "function", "loc": [284, 301], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.3764, 0.0232, 1, 0.64, 0.65, 18, 0, 5, 1, 0, 0, 0, 4], "semantic": {"name": "scale", "arg_names": ["self", "x", "y", "z", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def scale(self, x, y, z=0.0, **kwargs):\n \"\"\"\n Scales the geometry to a new size by multiplying the ordinates\n with the given x,y,z scale factors.\n \"\"\"\n if connections[self.db].ops.spatialite:\n if z != 0.0:\n raise NotImplementedError('SpatiaLite does not support 3D scaling.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L285_C8", "label": "expression", "type": "expression", "loc": [285, 288], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L284_C4", "vector": [8, 2, 0.3687, 0.0051, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Scales the geometry to a new size by multiplying the ordinates\n with the given x,y,z scale factors.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L289_C8", "label": "if", "type": "if", "loc": [289, 300], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L284_C4", "vector": [4, 2, 0.379, 0.0154, 2, 0.98, 0.5, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if connections[self.db].ops.spatialite:\n if z != 0.0:\n raise NotImplementedError('SpatiaLite does not support 3D scaling.')\n s = {'procedure_fmt' : '%(geo_col)s,%(x)s,%(y)s',\n 'procedure_args' : {'x' : x, 'y' : y},\n 'select_field' : GeomField(),\n }\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L290_C12", "label": "if", "type": "if", "loc": [290, 291], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L289_C8", "vector": [4, 3, 0.3739, 0.0026, 3, 0.76, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if z != 0.0:\n raise NotImplementedError('SpatiaLite does not support 3D scaling.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L292_C12", "label": "s =", "type": "assigned_variable", "loc": [292, 295], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L289_C8", "vector": [14, 3, 0.3777, 0.0051, 3, 0.76, 0.5, 553, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = {'procedure_fmt' : '%(geo_col)s,%(x)s,%(y)s',\n 'procedure_args' : {'x' : x, 'y' : y},\n 'select_field' : GeomField(),\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L297_C12", "label": "s =", "type": "assigned_variable", "loc": [297, 300], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L289_C8", "vector": [14, 3, 0.3842, 0.0051, 3, 0.76, 1.0, 553, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = {'procedure_fmt' : '%(geo_col)s,%(x)s,%(y)s,%(z)s',\n 'procedure_args' : {'x' : x, 'y' : y, 'z' : z},\n 'select_field' : GeomField(),\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L301_C8", "label": "return", "type": "return", "loc": [301, 301], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L284_C4", "vector": [13, 2, 0.3874, 0.0013, 2, 0.98, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._spatial_attribute('scale', s, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L303_C4", "label": "snap_to_grid", "type": "function", "loc": [303, 337], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.4118, 0.045, 1, 0.64, 0.675, 324, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "snap_to_grid", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def snap_to_grid(self, *args, **kwargs):\n \"\"\"\n Snap all points of the input geometry to the grid. How the\n geometry is snapped to the grid depends on how many arguments\n were given:\n - 1 argument : A single size to snap both the X and Y grids to.\n - 2 arguments: X and Y sizes to snap the grid to.\n - 4 arguments: X, Y sizes and the X, Y origins."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L304_C8", "label": "expression", "type": "expression", "loc": [304, 311], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L303_C4", "vector": [8, 2, 0.3958, 0.0103, 2, 0.63, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Snap all points of the input geometry to the grid. How the\n geometry is snapped to the grid depends on how many arguments\n were given:\n - 1 argument : A single size to snap both the X and Y grids to.\n - 2 arguments: X and Y sizes to snap the grid to.\n - 4 arguments: X, Y sizes and the X, Y origins.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L312_C8", "label": "if", "type": "if", "loc": [312, 313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L303_C4", "vector": [4, 2, 0.4022, 0.0026, 2, 0.63, 0.2, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if False in [isinstance(arg, (float, int, long)) for arg in args]:\n raise TypeError('Size argument(s) for the grid must be a float or integer values.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L315_C8", "label": "nargs = len()", "type": "assigned_variable", "loc": [315, 315], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L303_C4", "vector": [14, 2, 0.4054, 0.0013, 2, 0.63, 0.4, 689, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "nargs", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " nargs = len(args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L316_C8", "label": "if", "type": "if", "loc": [316, 330], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L303_C4", "vector": [4, 2, 0.4157, 0.0193, 2, 0.63, 0.6, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if nargs == 1:\n size = args[0]\n procedure_fmt = '%(geo_col)s,%(size)s'\n procedure_args = {'size' : size}\n elif nargs == 2:\n xsize, ysize = args\n procedure_fmt = '%(geo_col)s,%(xsize)s,%(ysize)s'\n procedure_args = {'xsize' : xsize, 'ysize' : ysize}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L317_C12", "label": "size =", "type": "assigned_variable", "loc": [317, 317], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L316_C8", "vector": [14, 3, 0.408, 0.0013, 3, 0.05, 0.0, 714, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "size", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " size = args[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L318_C12", "label": "procedure_fmt =", "type": "assigned_variable", "loc": [318, 318], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L316_C8", "vector": [14, 3, 0.4093, 0.0013, 3, 0.05, 0.3333, 968, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "procedure_fmt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " procedure_fmt = '%(geo_col)s,%(size)s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L319_C12", "label": "procedure_args =", "type": "assigned_variable", "loc": [319, 319], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L316_C8", "vector": [14, 3, 0.4106, 0.0013, 3, 0.05, 0.6667, 427, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "procedure_args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " procedure_args = {'size' : size}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L320_C8", "label": "if", "type": "if", "loc": [320, 330], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L316_C8", "vector": [4, 3, 0.4183, 0.0142, 3, 0.05, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nargs == 2:\n xsize, ysize = args\n procedure_fmt = '%(geo_col)s,%(xsize)s,%(ysize)s'\n procedure_args = {'xsize' : xsize, 'ysize' : ysize}\n elif nargs == 4:\n xsize, ysize, xorigin, yorigin = args\n procedure_fmt = '%(geo_col)s,%(xorigin)s,%(yorigin)s,%(xsize)s,%(ysize)s'\n procedure_args = {'xsize' : xsize, 'ysize' : ysize,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L321_C12", "label": "xsize, ysize =", "type": "assigned_variable", "loc": [321, 321], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L320_C8", "vector": [14, 4, 0.4131, 0.0013, 4, 0.13, 0.0, 139, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "xsize, ysize", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xsize, ysize = args"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L322_C12", "label": "procedure_fmt =", "type": "assigned_variable", "loc": [322, 322], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L320_C8", "vector": [14, 4, 0.4144, 0.0013, 4, 0.13, 0.3333, 968, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "procedure_fmt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " procedure_fmt = '%(geo_col)s,%(xsize)s,%(ysize)s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L323_C12", "label": "procedure_args =", "type": "assigned_variable", "loc": [323, 323], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L320_C8", "vector": [14, 4, 0.4157, 0.0013, 4, 0.13, 0.6667, 427, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "procedure_args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " procedure_args = {'xsize' : xsize, 'ysize' : ysize}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L324_C8", "label": "if", "type": "if", "loc": [324, 330], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L320_C8", "vector": [4, 4, 0.4208, 0.009, 4, 0.13, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nargs == 4:\n xsize, ysize, xorigin, yorigin = args\n procedure_fmt = '%(geo_col)s,%(xorigin)s,%(yorigin)s,%(xsize)s,%(ysize)s'\n procedure_args = {'xsize' : xsize, 'ysize' : ysize,\n 'xorigin' : xorigin, 'yorigin' : yorigin}\n else:\n raise ValueError('Must provide 1, 2, or 4 arguments to `snap_to_grid`.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L325_C12", "label": "xsize, ysize, xorigin, yorigin =", "type": "assigned_variable", "loc": [325, 325], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L324_C8", "vector": [14, 5, 0.4183, 0.0013, 5, 0.39, 0.0, 257, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "xsize, ysize, xorigin, yorigin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xsize, ysize, xorigin, yorigin = args"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L326_C12", "label": "procedure_fmt =", "type": "assigned_variable", "loc": [326, 326], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L324_C8", "vector": [14, 5, 0.4196, 0.0013, 5, 0.39, 0.5, 968, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "procedure_fmt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " procedure_fmt = '%(geo_col)s,%(xorigin)s,%(yorigin)s,%(xsize)s,%(ysize)s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L327_C12", "label": "procedure_args =", "type": "assigned_variable", "loc": [327, 328], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L324_C8", "vector": [14, 5, 0.4215, 0.0026, 5, 0.39, 1.0, 427, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "procedure_args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " procedure_args = {'xsize' : xsize, 'ysize' : ysize,\n 'xorigin' : xorigin, 'yorigin' : yorigin}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L332_C8", "label": "s =", "type": "assigned_variable", "loc": [332, 335], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L303_C4", "vector": [14, 2, 0.4292, 0.0051, 2, 0.63, 0.8, 553, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = {'procedure_fmt' : procedure_fmt,\n 'procedure_args' : procedure_args,\n 'select_field' : GeomField(),\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L337_C8", "label": "return", "type": "return", "loc": [337, 337], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L303_C4", "vector": [13, 2, 0.4337, 0.0013, 2, 0.63, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._spatial_attribute('snap_to_grid', s, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L339_C4", "label": "svg", "type": "function", "loc": [339, 360], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.4498, 0.0283, 1, 0.64, 0.7, 873, 0, 4, 1, 0, 0, 0, 5], "semantic": {"name": "svg", "arg_names": ["self", "relative", "precision", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def svg(self, relative=False, precision=8, **kwargs):\n \"\"\"\n Returns SVG representation of the geographic field in a `svg`\n attribute on each element of this GeoQuerySet.\n\n Keyword Arguments:\n `relative` => If set to True, this will evaluate the path in\n terms of relative moves (rather than absolute)."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L340_C8", "label": "expression", "type": "expression", "loc": [340, 350], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L339_C4", "vector": [8, 2, 0.444, 0.0142, 2, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns SVG representation of the geographic field in a `svg`\n attribute on each element of this GeoQuerySet.\n\n Keyword Arguments:\n `relative` => If set to True, this will evaluate the path in\n terms of relative moves (rather than absolute).\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L351_C8", "label": "relative = int()", "type": "assigned_variable", "loc": [351, 351], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L339_C4", "vector": [14, 2, 0.4517, 0.0013, 2, 0.49, 0.25, 255, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "relative", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " relative = int(bool(relative))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L352_C8", "label": "if", "type": "if", "loc": [352, 353], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L339_C4", "vector": [4, 2, 0.4537, 0.0026, 2, 0.49, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(precision, (int, long)):\n raise TypeError('SVG precision keyword argument must be an integer.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L354_C8", "label": "s =", "type": "assigned_variable", "loc": [354, 359], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L339_C4", "vector": [14, 2, 0.4588, 0.0077, 2, 0.49, 0.75, 553, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = {'desc' : 'SVG',\n 'procedure_fmt' : '%(geo_col)s,%(rel)s,%(precision)s',\n 'procedure_args' : {'rel' : relative,\n 'precision' : precision,\n }\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L360_C8", "label": "return", "type": "return", "loc": [360, 360], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L339_C4", "vector": [13, 2, 0.4633, 0.0013, 2, 0.49, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._spatial_attribute('svg', s, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L362_C4", "label": "sym_difference", "type": "function", "loc": [362, 367], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.4691, 0.0077, 1, 0.64, 0.725, 37, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "sym_difference", "arg_names": ["self", "geom", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def sym_difference(self, geom, **kwargs):\n \"\"\"\n Returns the symmetric difference of the geographic field in a\n `sym_difference` attribute on each element of this GeoQuerySet.\n \"\"\"\n return self._geomset_attribute('sym_difference', geom, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L363_C8", "label": "expression", "type": "expression", "loc": [363, 366], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L362_C4", "vector": [8, 2, 0.4691, 0.0051, 2, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the symmetric difference of the geographic field in a\n `sym_difference` attribute on each element of this GeoQuerySet.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L367_C8", "label": "return", "type": "return", "loc": [367, 367], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L362_C4", "vector": [13, 2, 0.4723, 0.0013, 2, 0.83, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._geomset_attribute('sym_difference', geom, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L369_C4", "label": "translate", "type": "function", "loc": [369, 386], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.4858, 0.0232, 1, 0.64, 0.75, 384, 0, 5, 1, 0, 0, 0, 4], "semantic": {"name": "translate", "arg_names": ["self", "x", "y", "z", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def translate(self, x, y, z=0.0, **kwargs):\n \"\"\"\n Translates the geometry to a new location using the given numeric\n parameters as offsets.\n \"\"\"\n if connections[self.db].ops.spatialite:\n if z != 0.0:\n raise NotImplementedError('SpatiaLite does not support 3D translation.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L370_C8", "label": "expression", "type": "expression", "loc": [370, 373], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L369_C4", "vector": [8, 2, 0.4781, 0.0051, 2, 0.22, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Translates the geometry to a new location using the given numeric\n parameters as offsets.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L374_C8", "label": "if", "type": "if", "loc": [374, 385], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L369_C4", "vector": [4, 2, 0.4884, 0.0154, 2, 0.22, 0.5, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if connections[self.db].ops.spatialite:\n if z != 0.0:\n raise NotImplementedError('SpatiaLite does not support 3D translation.')\n s = {'procedure_fmt' : '%(geo_col)s,%(x)s,%(y)s',\n 'procedure_args' : {'x' : x, 'y' : y},\n 'select_field' : GeomField(),\n }\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L375_C12", "label": "if", "type": "if", "loc": [375, 376], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L374_C8", "vector": [4, 3, 0.4833, 0.0026, 3, 0.2, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if z != 0.0:\n raise NotImplementedError('SpatiaLite does not support 3D translation.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L377_C12", "label": "s =", "type": "assigned_variable", "loc": [377, 380], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L374_C8", "vector": [14, 3, 0.4871, 0.0051, 3, 0.2, 0.5, 553, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = {'procedure_fmt' : '%(geo_col)s,%(x)s,%(y)s',\n 'procedure_args' : {'x' : x, 'y' : y},\n 'select_field' : GeomField(),\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L382_C12", "label": "s =", "type": "assigned_variable", "loc": [382, 385], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L374_C8", "vector": [14, 3, 0.4936, 0.0051, 3, 0.2, 1.0, 553, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = {'procedure_fmt' : '%(geo_col)s,%(x)s,%(y)s,%(z)s',\n 'procedure_args' : {'x' : x, 'y' : y, 'z' : z},\n 'select_field' : GeomField(),\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L386_C8", "label": "return", "type": "return", "loc": [386, 386], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L369_C4", "vector": [13, 2, 0.4968, 0.0013, 2, 0.22, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._spatial_attribute('translate', s, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L388_C4", "label": "transform", "type": "function", "loc": [388, 414], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.5161, 0.0347, 1, 0.64, 0.775, 48, 0, 3, 1, 0, 0, 0, 7], "semantic": {"name": "transform", "arg_names": ["self", "srid", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def transform(self, srid=4326, **kwargs):\n \"\"\"\n Transforms the given geometry field to the given SRID. If no SRID is\n provided, the transformation will default to using 4326 (WGS84).\n \"\"\"\n if not isinstance(srid, (int, long)):\n raise TypeError('An integer SRID must be provided.')\n field_name = kwargs.get('field_name', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L389_C8", "label": "expression", "type": "expression", "loc": [389, 392], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L388_C4", "vector": [8, 2, 0.5026, 0.0051, 2, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Transforms the given geometry field to the given SRID. If no SRID is\n provided, the transformation will default to using 4326 (WGS84).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L393_C8", "label": "if", "type": "if", "loc": [393, 394], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L388_C4", "vector": [4, 2, 0.5064, 0.0026, 2, 0.54, 0.1111, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(srid, (int, long)):\n raise TypeError('An integer SRID must be provided.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L395_C8", "label": "field_name = get()", "type": "assigned_variable", "loc": [395, 395], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L388_C4", "vector": [14, 2, 0.5084, 0.0013, 2, 0.54, 0.2222, 918, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "field_name", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " field_name = kwargs.get('field_name', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L396_C8", "label": "tmp, geo_field = _spatial_setup()", "type": "assigned_variable", "loc": [396, 396], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L388_C4", "vector": [14, 2, 0.5097, 0.0013, 2, 0.54, 0.3333, 693, 3, 2, 0, 0, 694, 10, 1], "semantic": {"name": "tmp, geo_field", "arg_names": [], "import_names": [], "rhs_call_name": "_spatial_setup", "annotation": ""}, "snippet": " tmp, geo_field = self._spatial_setup('transform', field_name=field_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L399_C8", "label": "field_col = _geocol_select()", "type": "assigned_variable", "loc": [399, 399], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L388_C4", "vector": [14, 2, 0.5135, 0.0013, 2, 0.54, 0.4444, 283, 3, 2, 0, 0, 628, 10, 1], "semantic": {"name": "field_col", "arg_names": [], "import_names": [], "rhs_call_name": "_geocol_select", "annotation": ""}, "snippet": " field_col = self._geocol_select(geo_field, field_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L405_C8", "label": "geo_col = get()", "type": "assigned_variable", "loc": [405, 405], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L388_C4", "vector": [14, 2, 0.5212, 0.0013, 2, 0.54, 0.5556, 139, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "geo_col", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " geo_col = self.query.custom_select.get(geo_field, field_col)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L409_C8", "label": "custom_sel =", "type": "assigned_variable", "loc": [409, 409], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L388_C4", "vector": [14, 2, 0.5264, 0.0013, 2, 0.54, 0.6667, 277, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "custom_sel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " custom_sel = '%s(%s, %s)' % (connections[self.db].ops.transform, geo_col, srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L412_C8", "label": "self.query.transformed_srid =", "type": "assigned_variable", "loc": [412, 412], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L388_C4", "vector": [14, 2, 0.5302, 0.0013, 2, 0.54, 0.7778, 617, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.query.transformed_srid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.query.transformed_srid = srid # So other GeoQuerySet methods"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L413_C8", "label": "assign", "type": "assigned_variable", "loc": [413, 413], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L388_C4", "vector": [14, 2, 0.5315, 0.0013, 2, 0.54, 0.8889, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.query.custom_select[geo_field] = custom_sel"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L414_C8", "label": "return", "type": "return", "loc": [414, 414], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L388_C4", "vector": [13, 2, 0.5328, 0.0013, 2, 0.54, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._clone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L416_C4", "label": "union", "type": "function", "loc": [416, 421], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.5386, 0.0077, 1, 0.64, 0.8, 140, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "union", "arg_names": ["self", "geom", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def union(self, geom, **kwargs):\n \"\"\"\n Returns the union of the geographic field with the given\n Geometry in a `union` attribute on each element of this GeoQuerySet.\n \"\"\"\n return self._geomset_attribute('union', geom, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L417_C8", "label": "expression", "type": "expression", "loc": [417, 420], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L416_C4", "vector": [8, 2, 0.5386, 0.0051, 2, 0.92, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the union of the geographic field with the given\n Geometry in a `union` attribute on each element of this GeoQuerySet.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L421_C8", "label": "return", "type": "return", "loc": [421, 421], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L416_C4", "vector": [13, 2, 0.5418, 0.0013, 2, 0.92, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._geomset_attribute('union', geom, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L423_C4", "label": "unionagg", "type": "function", "loc": [423, 429], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.5483, 0.009, 1, 0.64, 0.825, 886, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "unionagg", "arg_names": ["self", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def unionagg(self, **kwargs):\n \"\"\"\n Performs an aggregate union on the given geometry field. Returns\n None if the GeoQuerySet is empty. The `tolerance` keyword is for\n Oracle backends only.\n \"\"\"\n return self._spatial_aggregate(aggregates.Union, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L424_C8", "label": "expression", "type": "expression", "loc": [424, 428], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L423_C4", "vector": [8, 2, 0.5483, 0.0064, 2, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Performs an aggregate union on the given geometry field. Returns\n None if the GeoQuerySet is empty. The `tolerance` keyword is for\n Oracle backends only.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L429_C8", "label": "return", "type": "return", "loc": [429, 429], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L423_C4", "vector": [13, 2, 0.5521, 0.0013, 2, 0.13, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._spatial_aggregate(aggregates.Union, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L432_C4", "label": "_spatial_setup", "type": "function", "loc": [432, 462], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.5753, 0.0399, 1, 0.64, 0.85, 694, 0, 5, 1, 0, 0, 0, 7], "semantic": {"name": "_spatial_setup", "arg_names": ["self", "att", "desc", "field_name", "geo_field_type"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _spatial_setup(self, att, desc=None, field_name=None, geo_field_type=None):\n \"\"\"\n Performs set up for executing the spatial function.\n \"\"\"\n # Does the spatial backend support this?\n connection = connections[self.db]\n func = getattr(connection.ops, att, False)\n if desc is None: desc = att"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L433_C8", "label": "expression", "type": "expression", "loc": [433, 435], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L432_C4", "vector": [8, 2, 0.5586, 0.0039, 2, 0.71, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Performs set up for executing the spatial function.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L437_C8", "label": "connection =", "type": "assigned_variable", "loc": [437, 437], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L432_C4", "vector": [14, 2, 0.5624, 0.0013, 2, 0.71, 0.1, 351, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "connection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " connection = connections[self.db]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L438_C8", "label": "func = getattr()", "type": "assigned_variable", "loc": [438, 438], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L432_C4", "vector": [14, 2, 0.5637, 0.0013, 2, 0.71, 0.2, 856, 3, 3, 0, 0, 121, 10, 1], "semantic": {"name": "func", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " func = getattr(connection.ops, att, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L439_C8", "label": "if", "type": "if", "loc": [439, 439], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L432_C4", "vector": [4, 2, 0.565, 0.0013, 2, 0.71, 0.3, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if desc is None: desc = att"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L439_C25", "label": "desc =", "type": "assigned_variable", "loc": [439, 439], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L439_C8", "vector": [14, 3, 0.565, 0.0013, 3, 0.2, 0.0, 796, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "desc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if desc is None: desc = att"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L440_C8", "label": "if", "type": "if", "loc": [440, 443], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L432_C4", "vector": [4, 2, 0.5682, 0.0051, 2, 0.71, 0.4, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not func:\n raise NotImplementedError('%s stored procedure not available on '\n 'the %s backend.' %\n (desc, connection.ops.name))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L446_C8", "label": "procedure_args =", "type": "assigned_variable", "loc": [446, 446], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L432_C4", "vector": [14, 2, 0.574, 0.0013, 2, 0.71, 0.5, 427, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "procedure_args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " procedure_args = {'function' : func}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L450_C8", "label": "geo_field = _geo_field()", "type": "assigned_variable", "loc": [450, 450], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L432_C4", "vector": [14, 2, 0.5792, 0.0013, 2, 0.71, 0.6, 24, 3, 1, 0, 0, 123, 10, 1], "semantic": {"name": "geo_field", "arg_names": [], "import_names": [], "rhs_call_name": "_geo_field", "annotation": ""}, "snippet": " geo_field = self.query._geo_field(field_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L451_C8", "label": "if", "type": "if", "loc": [451, 452], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L432_C4", "vector": [4, 2, 0.5811, 0.0026, 2, 0.71, 0.7, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not geo_field:\n raise TypeError('%s output only available on GeometryFields.' % func)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L456_C8", "label": "if", "type": "if", "loc": [456, 457], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L432_C4", "vector": [4, 2, 0.5875, 0.0026, 2, 0.71, 0.8, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not geo_field_type is None and not isinstance(geo_field, geo_field_type):\n raise TypeError('\"%s\" stored procedures may only be called on %ss.' % (func, geo_field_type.__name__))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L460_C8", "label": " = _geocol_select()", "type": "assigned_variable", "loc": [460, 460], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L432_C4", "vector": [14, 2, 0.592, 0.0013, 2, 0.71, 0.9, 0, 3, 2, 0, 0, 628, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "_geocol_select", "annotation": ""}, "snippet": " procedure_args['geo_col'] = self._geocol_select(geo_field, field_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L462_C8", "label": "return", "type": "return", "loc": [462, 462], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L432_C4", "vector": [13, 2, 0.5946, 0.0013, 2, 0.71, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return procedure_args, geo_field"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L464_C4", "label": "_spatial_aggregate", "type": "function", "loc": [464, 490], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.6139, 0.0347, 1, 0.64, 0.875, 912, 0, 5, 1, 0, 0, 0, 6], "semantic": {"name": "_spatial_aggregate", "arg_names": ["self", "aggregate", "field_name", "geo_field_type", "tolerance"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _spatial_aggregate(self, aggregate, field_name=None,\n geo_field_type=None, tolerance=0.05):\n \"\"\"\n DRY routine for calling aggregate spatial stored procedures and\n returning their result to the caller of the function.\n \"\"\"\n # Getting the field the geographic aggregate will be called on.\n geo_field = self.query._geo_field(field_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L466_C8", "label": "expression", "type": "expression", "loc": [466, 469], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L464_C4", "vector": [8, 2, 0.6017, 0.0051, 2, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n DRY routine for calling aggregate spatial stored procedures and\n returning their result to the caller of the function.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L471_C8", "label": "geo_field = _geo_field()", "type": "assigned_variable", "loc": [471, 471], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L464_C4", "vector": [14, 2, 0.6062, 0.0013, 2, 0.46, 0.1429, 24, 3, 1, 0, 0, 123, 10, 1], "semantic": {"name": "geo_field", "arg_names": [], "import_names": [], "rhs_call_name": "_geo_field", "annotation": ""}, "snippet": " geo_field = self.query._geo_field(field_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L472_C8", "label": "if", "type": "if", "loc": [472, 473], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L464_C4", "vector": [4, 2, 0.6081, 0.0026, 2, 0.46, 0.2857, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not geo_field:\n raise TypeError('%s aggregate only available on GeometryFields.' % aggregate.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L477_C8", "label": "if", "type": "if", "loc": [477, 478], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L464_C4", "vector": [4, 2, 0.6145, 0.0026, 2, 0.46, 0.4286, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not geo_field_type is None and not isinstance(geo_field, geo_field_type):\n raise TypeError('%s aggregate may only be called on %ss.' % (aggregate.name, geo_field_type.__name__))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L482_C8", "label": "agg_col =", "type": "assigned_variable", "loc": [482, 482], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L464_C4", "vector": [14, 2, 0.6203, 0.0013, 2, 0.46, 0.5714, 353, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "agg_col", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " agg_col = field_name or geo_field.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L486_C8", "label": "agg_kwargs =", "type": "assigned_variable", "loc": [486, 486], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L464_C4", "vector": [14, 2, 0.6255, 0.0013, 2, 0.46, 0.7143, 69, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "agg_kwargs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " agg_kwargs = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L487_C8", "label": "if", "type": "if", "loc": [487, 487], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L464_C4", "vector": [4, 2, 0.6268, 0.0013, 2, 0.46, 0.8571, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if connections[self.db].ops.oracle: agg_kwargs['tolerance'] = tolerance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L487_C44", "label": "assign", "type": "assigned_variable", "loc": [487, 487], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L487_C8", "vector": [14, 3, 0.6268, 0.0013, 3, 0.07, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if connections[self.db].ops.oracle: agg_kwargs['tolerance'] = tolerance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L490_C8", "label": "return", "type": "return", "loc": [490, 490], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L464_C4", "vector": [13, 2, 0.6306, 0.0013, 2, 0.46, 1.0, 0, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.aggregate(geoagg=aggregate(agg_col, **agg_kwargs))['geoagg']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "label": "_spatial_attribute", "type": "function", "loc": [492, 569], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.6828, 0.1004, 1, 0.64, 0.9, 182, 0, 5, 1, 0, 0, 0, 20], "semantic": {"name": "_spatial_attribute", "arg_names": ["self", "att", "settings", "field_name", "model_att"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _spatial_attribute(self, att, settings, field_name=None, model_att=None):\n \"\"\"\n DRY routine for calling a spatial stored procedure on a geometry column\n and attaching its output as an attribute of the model.\n\n Arguments:\n att:\n The name of the spatial attribute that holds the spatial"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L493_C8", "label": "expression", "type": "expression", "loc": [493, 515], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "vector": [8, 2, 0.6486, 0.0296, 2, 0.96, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n DRY routine for calling a spatial stored procedure on a geometry column\n and attaching its output as an attribute of the model.\n\n Arguments:\n att:\n The name of the spatial attribute that holds the spatial\n SQL function to call."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L517_C8", "label": "setdefault()", "type": "expression", "loc": [517, 517], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "vector": [8, 2, 0.6654, 0.0013, 2, 0.96, 0.0714, 262, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " settings.setdefault('desc', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L518_C8", "label": "setdefault()", "type": "expression", "loc": [518, 518], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "vector": [8, 2, 0.6667, 0.0013, 2, 0.96, 0.1429, 262, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " settings.setdefault('geom_args', ())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L519_C8", "label": "setdefault()", "type": "expression", "loc": [519, 519], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "vector": [8, 2, 0.668, 0.0013, 2, 0.96, 0.2143, 262, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " settings.setdefault('geom_field', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L520_C8", "label": "setdefault()", "type": "expression", "loc": [520, 520], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "vector": [8, 2, 0.6692, 0.0013, 2, 0.96, 0.2857, 262, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " settings.setdefault('procedure_args', {})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L521_C8", "label": "setdefault()", "type": "expression", "loc": [521, 521], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "vector": [8, 2, 0.6705, 0.0013, 2, 0.96, 0.3571, 262, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " settings.setdefault('procedure_fmt', '%(geo_col)s')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L522_C8", "label": "setdefault()", "type": "expression", "loc": [522, 522], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "vector": [8, 2, 0.6718, 0.0013, 2, 0.96, 0.4286, 262, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " settings.setdefault('select_params', [])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L524_C8", "label": "connection =", "type": "assigned_variable", "loc": [524, 524], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "vector": [14, 2, 0.6744, 0.0013, 2, 0.96, 0.5, 351, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "connection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " connection = connections[self.db]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L525_C8", "label": "backend =", "type": "assigned_variable", "loc": [525, 525], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "vector": [14, 2, 0.6757, 0.0013, 2, 0.96, 0.5714, 631, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "backend", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " backend = connection.ops"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L528_C8", "label": "if", "type": "if", "loc": [528, 533], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "vector": [4, 2, 0.6828, 0.0077, 2, 0.96, 0.6429, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if settings.get('setup', True):\n default_args, geo_field = self._spatial_setup(att, desc=settings['desc'], field_name=field_name,\n geo_field_type=settings.get('geo_field_type', None))\n for k, v in default_args.iteritems(): settings['procedure_args'].setdefault(k, v)\n else:\n geo_field = settings['geo_field']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L529_C12", "label": "default_args, geo_field = _spatial_setup()", "type": "assigned_variable", "loc": [529, 530], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L528_C8", "vector": [14, 3, 0.6815, 0.0026, 3, 0.25, 0.0, 967, 3, 4, 0, 0, 694, 10, 2], "semantic": {"name": "default_args, geo_field", "arg_names": [], "import_names": [], "rhs_call_name": "_spatial_setup", "annotation": ""}, "snippet": " default_args, geo_field = self._spatial_setup(att, desc=settings['desc'], field_name=field_name,\n geo_field_type=settings.get('geo_field_type', None))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:For_L531_C12", "label": "for k, v", "type": "for", "loc": [531, 531], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L528_C8", "vector": [6, 3, 0.6834, 0.0013, 3, 0.25, 0.5, 867, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in default_args.iteritems(): settings['procedure_args'].setdefault(k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L531_C50", "label": "setdefault()", "type": "expression", "loc": [531, 531], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:For_L531_C12", "vector": [8, 4, 0.6834, 0.0013, 4, 0.77, 0.0, 262, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " for k, v in default_args.iteritems(): settings['procedure_args'].setdefault(k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L533_C12", "label": "geo_field =", "type": "assigned_variable", "loc": [533, 533], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L528_C8", "vector": [14, 3, 0.686, 0.0013, 3, 0.25, 1.0, 24, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geo_field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geo_field = settings['geo_field']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L536_C8", "label": "if", "type": "if", "loc": [536, 536], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "vector": [4, 2, 0.6898, 0.0013, 2, 0.96, 0.7143, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(model_att, basestring): model_att = att"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L536_C50", "label": "model_att =", "type": "assigned_variable", "loc": [536, 536], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L536_C8", "vector": [14, 3, 0.6898, 0.0013, 3, 0.36, 0.0, 647, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "model_att", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(model_att, basestring): model_att = att"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:For_L539_C8", "label": "for name", "type": "for", "loc": [539, 551], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "vector": [6, 2, 0.7014, 0.0167, 2, 0.96, 0.7857, 57, 6, 0, 0, 0, 0, 0, 5], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for name in settings['geom_args']:\n # Using the field's get_placeholder() routine to get any needed\n # transformation SQL.\n geom = geo_field.get_prep_value(settings['procedure_args'][name])\n params = geo_field.get_db_prep_lookup('contains', geom, connection=connection)\n geom_placeholder = geo_field.get_placeholder(geom, connection)\n\n # Replacing the procedure format with that of any needed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L542_C12", "label": "geom = get_prep_value()", "type": "assigned_variable", "loc": [542, 542], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:For_L539_C8", "vector": [14, 3, 0.6976, 0.0013, 3, 0.24, 0.0, 5, 3, 1, 0, 0, 109, 10, 1], "semantic": {"name": "geom", "arg_names": [], "import_names": [], "rhs_call_name": "get_prep_value", "annotation": ""}, "snippet": " geom = geo_field.get_prep_value(settings['procedure_args'][name])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L543_C12", "label": "params = get_db_prep_lookup()", "type": "assigned_variable", "loc": [543, 543], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:For_L539_C8", "vector": [14, 3, 0.6988, 0.0013, 3, 0.24, 0.1667, 206, 3, 3, 0, 0, 681, 10, 1], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "get_db_prep_lookup", "annotation": ""}, "snippet": " params = geo_field.get_db_prep_lookup('contains', geom, connection=connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L544_C12", "label": "geom_placeholder = get_placeholder()", "type": "assigned_variable", "loc": [544, 544], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:For_L539_C8", "vector": [14, 3, 0.7001, 0.0013, 3, 0.24, 0.3333, 293, 3, 2, 0, 0, 571, 10, 1], "semantic": {"name": "geom_placeholder", "arg_names": [], "import_names": [], "rhs_call_name": "get_placeholder", "annotation": ""}, "snippet": " geom_placeholder = geo_field.get_placeholder(geom, connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L548_C12", "label": "old_fmt =", "type": "assigned_variable", "loc": [548, 548], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:For_L539_C8", "vector": [14, 3, 0.7053, 0.0013, 3, 0.24, 0.5, 463, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "old_fmt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_fmt = '%%(%s)s' % name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L549_C12", "label": "new_fmt =", "type": "assigned_variable", "loc": [549, 549], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:For_L539_C8", "vector": [14, 3, 0.7066, 0.0013, 3, 0.24, 0.6667, 733, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "new_fmt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_fmt = geom_placeholder % '%%s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L550_C12", "label": " = replace()", "type": "assigned_variable", "loc": [550, 550], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:For_L539_C8", "vector": [14, 3, 0.7079, 0.0013, 3, 0.24, 0.8333, 0, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " settings['procedure_fmt'] = settings['procedure_fmt'].replace(old_fmt, new_fmt)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L551_C12", "label": "extend()", "type": "expression", "loc": [551, 551], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:For_L539_C8", "vector": [8, 3, 0.7091, 0.0013, 3, 0.24, 1.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " settings['select_params'].extend(params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L554_C8", "label": "fmt =", "type": "assigned_variable", "loc": [554, 554], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "vector": [14, 2, 0.713, 0.0013, 2, 0.96, 0.8571, 913, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fmt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fmt = '%%(function)s(%s)' % settings['procedure_fmt']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L557_C8", "label": "if", "type": "if", "loc": [557, 563], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "vector": [4, 2, 0.7207, 0.009, 2, 0.96, 0.9286, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if settings.get('select_field', False):\n sel_fld = settings['select_field']\n if isinstance(sel_fld, GeomField) and backend.select:\n self.query.custom_select[model_att] = backend.select\n if connection.ops.oracle:\n sel_fld.empty_strings_allowed = False\n self.query.extra_select_fields[model_att] = sel_fld"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L558_C12", "label": "sel_fld =", "type": "assigned_variable", "loc": [558, 558], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L557_C8", "vector": [14, 3, 0.7181, 0.0013, 3, 0.43, 0.0, 567, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sel_fld", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sel_fld = settings['select_field']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L559_C12", "label": "if", "type": "if", "loc": [559, 560], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L557_C8", "vector": [4, 3, 0.7201, 0.0026, 3, 0.43, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(sel_fld, GeomField) and backend.select:\n self.query.custom_select[model_att] = backend.select"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L560_C16", "label": "assign", "type": "assigned_variable", "loc": [560, 560], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L559_C12", "vector": [14, 4, 0.7207, 0.0013, 4, 0.33, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.query.custom_select[model_att] = backend.select"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L561_C12", "label": "if", "type": "if", "loc": [561, 562], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L557_C8", "vector": [4, 3, 0.7227, 0.0026, 3, 0.43, 0.6667, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if connection.ops.oracle:\n sel_fld.empty_strings_allowed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L562_C16", "label": "sel_fld.empty_strings_allowed =", "type": "assigned_variable", "loc": [562, 562], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L561_C12", "vector": [14, 4, 0.7233, 0.0013, 4, 0.19, 0.0, 763, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "sel_fld.empty_strings_allowed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sel_fld.empty_strings_allowed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L563_C12", "label": "assign", "type": "assigned_variable", "loc": [563, 563], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L557_C8", "vector": [14, 3, 0.7246, 0.0013, 3, 0.43, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.query.extra_select_fields[model_att] = sel_fld"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L568_C8", "label": "return", "type": "return", "loc": [568, 569], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "vector": [13, 2, 0.7317, 0.0026, 2, 0.96, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.extra(select={model_att : fmt % settings['procedure_args']},\n select_params=settings['select_params'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "label": "_distance_attribute", "type": "function", "loc": [571, 714], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.8269, 0.1853, 1, 0.64, 0.925, 677, 0, 6, 1, 0, 0, 0, 26], "semantic": {"name": "_distance_attribute", "arg_names": ["self", "func", "geom", "tolerance", "spheroid", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _distance_attribute(self, func, geom=None, tolerance=0.05, spheroid=False, **kwargs):\n \"\"\"\n DRY routine for GeoQuerySet distance attribute routines.\n \"\"\"\n # Setting up the distance procedure arguments.\n procedure_args, geo_field = self._spatial_setup(func, field_name=kwargs.get('field_name', None))\n\n # If geodetic defaulting distance attribute to meters (Oracle and"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L572_C8", "label": "expression", "type": "expression", "loc": [572, 574], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "vector": [8, 2, 0.7375, 0.0039, 2, 0.47, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n DRY routine for GeoQuerySet distance attribute routines.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L576_C8", "label": "procedure_args, geo_field = _spatial_setup()", "type": "assigned_variable", "loc": [576, 576], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "vector": [14, 2, 0.7413, 0.0013, 2, 0.47, 0.05, 779, 3, 2, 0, 0, 694, 10, 2], "semantic": {"name": "procedure_args, geo_field", "arg_names": [], "import_names": [], "rhs_call_name": "_spatial_setup", "annotation": ""}, "snippet": " procedure_args, geo_field = self._spatial_setup(func, field_name=kwargs.get('field_name', None))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L581_C8", "label": "connection =", "type": "assigned_variable", "loc": [581, 581], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "vector": [14, 2, 0.7477, 0.0013, 2, 0.47, 0.1, 351, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "connection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " connection = connections[self.db]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L582_C8", "label": "geodetic = geodetic()", "type": "assigned_variable", "loc": [582, 582], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "vector": [14, 2, 0.749, 0.0013, 2, 0.47, 0.15, 279, 3, 1, 0, 0, 279, 10, 1], "semantic": {"name": "geodetic", "arg_names": [], "import_names": [], "rhs_call_name": "geodetic", "annotation": ""}, "snippet": " geodetic = geo_field.geodetic(connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L583_C8", "label": "geography =", "type": "assigned_variable", "loc": [583, 583], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "vector": [14, 2, 0.7503, 0.0013, 2, 0.47, 0.2, 899, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geography", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geography = geo_field.geography"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L585_C8", "label": "if", "type": "if", "loc": [585, 588], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "vector": [4, 2, 0.7548, 0.0051, 2, 0.47, 0.25, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if geodetic:\n dist_att = 'm'\n else:\n dist_att = Distance.unit_attname(geo_field.units_name(connection))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L586_C12", "label": "dist_att =", "type": "assigned_variable", "loc": [586, 586], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L585_C8", "vector": [14, 3, 0.7542, 0.0013, 3, 0.06, 0.0, 831, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "dist_att", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dist_att = 'm'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L588_C12", "label": "dist_att = unit_attname()", "type": "assigned_variable", "loc": [588, 588], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L585_C8", "vector": [14, 3, 0.7568, 0.0013, 3, 0.06, 1.0, 831, 3, 1, 0, 0, 503, 10, 2], "semantic": {"name": "dist_att", "arg_names": [], "import_names": [], "rhs_call_name": "unit_attname", "annotation": ""}, "snippet": " dist_att = Distance.unit_attname(geo_field.units_name(connection))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L592_C8", "label": "distance =", "type": "assigned_variable", "loc": [592, 592], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "vector": [14, 2, 0.7619, 0.0013, 2, 0.47, 0.3, 145, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "distance", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " distance = func == 'distance'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L593_C8", "label": "length =", "type": "assigned_variable", "loc": [593, 593], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "vector": [14, 2, 0.7632, 0.0013, 2, 0.47, 0.35, 221, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "length", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " length = func == 'length'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L594_C8", "label": "perimeter =", "type": "assigned_variable", "loc": [594, 594], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "vector": [14, 2, 0.7645, 0.0013, 2, 0.47, 0.4, 896, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "perimeter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " perimeter = func == 'perimeter'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L595_C8", "label": "if", "type": "if", "loc": [595, 596], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "vector": [4, 2, 0.7664, 0.0026, 2, 0.47, 0.45, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not (distance or length or perimeter):\n raise ValueError('Unknown distance function: %s' % func)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L597_C8", "label": "geom_3d =", "type": "assigned_variable", "loc": [597, 597], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "vector": [14, 2, 0.7683, 0.0013, 2, 0.47, 0.5, 933, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geom_3d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geom_3d = geo_field.dim == 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L602_C8", "label": "lookup_params =", "type": "assigned_variable", "loc": [602, 602], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "vector": [14, 2, 0.7748, 0.0013, 2, 0.47, 0.55, 500, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "lookup_params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lookup_params = [geom or 'POINT (0 0)', 0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L605_C8", "label": "backend =", "type": "assigned_variable", "loc": [605, 605], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "vector": [14, 2, 0.7786, 0.0013, 2, 0.47, 0.6, 631, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "backend", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " backend = connection.ops"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L611_C8", "label": "if", "type": "if", "loc": [611, 613], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "vector": [4, 2, 0.7876, 0.0039, 2, 0.47, 0.65, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if spheroid or (backend.postgis and geodetic and\n (not geography) and length):\n lookup_params.append('spheroid')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L613_C12", "label": "append()", "type": "expression", "loc": [613, 613], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L611_C8", "vector": [8, 3, 0.7889, 0.0013, 3, 0.55, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " lookup_params.append('spheroid')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L614_C8", "label": "lookup_params = get_prep_value()", "type": "assigned_variable", "loc": [614, 614], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "vector": [14, 2, 0.7902, 0.0013, 2, 0.47, 0.7, 500, 3, 1, 0, 0, 109, 10, 1], "semantic": {"name": "lookup_params", "arg_names": [], "import_names": [], "rhs_call_name": "get_prep_value", "annotation": ""}, "snippet": " lookup_params = geo_field.get_prep_value(lookup_params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L615_C8", "label": "params = get_db_prep_lookup()", "type": "assigned_variable", "loc": [615, 615], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "vector": [14, 2, 0.7915, 0.0013, 2, 0.47, 0.75, 206, 3, 3, 0, 0, 681, 10, 1], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "get_db_prep_lookup", "annotation": ""}, "snippet": " params = geo_field.get_db_prep_lookup('distance_lte', lookup_params, connection=connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L619_C8", "label": "geom_args = bool()", "type": "assigned_variable", "loc": [619, 619], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "vector": [14, 2, 0.7967, 0.0013, 2, 0.47, 0.8, 240, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "geom_args", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " geom_args = bool(geom)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L621_C8", "label": "if", "type": "if", "loc": [621, 698], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "vector": [4, 2, 0.8488, 0.1004, 2, 0.47, 0.85, 0, 7, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if backend.oracle:\n if distance:\n procedure_fmt = '%(geo_col)s,%(geom)s,%(tolerance)s'\n elif length or perimeter:\n procedure_fmt = '%(geo_col)s,%(tolerance)s'\n procedure_args['tolerance'] = tolerance\n else:\n # Getting whether this field is in units of degrees since the field may have"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L622_C12", "label": "if", "type": "if", "loc": [622, 625], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L621_C8", "vector": [4, 3, 0.8024, 0.0051, 3, 0.69, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if distance:\n procedure_fmt = '%(geo_col)s,%(geom)s,%(tolerance)s'\n elif length or perimeter:\n procedure_fmt = '%(geo_col)s,%(tolerance)s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L623_C16", "label": "procedure_fmt =", "type": "assigned_variable", "loc": [623, 623], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L622_C12", "vector": [14, 4, 0.8018, 0.0013, 4, 0.89, 0.0, 968, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "procedure_fmt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " procedure_fmt = '%(geo_col)s,%(geom)s,%(tolerance)s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L624_C12", "label": "if", "type": "if", "loc": [624, 625], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L622_C12", "vector": [4, 4, 0.8037, 0.0026, 4, 0.89, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif length or perimeter:\n procedure_fmt = '%(geo_col)s,%(tolerance)s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L625_C16", "label": "procedure_fmt =", "type": "assigned_variable", "loc": [625, 625], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L624_C12", "vector": [14, 5, 0.8044, 0.0013, 5, 0.91, 0.0, 968, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "procedure_fmt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " procedure_fmt = '%(geo_col)s,%(tolerance)s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L626_C12", "label": "assign", "type": "assigned_variable", "loc": [626, 626], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L621_C8", "vector": [14, 3, 0.8057, 0.0013, 3, 0.69, 0.25, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " procedure_args['tolerance'] = tolerance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L630_C12", "label": "if", "type": "if", "loc": [630, 632], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L621_C8", "vector": [4, 3, 0.8121, 0.0039, 3, 0.69, 0.5, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.query.transformed_srid:\n u, unit_name, s = get_srid_info(self.query.transformed_srid, connection)\n geodetic = unit_name in geo_field.geodetic_units"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L631_C16", "label": "u, unit_name, s = get_srid_info()", "type": "assigned_variable", "loc": [631, 631], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L630_C12", "vector": [14, 4, 0.8121, 0.0013, 4, 0.37, 0.0, 954, 3, 2, 0, 0, 701, 10, 1], "semantic": {"name": "u, unit_name, s", "arg_names": [], "import_names": [], "rhs_call_name": "get_srid_info", "annotation": ""}, "snippet": " u, unit_name, s = get_srid_info(self.query.transformed_srid, connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L632_C16", "label": "geodetic =", "type": "assigned_variable", "loc": [632, 632], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L630_C12", "vector": [14, 4, 0.8134, 0.0013, 4, 0.37, 1.0, 279, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geodetic", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geodetic = unit_name in geo_field.geodetic_units"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L634_C12", "label": "if", "type": "if", "loc": [634, 635], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L621_C8", "vector": [4, 3, 0.8166, 0.0026, 3, 0.69, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if backend.spatialite and geodetic:\n raise ValueError('SQLite does not support linear distance calculations on geodetic coordinate systems.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L637_C12", "label": "if", "type": "if", "loc": [637, 698], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L621_C8", "vector": [4, 3, 0.8591, 0.0798, 3, 0.69, 1.0, 0, 2, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if distance:\n if self.query.transformed_srid:\n # Setting the `geom_args` flag to false because we want to handle\n # transformation SQL here, rather than the way done by default\n # (which will transform to the original SRID of the field rather\n # than to what was transformed to).\n geom_args = False\n procedure_fmt = '%s(%%(geo_col)s, %s)' % (backend.transform, self.query.transformed_srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L638_C16", "label": "if", "type": "if", "loc": [638, 666], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L637_C12", "vector": [4, 4, 0.8391, 0.0373, 4, 0.26, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.query.transformed_srid:\n # Setting the `geom_args` flag to false because we want to handle\n # transformation SQL here, rather than the way done by default\n # (which will transform to the original SRID of the field rather\n # than to what was transformed to).\n geom_args = False\n procedure_fmt = '%s(%%(geo_col)s, %s)' % (backend.transform, self.query.transformed_srid)\n if geom.srid is None or geom.srid == self.query.transformed_srid:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L643_C20", "label": "geom_args =", "type": "assigned_variable", "loc": [643, 643], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L638_C16", "vector": [14, 5, 0.8275, 0.0013, 5, 0.36, 0.0, 240, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "geom_args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geom_args = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L644_C20", "label": "procedure_fmt =", "type": "assigned_variable", "loc": [644, 644], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L638_C16", "vector": [14, 5, 0.8288, 0.0013, 5, 0.36, 0.3333, 968, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "procedure_fmt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " procedure_fmt = '%s(%%(geo_col)s, %s)' % (backend.transform, self.query.transformed_srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L645_C20", "label": "if", "type": "if", "loc": [645, 663], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L638_C16", "vector": [4, 5, 0.8417, 0.0245, 5, 0.36, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if geom.srid is None or geom.srid == self.query.transformed_srid:\n # If the geom parameter srid is None, it is assumed the coordinates\n # are in the transformed units. A placeholder is used for the\n # geometry parameter. `GeomFromText` constructor is also needed\n # to wrap geom placeholder for SpatiaLite.\n if backend.spatialite:\n procedure_fmt += ', %s(%%%%s, %s)' % (backend.from_text, self.query.transformed_srid)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L650_C24", "label": "if", "type": "if", "loc": [650, 653], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L645_C20", "vector": [4, 6, 0.8385, 0.0051, 6, 0.37, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if backend.spatialite:\n procedure_fmt += ', %s(%%%%s, %s)' % (backend.from_text, self.query.transformed_srid)\n else:\n procedure_fmt += ', %%s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L659_C24", "label": "if", "type": "if", "loc": [659, 663], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L645_C20", "vector": [4, 6, 0.8507, 0.0064, 6, 0.37, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if backend.spatialite:\n procedure_fmt += ', %s(%s(%%%%s, %s), %s)' % (backend.transform, backend.from_text,\n geom.srid, self.query.transformed_srid)\n else:\n procedure_fmt += ', %s(%%%%s, %s)' % (backend.transform, self.query.transformed_srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L666_C20", "label": "procedure_fmt =", "type": "assigned_variable", "loc": [666, 666], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L638_C16", "vector": [14, 5, 0.8571, 0.0013, 5, 0.36, 1.0, 968, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "procedure_fmt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " procedure_fmt = '%(geo_col)s,%(geom)s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L668_C16", "label": "if", "type": "if", "loc": [668, 685], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L637_C12", "vector": [4, 4, 0.8707, 0.0232, 4, 0.26, 0.5, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not geography and geodetic:\n # Spherical distance calculation is needed (because the geographic\n # field is geodetic). However, the PostGIS ST_distance_sphere/spheroid()\n # procedures may only do queries from point columns to point geometries\n # some error checking is required.\n if not backend.geography:\n if not isinstance(geo_field, PointField):\n raise ValueError('Spherical distance calculation only supported on PointFields.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L673_C20", "label": "if", "type": "if", "loc": [673, 677], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L668_C16", "vector": [4, 5, 0.8687, 0.0064, 5, 0.82, 0.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not backend.geography:\n if not isinstance(geo_field, PointField):\n raise ValueError('Spherical distance calculation only supported on PointFields.')\n if not str(Geometry(buffer(params[0].ewkb)).geom_type) == 'Point':\n raise ValueError('Spherical distance calculation only supported with Point Geometry parameters')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L674_C24", "label": "if", "type": "if", "loc": [674, 675], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L673_C20", "vector": [4, 6, 0.8681, 0.0026, 6, 0.98, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(geo_field, PointField):\n raise ValueError('Spherical distance calculation only supported on PointFields.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L676_C24", "label": "if", "type": "if", "loc": [676, 677], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L673_C20", "vector": [4, 6, 0.8707, 0.0026, 6, 0.98, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not str(Geometry(buffer(params[0].ewkb)).geom_type) == 'Point':\n raise ValueError('Spherical distance calculation only supported with Point Geometry parameters')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L680_C20", "label": "if", "type": "if", "loc": [680, 685], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L668_C16", "vector": [4, 5, 0.8784, 0.0077, 5, 0.82, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if spheroid:\n # Call to distance_spheroid() requires spheroid param as well.\n procedure_fmt += \",'%(spheroid)s'\"\n procedure_args.update({'function' : backend.distance_spheroid, 'spheroid' : params[1]})\n else:\n procedure_args.update({'function' : backend.distance_sphere})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L683_C24", "label": "update()", "type": "expression", "loc": [683, 683], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L680_C20", "vector": [8, 6, 0.879, 0.0013, 6, 0.26, 0.0, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " procedure_args.update({'function' : backend.distance_spheroid, 'spheroid' : params[1]})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L685_C24", "label": "update()", "type": "expression", "loc": [685, 685], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L680_C20", "vector": [8, 6, 0.8816, 0.0013, 6, 0.26, 1.0, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " procedure_args.update({'function' : backend.distance_sphere})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L686_C12", "label": "if", "type": "if", "loc": [686, 698], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L637_C12", "vector": [4, 4, 0.8906, 0.0167, 4, 0.26, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif length or perimeter:\n procedure_fmt = '%(geo_col)s'\n if not geography and geodetic and length:\n # There's no `length_sphere`, and `length_spheroid` also\n # works on 3D geometries.\n procedure_fmt += \",'%(spheroid)s'\"\n procedure_args.update({'function' : backend.length_spheroid, 'spheroid' : params[1]})\n elif geom_3d and backend.postgis:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L687_C16", "label": "procedure_fmt =", "type": "assigned_variable", "loc": [687, 687], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L686_C12", "vector": [14, 5, 0.8842, 0.0013, 5, 0.3, 0.0, 968, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "procedure_fmt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " procedure_fmt = '%(geo_col)s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L688_C16", "label": "if", "type": "if", "loc": [688, 698], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L686_C12", "vector": [4, 5, 0.8919, 0.0142, 5, 0.3, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not geography and geodetic and length:\n # There's no `length_sphere`, and `length_spheroid` also\n # works on 3D geometries.\n procedure_fmt += \",'%(spheroid)s'\"\n procedure_args.update({'function' : backend.length_spheroid, 'spheroid' : params[1]})\n elif geom_3d and backend.postgis:\n # Use 3D variants of perimeter and length routines on PostGIS.\n if perimeter:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L692_C20", "label": "update()", "type": "expression", "loc": [692, 692], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L688_C16", "vector": [8, 6, 0.8906, 0.0013, 6, 0.21, 0.0, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " procedure_args.update({'function' : backend.length_spheroid, 'spheroid' : params[1]})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L693_C16", "label": "if", "type": "if", "loc": [693, 698], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L688_C16", "vector": [4, 6, 0.8951, 0.0077, 6, 0.21, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif geom_3d and backend.postgis:\n # Use 3D variants of perimeter and length routines on PostGIS.\n if perimeter:\n procedure_args.update({'function' : backend.perimeter3d})\n elif length:\n procedure_args.update({'function' : backend.length3d})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L695_C20", "label": "if", "type": "if", "loc": [695, 698], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L693_C16", "vector": [4, 7, 0.8964, 0.0051, 7, 0.85, 0.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if perimeter:\n procedure_args.update({'function' : backend.perimeter3d})\n elif length:\n procedure_args.update({'function' : backend.length3d})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L696_C24", "label": "update()", "type": "expression", "loc": [696, 696], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L695_C20", "vector": [8, 8, 0.8958, 0.0013, 8, 0.96, 0.0, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " procedure_args.update({'function' : backend.perimeter3d})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L697_C20", "label": "if", "type": "if", "loc": [697, 698], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L695_C20", "vector": [4, 8, 0.8977, 0.0026, 8, 0.96, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif length:\n procedure_args.update({'function' : backend.length3d})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L698_C24", "label": "update()", "type": "expression", "loc": [698, 698], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L697_C20", "vector": [8, 9, 0.8983, 0.0013, 9, 0.09, 0.0, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " procedure_args.update({'function' : backend.length3d})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L701_C8", "label": "s =", "type": "assigned_variable", "loc": [701, 706], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "vector": [14, 2, 0.9054, 0.0077, 2, 0.47, 0.9, 553, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = {'select_field' : DistanceField(dist_att),\n 'setup' : False,\n 'geo_field' : geo_field,\n 'procedure_args' : procedure_args,\n 'procedure_fmt' : procedure_fmt,\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L707_C8", "label": "if", "type": "if", "loc": [707, 713], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "vector": [4, 2, 0.9138, 0.009, 2, 0.47, 0.95, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if geom_args:\n s['geom_args'] = ('geom',)\n s['procedure_args']['geom'] = geom\n elif geom:\n # The geometry is passed in as a parameter because we handled\n # transformation conditions in this routine.\n s['select_params'] = [backend.Adapter(geom)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L708_C12", "label": "assign", "type": "assigned_variable", "loc": [708, 708], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L707_C8", "vector": [14, 3, 0.9112, 0.0013, 3, 0.94, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s['geom_args'] = ('geom',)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L709_C12", "label": "assign", "type": "assigned_variable", "loc": [709, 709], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L707_C8", "vector": [14, 3, 0.9125, 0.0013, 3, 0.94, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s['procedure_args']['geom'] = geom"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L710_C8", "label": "if", "type": "if", "loc": [710, 713], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L707_C8", "vector": [4, 3, 0.9157, 0.0051, 3, 0.94, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif geom:\n # The geometry is passed in as a parameter because we handled\n # transformation conditions in this routine.\n s['select_params'] = [backend.Adapter(geom)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L713_C12", "label": "assign", "type": "assigned_variable", "loc": [713, 713], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L710_C8", "vector": [14, 4, 0.9176, 0.0013, 4, 0.03, 0.0, 0, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s['select_params'] = [backend.Adapter(geom)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L714_C8", "label": "return", "type": "return", "loc": [714, 714], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "vector": [13, 2, 0.9189, 0.0013, 2, 0.47, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._spatial_attribute(func, s, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L716_C4", "label": "_geom_attribute", "type": "function", "loc": [716, 725], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.9273, 0.0129, 1, 0.64, 0.95, 382, 0, 4, 1, 0, 0, 0, 2], "semantic": {"name": "_geom_attribute", "arg_names": ["self", "func", "tolerance", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _geom_attribute(self, func, tolerance=0.05, **kwargs):\n \"\"\"\n DRY routine for setting up a GeoQuerySet method that attaches a\n Geometry attribute (e.g., `centroid`, `point_on_surface`).\n \"\"\"\n s = {'select_field' : GeomField(),}\n if connections[self.db].ops.oracle:\n s['procedure_fmt'] = '%(geo_col)s,%(tolerance)s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L717_C8", "label": "expression", "type": "expression", "loc": [717, 720], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L716_C4", "vector": [8, 2, 0.9247, 0.0051, 2, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n DRY routine for setting up a GeoQuerySet method that attaches a\n Geometry attribute (e.g., `centroid`, `point_on_surface`).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L721_C8", "label": "s =", "type": "assigned_variable", "loc": [721, 721], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L716_C4", "vector": [14, 2, 0.9279, 0.0013, 2, 0.41, 0.3333, 553, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = {'select_field' : GeomField(),}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L722_C8", "label": "if", "type": "if", "loc": [722, 724], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L716_C4", "vector": [4, 2, 0.9305, 0.0039, 2, 0.41, 0.6667, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if connections[self.db].ops.oracle:\n s['procedure_fmt'] = '%(geo_col)s,%(tolerance)s'\n s['procedure_args'] = {'tolerance' : tolerance}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L723_C12", "label": "assign", "type": "assigned_variable", "loc": [723, 723], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L722_C8", "vector": [14, 3, 0.9305, 0.0013, 3, 0.8, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s['procedure_fmt'] = '%(geo_col)s,%(tolerance)s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L724_C12", "label": "assign", "type": "assigned_variable", "loc": [724, 724], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L722_C8", "vector": [14, 3, 0.9318, 0.0013, 3, 0.8, 1.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s['procedure_args'] = {'tolerance' : tolerance}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L725_C8", "label": "return", "type": "return", "loc": [725, 725], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L716_C4", "vector": [13, 2, 0.9331, 0.0013, 2, 0.41, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._spatial_attribute(func, s, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L727_C4", "label": "_geomset_attribute", "type": "function", "loc": [727, 742], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.9453, 0.0206, 1, 0.64, 0.975, 471, 0, 5, 1, 0, 0, 0, 2], "semantic": {"name": "_geomset_attribute", "arg_names": ["self", "func", "geom", "tolerance", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _geomset_attribute(self, func, geom, tolerance=0.05, **kwargs):\n \"\"\"\n DRY routine for setting up a GeoQuerySet method that attaches a\n Geometry attribute and takes a Geoemtry parameter. This is used\n for geometry set-like operations (e.g., intersection, difference,\n union, sym_difference).\n \"\"\"\n s = {'geom_args' : ('geom',),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L728_C8", "label": "expression", "type": "expression", "loc": [728, 733], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L727_C4", "vector": [8, 2, 0.9402, 0.0077, 2, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n DRY routine for setting up a GeoQuerySet method that attaches a\n Geometry attribute and takes a Geoemtry parameter. This is used\n for geometry set-like operations (e.g., intersection, difference,\n union, sym_difference).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L734_C8", "label": "s =", "type": "assigned_variable", "loc": [734, 738], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L727_C4", "vector": [14, 2, 0.9472, 0.0064, 2, 0.07, 0.3333, 553, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = {'geom_args' : ('geom',),\n 'select_field' : GeomField(),\n 'procedure_fmt' : '%(geo_col)s,%(geom)s',\n 'procedure_args' : {'geom' : geom},\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L739_C8", "label": "if", "type": "if", "loc": [739, 741], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L727_C4", "vector": [4, 2, 0.9524, 0.0039, 2, 0.07, 0.6667, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if connections[self.db].ops.oracle:\n s['procedure_fmt'] += ',%(tolerance)s'\n s['procedure_args']['tolerance'] = tolerance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L741_C12", "label": "assign", "type": "assigned_variable", "loc": [741, 741], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L739_C8", "vector": [14, 3, 0.9537, 0.0013, 3, 0.07, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s['procedure_args']['tolerance'] = tolerance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L742_C8", "label": "return", "type": "return", "loc": [742, 742], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L727_C4", "vector": [13, 2, 0.955, 0.0013, 2, 0.07, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._spatial_attribute(func, s, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L744_C4", "label": "_geocol_select", "type": "function", "loc": [744, 766], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "vector": [2, 1, 0.9717, 0.0296, 1, 0.64, 1.0, 628, 0, 3, 1, 0, 0, 0, 10], "semantic": {"name": "_geocol_select", "arg_names": ["self", "geo_field", "field_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _geocol_select(self, geo_field, field_name):\n \"\"\"\n Helper routine for constructing the SQL to select the geographic\n column. Takes into account if the geographic field is in a\n ForeignKey relation to the current model.\n \"\"\"\n opts = self.model._meta\n if not geo_field in opts.fields:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L745_C8", "label": "expression", "type": "expression", "loc": [745, 749], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L744_C4", "vector": [8, 2, 0.9614, 0.0064, 2, 0.96, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Helper routine for constructing the SQL to select the geographic\n column. Takes into account if the geographic field is in a\n ForeignKey relation to the current model.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L750_C8", "label": "opts =", "type": "assigned_variable", "loc": [750, 750], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L744_C4", "vector": [14, 2, 0.9653, 0.0013, 2, 0.96, 0.5, 631, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "opts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " opts = self.model._meta"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L751_C8", "label": "if", "type": "if", "loc": [751, 766], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L744_C4", "vector": [4, 2, 0.9762, 0.0206, 2, 0.96, 1.0, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not geo_field in opts.fields:\n # Is this operation going to be on a related geographic field?\n # If so, it'll have to be added to the select related information\n # (e.g., if 'location__point' was given as the field name).\n self.query.add_select_related([field_name])\n compiler = self.query.get_compiler(self.db)\n compiler.pre_sql_setup()\n rel_table, rel_col = self.query.related_select_cols[self.query.related_select_fields.index(geo_field)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L755_C12", "label": "add_select_related()", "type": "expression", "loc": [755, 755], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L751_C8", "vector": [8, 3, 0.9717, 0.0013, 3, 0.28, 0.0, 540, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add_select_related", "arg_names": [], "import_names": [], "rhs_call_name": "add_select_related", "annotation": ""}, "snippet": " self.query.add_select_related([field_name])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L756_C12", "label": "compiler = get_compiler()", "type": "assigned_variable", "loc": [756, 756], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L751_C8", "vector": [14, 3, 0.973, 0.0013, 3, 0.28, 0.2, 738, 3, 1, 0, 0, 963, 10, 1], "semantic": {"name": "compiler", "arg_names": [], "import_names": [], "rhs_call_name": "get_compiler", "annotation": ""}, "snippet": " compiler = self.query.get_compiler(self.db)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L757_C12", "label": "pre_sql_setup()", "type": "expression", "loc": [757, 757], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L751_C8", "vector": [8, 3, 0.9743, 0.0013, 3, 0.28, 0.4, 451, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pre_sql_setup", "arg_names": [], "import_names": [], "rhs_call_name": "pre_sql_setup", "annotation": ""}, "snippet": " compiler.pre_sql_setup()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L758_C12", "label": "rel_table, rel_col =", "type": "assigned_variable", "loc": [758, 758], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L751_C8", "vector": [14, 3, 0.9755, 0.0013, 3, 0.28, 0.6, 445, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "rel_table, rel_col", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rel_table, rel_col = self.query.related_select_cols[self.query.related_select_fields.index(geo_field)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L759_C12", "label": "return", "type": "return", "loc": [759, 759], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L751_C8", "vector": [13, 3, 0.9768, 0.0013, 3, 0.28, 0.8, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return compiler._field_column(geo_field, rel_table)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L760_C8", "label": "if", "type": "if", "loc": [760, 766], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L751_C8", "vector": [4, 3, 0.982, 0.009, 3, 0.28, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif not geo_field in opts.local_fields:\n # This geographic field is inherited from another model, so we have to\n # use the db table for the _parent_ model instead.\n tmp_fld, parent_model, direct, m2m = opts.get_field_by_name(geo_field.name)\n return self.query.get_compiler(self.db)._field_column(geo_field, parent_model._meta.db_table)\n else:\n return self.query.get_compiler(self.db)._field_column(geo_field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L763_C12", "label": "tmp_fld, parent_model, direct, m2m = get_field_by_name()", "type": "assigned_variable", "loc": [763, 763], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L760_C8", "vector": [14, 4, 0.982, 0.0013, 4, 0.26, 0.0, 805, 3, 1, 0, 0, 779, 10, 1], "semantic": {"name": "tmp_fld, parent_model, direct, m2m", "arg_names": [], "import_names": [], "rhs_call_name": "get_field_by_name", "annotation": ""}, "snippet": " tmp_fld, parent_model, direct, m2m = opts.get_field_by_name(geo_field.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L764_C12", "label": "return", "type": "return", "loc": [764, 764], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L760_C8", "vector": [13, 4, 0.9833, 0.0013, 4, 0.26, 0.5, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.query.get_compiler(self.db)._field_column(geo_field, parent_model._meta.db_table)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L766_C12", "label": "return", "type": "return", "loc": [766, 766], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L760_C8", "vector": [13, 4, 0.9858, 0.0013, 4, 0.26, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.query.get_compiler(self.db)._field_column(geo_field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L768_C0", "label": "GeoValuesQuerySet", "type": "class", "loc": [768, 774], "level": 0, "parent": null, "vector": [3, 0, 0.9923, 0.009, 0, 0.66, 0.8889, 869, 0, 1, 0, 0, 733, 0, 2], "semantic": {"name": "GeoValuesQuerySet", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GeoValuesQuerySet(ValuesQuerySet):\n def __init__(self, *args, **kwargs):\n super(GeoValuesQuerySet, self).__init__(*args, **kwargs)\n # This flag tells `resolve_columns` to run the values through\n # `convert_values`. This ensures that Geometry objects instead\n # of string values are returned with `values()` or `values_list()`.\n self.query.geo_values = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L769_C4", "label": "__init__", "type": "function", "loc": [769, 774], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L768_C0", "vector": [2, 1, 0.9929, 0.0077, 1, 0.45, 0.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, *args, **kwargs):\n super(GeoValuesQuerySet, self).__init__(*args, **kwargs)\n # This flag tells `resolve_columns` to run the values through\n # `convert_values`. This ensures that Geometry objects instead\n # of string values are returned with `values()` or `values_list()`.\n self.query.geo_values = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L770_C8", "label": "__init__()", "type": "expression", "loc": [770, 770], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L769_C4", "vector": [8, 2, 0.991, 0.0013, 2, 0.81, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(GeoValuesQuerySet, self).__init__(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L774_C8", "label": "self.query.geo_values =", "type": "assigned_variable", "loc": [774, 774], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L769_C4", "vector": [14, 2, 0.9961, 0.0013, 2, 0.81, 1.0, 533, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.query.geo_values", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.query.geo_values = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L776_C0", "label": "GeoValuesListQuerySet", "type": "class", "loc": [776, 777], "level": 0, "parent": null, "vector": [3, 0, 0.9994, 0.0026, 0, 0.66, 1.0, 910, 0, 0, 0, 0, 869, 0, 0], "semantic": {"name": "GeoValuesListQuerySet", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GeoValuesListQuerySet(GeoValuesQuerySet, ValuesListQuerySet):\n pass"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L46_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L46_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L46_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L46_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L51_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L53_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L51_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L54_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L54_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L56_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L110_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L110_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L125_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L126_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L125_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L152_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L153_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L152_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L154_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L154_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L154_C29"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L154_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L155_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L155_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L155_C23"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L155_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L156_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L156_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L156_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L152_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L158_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L152_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L159_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L159_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L159_C29"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L159_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L160_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L160_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L160_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L160_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L161_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L161_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L161_C23"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L180_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L187_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L188_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L189_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L192_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L192_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L193_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L192_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L195_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L189_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L196_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L200_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L200_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L201_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L200_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L206_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L208_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L209_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L213_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L217_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L219_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L219_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L220_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L219_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L224_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L226_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L226_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L227_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L226_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L232_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L234_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L235_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L239_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L241_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L241_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L242_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L241_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L248_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L250_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L250_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L250_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L256_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L258_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L258_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L259_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L258_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L263_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L265_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L265_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L266_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L265_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L271_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L273_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L274_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L278_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L279_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L280_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L280_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L281_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L282_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L284_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L284_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L285_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L284_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L289_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L289_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L290_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L289_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L292_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L289_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L297_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L284_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L301_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L303_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L303_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L304_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L303_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L312_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L303_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L315_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L303_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L316_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L316_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L317_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L316_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L318_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L316_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L319_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L316_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L320_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L320_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L321_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L320_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L322_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L320_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L323_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L320_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L324_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L324_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L325_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L324_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L326_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L324_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L327_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L303_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L332_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L303_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L337_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L339_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L339_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L340_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L339_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L351_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L339_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L352_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L339_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L354_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L339_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L360_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L362_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L362_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L363_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L362_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L367_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L369_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L370_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L374_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L374_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L375_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L374_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L377_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L374_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L382_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L386_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L388_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L388_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L389_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L388_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L393_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L388_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L395_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L388_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L396_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L388_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L399_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L388_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L405_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L388_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L409_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L388_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L412_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L388_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L413_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L388_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L414_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L416_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L416_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L417_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L416_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L421_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L423_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L423_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L424_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L423_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L429_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L432_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L432_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L433_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L432_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L437_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L432_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L438_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L432_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L439_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L439_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L439_C25"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L432_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L440_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L432_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L446_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L432_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L450_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L432_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L451_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L432_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L456_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L432_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L460_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L432_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L462_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L464_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L464_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L466_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L464_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L471_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L464_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L472_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L464_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L477_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L464_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L482_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L464_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L486_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L464_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L487_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L487_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L487_C44"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L464_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L490_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L493_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L517_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L518_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L519_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L520_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L521_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L522_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L524_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L525_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L528_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L528_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L529_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L528_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:For_L531_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:For_L531_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L531_C50"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L528_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L533_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L536_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L536_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L536_C50"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:For_L539_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:For_L539_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L542_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:For_L539_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L543_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:For_L539_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L544_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:For_L539_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L548_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:For_L539_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L549_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:For_L539_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L550_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:For_L539_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L551_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L554_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L557_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L557_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L558_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L557_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L559_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L559_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L560_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L557_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L561_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L561_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L562_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L557_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L563_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L568_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L572_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L576_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L581_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L582_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L583_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L585_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L585_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L586_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L585_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L588_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L592_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L593_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L594_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L595_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L597_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L602_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L605_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L611_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L611_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L613_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L614_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L615_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L619_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L621_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L621_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L622_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L622_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L623_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L622_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L624_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L624_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L625_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L621_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L626_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L621_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L630_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L630_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L631_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L630_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L632_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L621_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L634_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L621_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L637_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L637_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L638_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L638_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L643_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L638_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L644_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L638_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L645_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L645_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L650_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L645_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L659_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L638_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L666_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L637_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L668_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L668_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L673_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L673_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L674_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L673_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L676_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L668_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L680_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L680_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L683_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L680_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L685_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L637_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L686_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L686_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L687_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L686_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L688_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L688_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L692_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L688_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L693_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L693_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L695_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L695_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L696_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L695_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L697_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L697_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L698_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L701_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L707_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L707_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L708_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L707_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L709_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L707_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L710_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L710_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L713_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L714_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L716_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L716_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L717_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L716_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L721_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L716_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L722_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L722_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L723_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L722_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L724_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L716_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L725_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L727_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L727_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L728_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L727_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L734_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L727_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L739_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L739_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L741_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L727_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L742_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L744_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L744_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L745_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L744_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L750_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L744_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L751_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L751_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L755_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L751_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L756_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L751_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L757_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L751_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L758_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L751_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L759_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L751_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L760_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L760_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L763_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L760_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L764_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:If_L760_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Return_L766_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L768_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L769_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L769_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L770_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L769_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Assign_L774_C8"}] |
from django.db.models.fields import Field
from django.db.models.sql.expressions import SQLEvaluator
from django.utils.translation import ugettext_lazy as _
from django.contrib.gis import forms
from django.contrib.gis.db.models.proxy import GeometryProxy
from django.contrib.gis.geometry.backend import Geometry, GeometryException
# Local cache of the spatial_ref_sys table, which holds SRID data for each
# spatial database alias. This cache exists so that the database isn't queried
# for SRID info each time a distance query is constructed.
_srid_cache = {}
def get_srid_info(srid, connection):
"""
Returns the units, unit name, and spheroid WKT associated with the
given SRID from the `spatial_ref_sys` (or equivalent) spatial database
table for the given database connection. These results are cached.
"""
global _srid_cache
try:
# The SpatialRefSys model for the spatial backend.
SpatialRefSys = connection.ops.spatial_ref_sys()
except NotImplementedError:
# No `spatial_ref_sys` table in spatial backend (e.g., MySQL).
return None, None, None
if not connection.alias in _srid_cache:
# Initialize SRID dictionary for database if it doesn't exist.
_srid_cache[connection.alias] = {}
if not srid in _srid_cache[connection.alias]:
# Use `SpatialRefSys` model to query for spatial reference info.
sr = SpatialRefSys.objects.using(connection.alias).get(srid=srid)
units, units_name = sr.units
spheroid = SpatialRefSys.get_spheroid(sr.wkt)
_srid_cache[connection.alias][srid] = (units, units_name, spheroid)
return _srid_cache[connection.alias][srid]
class GeometryField(Field):
"The base GIS field -- maps to the OpenGIS Specification Geometry type."
# The OpenGIS Geometry name.
geom_type = 'GEOMETRY'
# Geodetic units.
geodetic_units = ('Decimal Degree', 'degree')
description = _("The base GIS field -- maps to the OpenGIS Specification Geometry type.")
def __init__(self, verbose_name=None, srid=4326, spatial_index=True, dim=2,
geography=False, **kwargs):
"""
The initialization function for geometry fields. Takes the following
as keyword arguments:
srid:
The spatial reference system identifier, an OGC standard.
Defaults to 4326 (WGS84).
spatial_index:
Indicates whether to create a spatial index. Defaults to True.
Set this instead of 'db_index' for geographic fields since index
creation is different for geometry columns.
dim:
The number of dimensions for this geometry. Defaults to 2.
extent:
Customize the extent, in a 4-tuple of WGS 84 coordinates, for the
geometry field entry in the `USER_SDO_GEOM_METADATA` table. Defaults
to (-180.0, -90.0, 180.0, 90.0).
tolerance:
Define the tolerance, in meters, to use for the geometry field
entry in the `USER_SDO_GEOM_METADATA` table. Defaults to 0.05.
"""
# Setting the index flag with the value of the `spatial_index` keyword.
self.spatial_index = spatial_index
# Setting the SRID and getting the units. Unit information must be
# easily available in the field instance for distance queries.
self.srid = srid
# Setting the dimension of the geometry field.
self.dim = dim
# Setting the verbose_name keyword argument with the positional
# first parameter, so this works like normal fields.
kwargs['verbose_name'] = verbose_name
# Is this a geography rather than a geometry column?
self.geography = geography
# Oracle-specific private attributes for creating the entrie in
# `USER_SDO_GEOM_METADATA`
self._extent = kwargs.pop('extent', (-180.0, -90.0, 180.0, 90.0))
self._tolerance = kwargs.pop('tolerance', 0.05)
super(GeometryField, self).__init__(**kwargs)
# The following functions are used to get the units, their name, and
# the spheroid corresponding to the SRID of the GeometryField.
def _get_srid_info(self, connection):
# Get attributes from `get_srid_info`.
self._units, self._units_name, self._spheroid = get_srid_info(self.srid, connection)
def spheroid(self, connection):
if not hasattr(self, '_spheroid'):
self._get_srid_info(connection)
return self._spheroid
def units(self, connection):
if not hasattr(self, '_units'):
self._get_srid_info(connection)
return self._units
def units_name(self, connection):
if not hasattr(self, '_units_name'):
self._get_srid_info(connection)
return self._units_name
### Routines specific to GeometryField ###
def geodetic(self, connection):
"""
Returns true if this field's SRID corresponds with a coordinate
system that uses non-projected units (e.g., latitude/longitude).
"""
return self.units_name(connection) in self.geodetic_units
def get_distance(self, value, lookup_type, connection):
"""
Returns a distance number in units of the field. For example, if
`D(km=1)` was passed in and the units of the field were in meters,
then 1000 would be returned.
"""
return connection.ops.get_distance(self, value, lookup_type)
def get_prep_value(self, value):
"""
Spatial lookup values are either a parameter that is (or may be
converted to) a geometry, or a sequence of lookup values that
begins with a geometry. This routine will setup the geometry
value properly, and preserve any other lookup parameters before
returning to the caller.
"""
if isinstance(value, SQLEvaluator):
return value
elif isinstance(value, (tuple, list)):
geom = value[0]
seq_value = True
else:
geom = value
seq_value = False
# When the input is not a GEOS geometry, attempt to construct one
# from the given string input.
if isinstance(geom, Geometry):
pass
elif isinstance(geom, basestring) or hasattr(geom, '__geo_interface__'):
try:
geom = Geometry(geom)
except GeometryException:
raise ValueError('Could not create geometry from lookup value.')
else:
raise ValueError('Cannot use object with type %s for a geometry lookup parameter.' % type(geom).__name__)
# Assigning the SRID value.
geom.srid = self.get_srid(geom)
if seq_value:
lookup_val = [geom]
lookup_val.extend(value[1:])
return tuple(lookup_val)
else:
return geom
def get_srid(self, geom):
"""
Returns the default SRID for the given geometry, taking into account
the SRID set for the field. For example, if the input geometry
has no SRID, then that of the field will be returned.
"""
gsrid = geom.srid # SRID of given geometry.
if gsrid is None or self.srid == -1 or (gsrid == -1 and self.srid != -1):
return self.srid
else:
return gsrid
### Routines overloaded from Field ###
def contribute_to_class(self, cls, name):
super(GeometryField, self).contribute_to_class(cls, name)
# Setup for lazy-instantiated Geometry object.
setattr(cls, self.attname, GeometryProxy(Geometry, self))
def db_type(self, connection):
return connection.ops.geo_db_type(self)
def formfield(self, **kwargs):
defaults = {'form_class' : forms.GeometryField,
'null' : self.null,
'geom_type' : self.geom_type,
'srid' : self.srid,
}
defaults.update(kwargs)
return super(GeometryField, self).formfield(**defaults)
def get_db_prep_lookup(self, lookup_type, value, connection, prepared=False):
"""
Prepare for the database lookup, and return any spatial parameters
necessary for the query. This includes wrapping any geometry
parameters with a backend-specific adapter and formatting any distance
parameters into the correct units for the coordinate system of the
field.
"""
if lookup_type in connection.ops.gis_terms:
# special case for isnull lookup
if lookup_type == 'isnull':
return []
# Populating the parameters list, and wrapping the Geometry
# with the Adapter of the spatial backend.
if isinstance(value, (tuple, list)):
params = [connection.ops.Adapter(value[0])]
if lookup_type in connection.ops.distance_functions:
# Getting the distance parameter in the units of the field.
params += self.get_distance(value[1:], lookup_type, connection)
elif lookup_type in connection.ops.truncate_params:
# Lookup is one where SQL parameters aren't needed from the
# given lookup value.
pass
else:
params += value[1:]
elif isinstance(value, SQLEvaluator):
params = []
else:
params = [connection.ops.Adapter(value)]
return params
else:
raise ValueError('%s is not a valid spatial lookup for %s.' %
(lookup_type, self.__class__.__name__))
def get_prep_lookup(self, lookup_type, value):
if lookup_type == 'isnull':
return bool(value)
else:
return self.get_prep_value(value)
def get_db_prep_save(self, value, connection):
"Prepares the value for saving in the database."
if value is None:
return None
else:
return connection.ops.Adapter(self.get_prep_value(value))
def get_placeholder(self, value, connection):
"""
Returns the placeholder for the geometry column for the
given value.
"""
return connection.ops.get_geom_placeholder(self, value)
# The OpenGIS Geometry Type Fields
class PointField(GeometryField):
geom_type = 'POINT'
description = _("Point")
class LineStringField(GeometryField):
geom_type = 'LINESTRING'
description = _("Line string")
class PolygonField(GeometryField):
geom_type = 'POLYGON'
description = _("Polygon")
class MultiPointField(GeometryField):
geom_type = 'MULTIPOINT'
description = _("Multi-point")
class MultiLineStringField(GeometryField):
geom_type = 'MULTILINESTRING'
description = _("Multi-line string")
class MultiPolygonField(GeometryField):
geom_type = 'MULTIPOLYGON'
description = _("Multi polygon")
class GeometryCollectionField(GeometryField):
geom_type = 'GEOMETRYCOLLECTION'
description = _("Geometry collection")
| ajibawa-2023/Python-Code-Large/train/row_98751 | 135 | 294 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98751:ImportFrom_L1_C0", "label": "from django.db.models.fields import Field", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0034, 0.0034, 0, 0.66, 0.0, 5, 0, 1, 0, 0, 5, 0, 0], "semantic": {"name": "django.db.models.fields", "arg_names": [], "import_names": ["Field"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.models.fields import Field"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:ImportFrom_L2_C0", "label": "from django.db.models.sql.expressions import SQLEvaluator", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0068, 0.0034, 0, 0.66, 0.0667, 438, 0, 1, 0, 0, 438, 0, 0], "semantic": {"name": "django.db.models.sql.expressions", "arg_names": [], "import_names": ["SQLEvaluator"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.models.sql.expressions import SQLEvaluator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:ImportFrom_L3_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0102, 0.0034, 0, 0.66, 0.1333, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names": [], "import_names": ["_"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.translation import ugettext_lazy as _"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:ImportFrom_L4_C0", "label": "from django.contrib.gis import forms", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0136, 0.0034, 0, 0.66, 0.2, 735, 0, 1, 0, 0, 735, 0, 0], "semantic": {"name": "django.contrib.gis", "arg_names": [], "import_names": ["forms"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis import forms"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:ImportFrom_L5_C0", "label": "from django.contrib.gis.db.models.proxy import GeometryProxy", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.017, 0.0034, 0, 0.66, 0.2667, 689, 0, 1, 0, 0, 689, 0, 0], "semantic": {"name": "django.contrib.gis.db.models.proxy", "arg_names": [], "import_names": ["GeometryProxy"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.models.proxy import GeometryProxy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:ImportFrom_L6_C0", "label": "from django.contrib.gis.geometry.backend import Geometry, GeometryException", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0204, 0.0034, 0, 0.66, 0.3333, 299, 0, 2, 0, 0, 299, 0, 0], "semantic": {"name": "django.contrib.gis.geometry.backend", "arg_names": [], "import_names": ["Geometry", "GeometryException"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geometry.backend import Geometry, GeometryException"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L11_C0", "label": "_srid_cache =", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.0374, 0.0034, 0, 0.66, 0.4, 848, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_srid_cache", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_srid_cache = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L13_C0", "label": "get_srid_info", "type": "function", "loc": [13, 39], "level": 0, "parent": null, "vector": [2, 0, 0.0884, 0.0918, 0, 0.66, 0.4667, 701, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "get_srid_info", "arg_names": ["srid", "connection"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_srid_info(srid, connection):\n \"\"\"\n Returns the units, unit name, and spheroid WKT associated with the\n given SRID from the `spatial_ref_sys` (or equivalent) spatial database\n table for the given database connection. These results are cached.\n \"\"\"\n global _srid_cache\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L14_C4", "label": "expression", "type": "expression", "loc": [14, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L13_C0", "vector": [8, 1, 0.0544, 0.017, 1, 0.93, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the units, unit name, and spheroid WKT associated with the\n given SRID from the `spatial_ref_sys` (or equivalent) spatial database\n table for the given database connection. These results are cached.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Try_L21_C4", "label": "try", "type": "try", "loc": [21, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L13_C0", "vector": [7, 1, 0.0799, 0.0204, 1, 0.93, 0.25, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # The SpatialRefSys model for the spatial backend.\n SpatialRefSys = connection.ops.spatial_ref_sys()\n except NotImplementedError:\n # No `spatial_ref_sys` table in spatial backend (e.g., MySQL).\n return None, None, None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L23_C8", "label": "SpatialRefSys = spatial_ref_sys()", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:Try_L21_C4", "vector": [14, 2, 0.0782, 0.0034, 2, 0.55, 0.0, 219, 3, 0, 0, 0, 318, 10, 1], "semantic": {"name": "SpatialRefSys", "arg_names": [], "import_names": [], "rhs_call_name": "spatial_ref_sys", "annotation": ""}, "snippet": " SpatialRefSys = connection.ops.spatial_ref_sys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L26_C8", "label": "return", "type": "return", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:Try_L21_C4", "vector": [13, 2, 0.0884, 0.0034, 2, 0.55, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None, None, None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L28_C4", "label": "if", "type": "if", "loc": [28, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L13_C0", "vector": [4, 1, 0.0986, 0.0102, 1, 0.93, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not connection.alias in _srid_cache:\n # Initialize SRID dictionary for database if it doesn't exist.\n _srid_cache[connection.alias] = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L30_C8", "label": "assign", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L28_C4", "vector": [14, 2, 0.102, 0.0034, 2, 0.99, 0.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _srid_cache[connection.alias] = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L32_C4", "label": "if", "type": "if", "loc": [32, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L13_C0", "vector": [4, 1, 0.1173, 0.0204, 1, 0.93, 0.75, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not srid in _srid_cache[connection.alias]:\n # Use `SpatialRefSys` model to query for spatial reference info.\n sr = SpatialRefSys.objects.using(connection.alias).get(srid=srid)\n units, units_name = sr.units\n spheroid = SpatialRefSys.get_spheroid(sr.wkt)\n _srid_cache[connection.alias][srid] = (units, units_name, spheroid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L34_C8", "label": "sr = get()", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L32_C4", "vector": [14, 2, 0.1156, 0.0034, 2, 0.3, 0.0, 498, 3, 1, 0, 0, 607, 10, 2], "semantic": {"name": "sr", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " sr = SpatialRefSys.objects.using(connection.alias).get(srid=srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L35_C8", "label": "units, units_name =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L32_C4", "vector": [14, 2, 0.119, 0.0034, 2, 0.3, 0.3333, 470, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "units, units_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " units, units_name = sr.units"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L36_C8", "label": "spheroid = get_spheroid()", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L32_C4", "vector": [14, 2, 0.1224, 0.0034, 2, 0.3, 0.6667, 289, 3, 1, 0, 0, 636, 10, 1], "semantic": {"name": "spheroid", "arg_names": [], "import_names": [], "rhs_call_name": "get_spheroid", "annotation": ""}, "snippet": " spheroid = SpatialRefSys.get_spheroid(sr.wkt)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L37_C8", "label": "assign", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L32_C4", "vector": [14, 2, 0.1259, 0.0034, 2, 0.3, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _srid_cache[connection.alias][srid] = (units, units_name, spheroid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L39_C4", "label": "return", "type": "return", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L13_C0", "vector": [13, 1, 0.1327, 0.0034, 1, 0.93, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _srid_cache[connection.alias][srid]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "label": "GeometryField", "type": "class", "loc": [41, 265], "level": 0, "parent": null, "vector": [3, 0, 0.5204, 0.7653, 0, 0.66, 0.5333, 100, 0, 16, 0, 0, 949, 0, 45], "semantic": {"name": "GeometryField", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GeometryField(Field):\n \"The base GIS field -- maps to the OpenGIS Specification Geometry type.\"\n\n # The OpenGIS Geometry name.\n geom_type = 'GEOMETRY'\n\n # Geodetic units.\n geodetic_units = ('Decimal Degree', 'degree')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L42_C4", "label": "expression", "type": "expression", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "vector": [8, 1, 0.1429, 0.0034, 1, 0.71, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"The base GIS field -- maps to the OpenGIS Specification Geometry type.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L45_C4", "label": "geom_type =", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "vector": [14, 1, 0.1531, 0.0034, 1, 0.71, 0.0526, 770, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "geom_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geom_type = 'GEOMETRY'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L48_C4", "label": "geodetic_units =", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "vector": [14, 1, 0.1633, 0.0034, 1, 0.71, 0.1053, 397, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "geodetic_units", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geodetic_units = ('Decimal Degree', 'degree')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L50_C4", "label": "description = _()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "vector": [14, 1, 0.1701, 0.0034, 1, 0.71, 0.1579, 306, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "description", "arg_names": [], "import_names": [], "rhs_call_name": "_", "annotation": ""}, "snippet": " description = _(\"The base GIS field -- maps to the OpenGIS Specification Geometry type.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L52_C4", "label": "__init__", "type": "function", "loc": [52, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "vector": [2, 1, 0.2619, 0.1735, 1, 0.71, 0.2105, 555, 0, 7, 0, 0, 0, 0, 4], "semantic": {"name": "__init__", "arg_names": ["self", "verbose_name", "srid", "spatial_index", "dim", "geography", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, verbose_name=None, srid=4326, spatial_index=True, dim=2,\n geography=False, **kwargs):\n \"\"\"\n The initialization function for geometry fields. Takes the following\n as keyword arguments:\n\n srid:\n The spatial reference system identifier, an OGC standard."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L54_C8", "label": "expression", "type": "expression", "loc": [54, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L52_C4", "vector": [8, 2, 0.2245, 0.085, 2, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n The initialization function for geometry fields. Takes the following\n as keyword arguments:\n\n srid:\n The spatial reference system identifier, an OGC standard.\n Defaults to 4326 (WGS84).\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L81_C8", "label": "self.spatial_index =", "type": "assigned_variable", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L52_C4", "vector": [14, 2, 0.2755, 0.0034, 2, 0.75, 0.125, 521, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.spatial_index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.spatial_index = spatial_index"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L85_C8", "label": "self.srid =", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L52_C4", "vector": [14, 2, 0.2891, 0.0034, 2, 0.75, 0.25, 289, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.srid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.srid = srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L88_C8", "label": "self.dim =", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L52_C4", "vector": [14, 2, 0.2993, 0.0034, 2, 0.75, 0.375, 239, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.dim", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dim = dim"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L92_C8", "label": "assign", "type": "assigned_variable", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L52_C4", "vector": [14, 2, 0.3129, 0.0034, 2, 0.75, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kwargs['verbose_name'] = verbose_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L95_C8", "label": "self.geography =", "type": "assigned_variable", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L52_C4", "vector": [14, 2, 0.3231, 0.0034, 2, 0.75, 0.625, 663, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.geography", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.geography = geography"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L99_C8", "label": "self._extent = pop()", "type": "assigned_variable", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L52_C4", "vector": [14, 2, 0.3367, 0.0034, 2, 0.75, 0.75, 8, 3, 2, 0, 0, 969, 10, 1], "semantic": {"name": "self._extent", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " self._extent = kwargs.pop('extent', (-180.0, -90.0, 180.0, 90.0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L100_C8", "label": "self._tolerance = pop()", "type": "assigned_variable", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L52_C4", "vector": [14, 2, 0.3401, 0.0034, 2, 0.75, 0.875, 504, 3, 2, 0, 0, 969, 10, 1], "semantic": {"name": "self._tolerance", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " self._tolerance = kwargs.pop('tolerance', 0.05)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L102_C8", "label": "__init__()", "type": "expression", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L52_C4", "vector": [8, 2, 0.3469, 0.0034, 2, 0.75, 1.0, 555, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(GeometryField, self).__init__(**kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L106_C4", "label": "_get_srid_info", "type": "function", "loc": [106, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "vector": [2, 1, 0.3639, 0.0102, 1, 0.71, 0.2632, 221, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_get_srid_info", "arg_names": ["self", "connection"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_srid_info(self, connection):\n # Get attributes from `get_srid_info`.\n self._units, self._units_name, self._spheroid = get_srid_info(self.srid, connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L108_C8", "label": " = get_srid_info()", "type": "assigned_variable", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L106_C4", "vector": [14, 2, 0.3673, 0.0034, 2, 0.9, 0.0, 0, 3, 2, 0, 0, 701, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "get_srid_info", "annotation": ""}, "snippet": " self._units, self._units_name, self._spheroid = get_srid_info(self.srid, connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L110_C4", "label": "spheroid", "type": "function", "loc": [110, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "vector": [2, 1, 0.3793, 0.0136, 1, 0.71, 0.3158, 289, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "spheroid", "arg_names": ["self", "connection"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def spheroid(self, connection):\n if not hasattr(self, '_spheroid'):\n self._get_srid_info(connection)\n return self._spheroid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L111_C8", "label": "if", "type": "if", "loc": [111, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L110_C4", "vector": [4, 2, 0.3793, 0.0068, 2, 0.32, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not hasattr(self, '_spheroid'):\n self._get_srid_info(connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L112_C12", "label": "_get_srid_info()", "type": "expression", "loc": [112, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L111_C8", "vector": [8, 3, 0.381, 0.0034, 3, 0.86, 0.0, 221, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_get_srid_info", "arg_names": [], "import_names": [], "rhs_call_name": "_get_srid_info", "annotation": ""}, "snippet": " self._get_srid_info(connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L113_C8", "label": "return", "type": "return", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L110_C4", "vector": [13, 2, 0.3844, 0.0034, 2, 0.32, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._spheroid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L115_C4", "label": "units", "type": "function", "loc": [115, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "vector": [2, 1, 0.3963, 0.0136, 1, 0.71, 0.3684, 805, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "units", "arg_names": ["self", "connection"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def units(self, connection):\n if not hasattr(self, '_units'):\n self._get_srid_info(connection)\n return self._units"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L116_C8", "label": "if", "type": "if", "loc": [116, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L115_C4", "vector": [4, 2, 0.3963, 0.0068, 2, 0.64, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not hasattr(self, '_units'):\n self._get_srid_info(connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L117_C12", "label": "_get_srid_info()", "type": "expression", "loc": [117, 117], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L116_C8", "vector": [8, 3, 0.398, 0.0034, 3, 0.69, 0.0, 221, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_get_srid_info", "arg_names": [], "import_names": [], "rhs_call_name": "_get_srid_info", "annotation": ""}, "snippet": " self._get_srid_info(connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L118_C8", "label": "return", "type": "return", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L115_C4", "vector": [13, 2, 0.4014, 0.0034, 2, 0.64, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._units"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L120_C4", "label": "units_name", "type": "function", "loc": [120, 123], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "vector": [2, 1, 0.4133, 0.0136, 1, 0.71, 0.4211, 992, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "units_name", "arg_names": ["self", "connection"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def units_name(self, connection):\n if not hasattr(self, '_units_name'):\n self._get_srid_info(connection)\n return self._units_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L121_C8", "label": "if", "type": "if", "loc": [121, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L120_C4", "vector": [4, 2, 0.4133, 0.0068, 2, 0.21, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not hasattr(self, '_units_name'):\n self._get_srid_info(connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L122_C12", "label": "_get_srid_info()", "type": "expression", "loc": [122, 122], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L121_C8", "vector": [8, 3, 0.415, 0.0034, 3, 0.4, 0.0, 221, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_get_srid_info", "arg_names": [], "import_names": [], "rhs_call_name": "_get_srid_info", "annotation": ""}, "snippet": " self._get_srid_info(connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L123_C8", "label": "return", "type": "return", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L120_C4", "vector": [13, 2, 0.4184, 0.0034, 2, 0.21, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._units_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L126_C4", "label": "geodetic", "type": "function", "loc": [126, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "vector": [2, 1, 0.4371, 0.0204, 1, 0.71, 0.4737, 279, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "geodetic", "arg_names": ["self", "connection"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geodetic(self, connection):\n \"\"\"\n Returns true if this field's SRID corresponds with a coordinate\n system that uses non-projected units (e.g., latitude/longitude).\n \"\"\"\n return self.units_name(connection) in self.geodetic_units"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L127_C8", "label": "expression", "type": "expression", "loc": [127, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L126_C4", "vector": [8, 2, 0.4371, 0.0136, 2, 0.9, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns true if this field's SRID corresponds with a coordinate\n system that uses non-projected units (e.g., latitude/longitude).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L131_C8", "label": "return", "type": "return", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L126_C4", "vector": [13, 2, 0.4456, 0.0034, 2, 0.9, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.units_name(connection) in self.geodetic_units"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L133_C4", "label": "get_distance", "type": "function", "loc": [133, 139], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "vector": [2, 1, 0.4626, 0.0238, 1, 0.71, 0.5263, 243, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "get_distance", "arg_names": ["self", "value", "lookup_type", "connection"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_distance(self, value, lookup_type, connection):\n \"\"\"\n Returns a distance number in units of the field. For example, if\n `D(km=1)` was passed in and the units of the field were in meters,\n then 1000 would be returned.\n \"\"\"\n return connection.ops.get_distance(self, value, lookup_type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L134_C8", "label": "expression", "type": "expression", "loc": [134, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L133_C4", "vector": [8, 2, 0.4626, 0.017, 2, 0.19, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a distance number in units of the field. For example, if\n `D(km=1)` was passed in and the units of the field were in meters,\n then 1000 would be returned.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L139_C8", "label": "return", "type": "return", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L133_C4", "vector": [13, 2, 0.4728, 0.0034, 2, 0.19, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return connection.ops.get_distance(self, value, lookup_type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L141_C4", "label": "get_prep_value", "type": "function", "loc": [141, 178], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "vector": [2, 1, 0.5425, 0.1293, 1, 0.71, 0.5789, 109, 0, 2, 1, 0, 0, 0, 12], "semantic": {"name": "get_prep_value", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_prep_value(self, value):\n \"\"\"\n Spatial lookup values are either a parameter that is (or may be\n converted to) a geometry, or a sequence of lookup values that\n begins with a geometry. This routine will setup the geometry\n value properly, and preserve any other lookup parameters before\n returning to the caller.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L142_C8", "label": "expression", "type": "expression", "loc": [142, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L141_C4", "vector": [8, 2, 0.4932, 0.0238, 2, 0.47, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Spatial lookup values are either a parameter that is (or may be\n converted to) a geometry, or a sequence of lookup values that\n begins with a geometry. This routine will setup the geometry\n value properly, and preserve any other lookup parameters before\n returning to the caller.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L149_C8", "label": "if", "type": "if", "loc": [149, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L141_C4", "vector": [4, 2, 0.5187, 0.0272, 2, 0.47, 0.25, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, SQLEvaluator):\n return value\n elif isinstance(value, (tuple, list)):\n geom = value[0]\n seq_value = True\n else:\n geom = value\n seq_value = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L150_C12", "label": "return", "type": "return", "loc": [150, 150], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L149_C8", "vector": [13, 3, 0.5102, 0.0034, 3, 0.52, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L151_C8", "label": "if", "type": "if", "loc": [151, 156], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L149_C8", "vector": [4, 3, 0.5221, 0.0204, 3, 0.52, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, (tuple, list)):\n geom = value[0]\n seq_value = True\n else:\n geom = value\n seq_value = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L152_C12", "label": "geom =", "type": "assigned_variable", "loc": [152, 152], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L151_C8", "vector": [14, 4, 0.517, 0.0034, 4, 0.14, 0.0, 5, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geom", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geom = value[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L153_C12", "label": "seq_value =", "type": "assigned_variable", "loc": [153, 153], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L151_C8", "vector": [14, 4, 0.5204, 0.0034, 4, 0.14, 0.3333, 128, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "seq_value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " seq_value = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L155_C12", "label": "geom =", "type": "assigned_variable", "loc": [155, 155], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L151_C8", "vector": [14, 4, 0.5272, 0.0034, 4, 0.14, 0.6667, 5, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geom", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geom = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L156_C12", "label": "seq_value =", "type": "assigned_variable", "loc": [156, 156], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L151_C8", "vector": [14, 4, 0.5306, 0.0034, 4, 0.14, 1.0, 128, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "seq_value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " seq_value = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L160_C8", "label": "if", "type": "if", "loc": [160, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L141_C4", "vector": [4, 2, 0.5578, 0.0306, 2, 0.47, 0.5, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(geom, Geometry):\n pass\n elif isinstance(geom, basestring) or hasattr(geom, '__geo_interface__'):\n try:\n geom = Geometry(geom)\n except GeometryException:\n raise ValueError('Could not create geometry from lookup value.')\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L162_C8", "label": "if", "type": "if", "loc": [162, 168], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L160_C8", "vector": [4, 3, 0.5612, 0.0238, 3, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(geom, basestring) or hasattr(geom, '__geo_interface__'):\n try:\n geom = Geometry(geom)\n except GeometryException:\n raise ValueError('Could not create geometry from lookup value.')\n else:\n raise ValueError('Cannot use object with type %s for a geometry lookup parameter.' % type(geom).__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Try_L163_C12", "label": "try", "type": "try", "loc": [163, 166], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L162_C8", "vector": [7, 4, 0.5595, 0.0136, 4, 0.5, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n geom = Geometry(geom)\n except GeometryException:\n raise ValueError('Could not create geometry from lookup value.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L164_C16", "label": "geom = Geometry()", "type": "assigned_variable", "loc": [164, 164], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:Try_L163_C12", "vector": [14, 5, 0.5578, 0.0034, 5, 0.94, 0.0, 5, 3, 1, 0, 0, 361, 10, 1], "semantic": {"name": "geom", "arg_names": [], "import_names": [], "rhs_call_name": "Geometry", "annotation": ""}, "snippet": " geom = Geometry(geom)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L171_C8", "label": "geom.srid = get_srid()", "type": "assigned_variable", "loc": [171, 171], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L141_C4", "vector": [14, 2, 0.5816, 0.0034, 2, 0.47, 0.75, 479, 3, 1, 0, 0, 892, 10, 1], "semantic": {"name": "geom.srid", "arg_names": [], "import_names": [], "rhs_call_name": "get_srid", "annotation": ""}, "snippet": " geom.srid = self.get_srid(geom)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L173_C8", "label": "if", "type": "if", "loc": [173, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L141_C4", "vector": [4, 2, 0.5969, 0.0204, 2, 0.47, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if seq_value:\n lookup_val = [geom]\n lookup_val.extend(value[1:])\n return tuple(lookup_val)\n else:\n return geom"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L174_C12", "label": "lookup_val =", "type": "assigned_variable", "loc": [174, 174], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L173_C8", "vector": [14, 3, 0.5918, 0.0034, 3, 0.16, 0.0, 380, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "lookup_val", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lookup_val = [geom]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L175_C12", "label": "extend()", "type": "expression", "loc": [175, 175], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L173_C8", "vector": [8, 3, 0.5952, 0.0034, 3, 0.16, 0.3333, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " lookup_val.extend(value[1:])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L176_C12", "label": "return", "type": "return", "loc": [176, 176], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L173_C8", "vector": [13, 3, 0.5986, 0.0034, 3, 0.16, 0.6667, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return tuple(lookup_val)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L178_C12", "label": "return", "type": "return", "loc": [178, 178], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L173_C8", "vector": [13, 3, 0.6054, 0.0034, 3, 0.16, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return geom"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L180_C4", "label": "get_srid", "type": "function", "loc": [180, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "vector": [2, 1, 0.6293, 0.0374, 1, 0.71, 0.6316, 892, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "get_srid", "arg_names": ["self", "geom"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_srid(self, geom):\n \"\"\"\n Returns the default SRID for the given geometry, taking into account\n the SRID set for the field. For example, if the input geometry\n has no SRID, then that of the field will be returned.\n \"\"\"\n gsrid = geom.srid # SRID of given geometry.\n if gsrid is None or self.srid == -1 or (gsrid == -1 and self.srid != -1):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L181_C8", "label": "expression", "type": "expression", "loc": [181, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L180_C4", "vector": [8, 2, 0.6224, 0.017, 2, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the default SRID for the given geometry, taking into account\n the SRID set for the field. For example, if the input geometry\n has no SRID, then that of the field will be returned.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L186_C8", "label": "gsrid =", "type": "assigned_variable", "loc": [186, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L180_C4", "vector": [14, 2, 0.6327, 0.0034, 2, 0.15, 0.5, 448, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "gsrid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " gsrid = geom.srid # SRID of given geometry."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L187_C8", "label": "if", "type": "if", "loc": [187, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L180_C4", "vector": [4, 2, 0.6412, 0.0136, 2, 0.15, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if gsrid is None or self.srid == -1 or (gsrid == -1 and self.srid != -1):\n return self.srid\n else:\n return gsrid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L188_C12", "label": "return", "type": "return", "loc": [188, 188], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L187_C8", "vector": [13, 3, 0.6395, 0.0034, 3, 0.69, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L190_C12", "label": "return", "type": "return", "loc": [190, 190], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L187_C8", "vector": [13, 3, 0.6463, 0.0034, 3, 0.69, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return gsrid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L193_C4", "label": "contribute_to_class", "type": "function", "loc": [193, 197], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "vector": [2, 1, 0.6633, 0.017, 1, 0.71, 0.6842, 973, 0, 3, 0, 0, 0, 0, 4], "semantic": {"name": "contribute_to_class", "arg_names": ["self", "cls", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def contribute_to_class(self, cls, name):\n super(GeometryField, self).contribute_to_class(cls, name)\n\n # Setup for lazy-instantiated Geometry object.\n setattr(cls, self.attname, GeometryProxy(Geometry, self))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L194_C8", "label": "contribute_to_class()", "type": "expression", "loc": [194, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L193_C4", "vector": [8, 2, 0.6599, 0.0034, 2, 0.01, 0.0, 973, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "contribute_to_class", "arg_names": [], "import_names": [], "rhs_call_name": "contribute_to_class", "annotation": ""}, "snippet": " super(GeometryField, self).contribute_to_class(cls, name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L197_C8", "label": "setattr()", "type": "expression", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L193_C4", "vector": [8, 2, 0.6701, 0.0034, 2, 0.01, 1.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(cls, self.attname, GeometryProxy(Geometry, self))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L199_C4", "label": "db_type", "type": "function", "loc": [199, 200], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "vector": [2, 1, 0.6786, 0.0068, 1, 0.71, 0.7368, 976, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "db_type", "arg_names": ["self", "connection"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def db_type(self, connection):\n return connection.ops.geo_db_type(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L200_C8", "label": "return", "type": "return", "loc": [200, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L199_C4", "vector": [13, 2, 0.6803, 0.0034, 2, 0.28, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return connection.ops.geo_db_type(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L202_C4", "label": "formfield", "type": "function", "loc": [202, 209], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "vector": [2, 1, 0.699, 0.0272, 1, 0.71, 0.7895, 732, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "formfield", "arg_names": ["self", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def formfield(self, **kwargs):\n defaults = {'form_class' : forms.GeometryField,\n 'null' : self.null,\n 'geom_type' : self.geom_type,\n 'srid' : self.srid,\n }\n defaults.update(kwargs)\n return super(GeometryField, self).formfield(**defaults)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L203_C8", "label": "defaults =", "type": "assigned_variable", "loc": [203, 207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L202_C4", "vector": [14, 2, 0.6973, 0.017, 2, 0.77, 0.0, 233, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "defaults", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " defaults = {'form_class' : forms.GeometryField,\n 'null' : self.null,\n 'geom_type' : self.geom_type,\n 'srid' : self.srid,\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L208_C8", "label": "update()", "type": "expression", "loc": [208, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L202_C4", "vector": [8, 2, 0.7075, 0.0034, 2, 0.77, 0.5, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " defaults.update(kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L209_C8", "label": "return", "type": "return", "loc": [209, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L202_C4", "vector": [13, 2, 0.7109, 0.0034, 2, 0.77, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return super(GeometryField, self).formfield(**defaults)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L211_C4", "label": "get_db_prep_lookup", "type": "function", "loc": [211, 245], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "vector": [2, 1, 0.7755, 0.119, 1, 0.71, 0.8421, 681, 0, 5, 1, 0, 0, 0, 6], "semantic": {"name": "get_db_prep_lookup", "arg_names": ["self", "lookup_type", "value", "connection", "prepared"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_db_prep_lookup(self, lookup_type, value, connection, prepared=False):\n \"\"\"\n Prepare for the database lookup, and return any spatial parameters\n necessary for the query. This includes wrapping any geometry\n parameters with a backend-specific adapter and formatting any distance\n parameters into the correct units for the coordinate system of the\n field.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L212_C8", "label": "expression", "type": "expression", "loc": [212, 218], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L211_C4", "vector": [8, 2, 0.7313, 0.0238, 2, 0.6, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Prepare for the database lookup, and return any spatial parameters\n necessary for the query. This includes wrapping any geometry\n parameters with a backend-specific adapter and formatting any distance\n parameters into the correct units for the coordinate system of the\n field.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L219_C8", "label": "if", "type": "if", "loc": [219, 245], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L211_C4", "vector": [4, 2, 0.7891, 0.0918, 2, 0.6, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lookup_type in connection.ops.gis_terms:\n # special case for isnull lookup\n if lookup_type == 'isnull':\n return []\n\n # Populating the parameters list, and wrapping the Geometry\n # with the Adapter of the spatial backend.\n if isinstance(value, (tuple, list)):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L221_C12", "label": "if", "type": "if", "loc": [221, 222], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L219_C8", "vector": [4, 3, 0.7534, 0.0068, 3, 0.78, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lookup_type == 'isnull':\n return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L222_C16", "label": "return", "type": "return", "loc": [222, 222], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L221_C12", "vector": [13, 4, 0.7551, 0.0034, 4, 0.24, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L226_C12", "label": "if", "type": "if", "loc": [226, 240], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L219_C8", "vector": [4, 3, 0.7925, 0.051, 3, 0.78, 0.5, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, (tuple, list)):\n params = [connection.ops.Adapter(value[0])]\n if lookup_type in connection.ops.distance_functions:\n # Getting the distance parameter in the units of the field.\n params += self.get_distance(value[1:], lookup_type, connection)\n elif lookup_type in connection.ops.truncate_params:\n # Lookup is one where SQL parameters aren't needed from the\n # given lookup value."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L227_C16", "label": "params =", "type": "assigned_variable", "loc": [227, 227], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L226_C12", "vector": [14, 4, 0.7721, 0.0034, 4, 0.19, 0.0, 206, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = [connection.ops.Adapter(value[0])]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L228_C16", "label": "if", "type": "if", "loc": [228, 236], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L226_C12", "vector": [4, 4, 0.7891, 0.0306, 4, 0.19, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lookup_type in connection.ops.distance_functions:\n # Getting the distance parameter in the units of the field.\n params += self.get_distance(value[1:], lookup_type, connection)\n elif lookup_type in connection.ops.truncate_params:\n # Lookup is one where SQL parameters aren't needed from the\n # given lookup value.\n pass\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L231_C16", "label": "if", "type": "if", "loc": [231, 236], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L228_C16", "vector": [4, 5, 0.7942, 0.0204, 5, 0.96, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif lookup_type in connection.ops.truncate_params:\n # Lookup is one where SQL parameters aren't needed from the\n # given lookup value.\n pass\n else:\n params += value[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L237_C12", "label": "if", "type": "if", "loc": [237, 240], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L226_C12", "vector": [4, 4, 0.8112, 0.0136, 4, 0.19, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, SQLEvaluator):\n params = []\n else:\n params = [connection.ops.Adapter(value)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L238_C16", "label": "params =", "type": "assigned_variable", "loc": [238, 238], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L237_C12", "vector": [14, 5, 0.8095, 0.0034, 5, 0.83, 0.0, 206, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L240_C16", "label": "params =", "type": "assigned_variable", "loc": [240, 240], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L237_C12", "vector": [14, 5, 0.8163, 0.0034, 5, 0.83, 1.0, 206, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = [connection.ops.Adapter(value)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L242_C12", "label": "return", "type": "return", "loc": [242, 242], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L219_C8", "vector": [13, 3, 0.8231, 0.0034, 3, 0.78, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return params"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L247_C4", "label": "get_prep_lookup", "type": "function", "loc": [247, 251], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "vector": [2, 1, 0.8469, 0.017, 1, 0.71, 0.8947, 384, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "get_prep_lookup", "arg_names": ["self", "lookup_type", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_prep_lookup(self, lookup_type, value):\n if lookup_type == 'isnull':\n return bool(value)\n else:\n return self.get_prep_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L248_C8", "label": "if", "type": "if", "loc": [248, 251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L247_C4", "vector": [4, 2, 0.8486, 0.0136, 2, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lookup_type == 'isnull':\n return bool(value)\n else:\n return self.get_prep_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L249_C12", "label": "return", "type": "return", "loc": [249, 249], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L248_C8", "vector": [13, 3, 0.8469, 0.0034, 3, 0.16, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bool(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L251_C12", "label": "return", "type": "return", "loc": [251, 251], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L248_C8", "vector": [13, 3, 0.8537, 0.0034, 3, 0.16, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_prep_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L253_C4", "label": "get_db_prep_save", "type": "function", "loc": [253, 258], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "vector": [2, 1, 0.869, 0.0204, 1, 0.71, 0.9474, 337, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "get_db_prep_save", "arg_names": ["self", "value", "connection"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_db_prep_save(self, value, connection):\n \"Prepares the value for saving in the database.\"\n if value is None:\n return None\n else:\n return connection.ops.Adapter(self.get_prep_value(value))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L254_C8", "label": "expression", "type": "expression", "loc": [254, 254], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L253_C4", "vector": [8, 2, 0.8639, 0.0034, 2, 0.2, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Prepares the value for saving in the database.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L255_C8", "label": "if", "type": "if", "loc": [255, 258], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L253_C4", "vector": [4, 2, 0.8724, 0.0136, 2, 0.2, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value is None:\n return None\n else:\n return connection.ops.Adapter(self.get_prep_value(value))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L256_C12", "label": "return", "type": "return", "loc": [256, 256], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L255_C8", "vector": [13, 3, 0.8707, 0.0034, 3, 0.71, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L258_C12", "label": "return", "type": "return", "loc": [258, 258], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L255_C8", "vector": [13, 3, 0.8776, 0.0034, 3, 0.71, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return connection.ops.Adapter(self.get_prep_value(value))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L260_C4", "label": "get_placeholder", "type": "function", "loc": [260, 265], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "vector": [2, 1, 0.8929, 0.0204, 1, 0.71, 1.0, 571, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "get_placeholder", "arg_names": ["self", "value", "connection"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_placeholder(self, value, connection):\n \"\"\"\n Returns the placeholder for the geometry column for the\n given value.\n \"\"\"\n return connection.ops.get_geom_placeholder(self, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L261_C8", "label": "expression", "type": "expression", "loc": [261, 264], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L260_C4", "vector": [8, 2, 0.8929, 0.0136, 2, 0.5, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the placeholder for the geometry column for the\n given value.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L265_C8", "label": "return", "type": "return", "loc": [265, 265], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L260_C4", "vector": [13, 2, 0.9014, 0.0034, 2, 0.5, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return connection.ops.get_geom_placeholder(self, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L268_C0", "label": "PointField", "type": "class", "loc": [268, 270], "level": 0, "parent": null, "vector": [3, 0, 0.915, 0.0102, 0, 0.66, 0.6, 260, 0, 0, 0, 0, 100, 0, 1], "semantic": {"name": "PointField", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PointField(GeometryField):\n geom_type = 'POINT'\n description = _(\"Point\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L269_C4", "label": "geom_type =", "type": "assigned_variable", "loc": [269, 269], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L268_C0", "vector": [14, 1, 0.915, 0.0034, 1, 0.65, 0.0, 770, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "geom_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geom_type = 'POINT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L270_C4", "label": "description = _()", "type": "assigned_variable", "loc": [270, 270], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L268_C0", "vector": [14, 1, 0.9184, 0.0034, 1, 0.65, 1.0, 306, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "description", "arg_names": [], "import_names": [], "rhs_call_name": "_", "annotation": ""}, "snippet": " description = _(\"Point\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L272_C0", "label": "LineStringField", "type": "class", "loc": [272, 274], "level": 0, "parent": null, "vector": [3, 0, 0.9286, 0.0102, 0, 0.66, 0.6667, 237, 0, 0, 0, 0, 100, 0, 1], "semantic": {"name": "LineStringField", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class LineStringField(GeometryField):\n geom_type = 'LINESTRING'\n description = _(\"Line string\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L273_C4", "label": "geom_type =", "type": "assigned_variable", "loc": [273, 273], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L272_C0", "vector": [14, 1, 0.9286, 0.0034, 1, 0.47, 0.0, 770, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "geom_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geom_type = 'LINESTRING'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L274_C4", "label": "description = _()", "type": "assigned_variable", "loc": [274, 274], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L272_C0", "vector": [14, 1, 0.932, 0.0034, 1, 0.47, 1.0, 306, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "description", "arg_names": [], "import_names": [], "rhs_call_name": "_", "annotation": ""}, "snippet": " description = _(\"Line string\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L276_C0", "label": "PolygonField", "type": "class", "loc": [276, 278], "level": 0, "parent": null, "vector": [3, 0, 0.9422, 0.0102, 0, 0.66, 0.7333, 736, 0, 0, 0, 0, 100, 0, 1], "semantic": {"name": "PolygonField", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PolygonField(GeometryField):\n geom_type = 'POLYGON'\n description = _(\"Polygon\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L277_C4", "label": "geom_type =", "type": "assigned_variable", "loc": [277, 277], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L276_C0", "vector": [14, 1, 0.9422, 0.0034, 1, 0.72, 0.0, 770, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "geom_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geom_type = 'POLYGON'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L278_C4", "label": "description = _()", "type": "assigned_variable", "loc": [278, 278], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L276_C0", "vector": [14, 1, 0.9456, 0.0034, 1, 0.72, 1.0, 306, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "description", "arg_names": [], "import_names": [], "rhs_call_name": "_", "annotation": ""}, "snippet": " description = _(\"Polygon\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L280_C0", "label": "MultiPointField", "type": "class", "loc": [280, 282], "level": 0, "parent": null, "vector": [3, 0, 0.9558, 0.0102, 0, 0.66, 0.8, 240, 0, 0, 0, 0, 100, 0, 1], "semantic": {"name": "MultiPointField", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MultiPointField(GeometryField):\n geom_type = 'MULTIPOINT'\n description = _(\"Multi-point\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L281_C4", "label": "geom_type =", "type": "assigned_variable", "loc": [281, 281], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L280_C0", "vector": [14, 1, 0.9558, 0.0034, 1, 0.52, 0.0, 770, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "geom_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geom_type = 'MULTIPOINT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L282_C4", "label": "description = _()", "type": "assigned_variable", "loc": [282, 282], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L280_C0", "vector": [14, 1, 0.9592, 0.0034, 1, 0.52, 1.0, 306, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "description", "arg_names": [], "import_names": [], "rhs_call_name": "_", "annotation": ""}, "snippet": " description = _(\"Multi-point\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L284_C0", "label": "MultiLineStringField", "type": "class", "loc": [284, 286], "level": 0, "parent": null, "vector": [3, 0, 0.9694, 0.0102, 0, 0.66, 0.8667, 209, 0, 0, 0, 0, 100, 0, 1], "semantic": {"name": "MultiLineStringField", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MultiLineStringField(GeometryField):\n geom_type = 'MULTILINESTRING'\n description = _(\"Multi-line string\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L285_C4", "label": "geom_type =", "type": "assigned_variable", "loc": [285, 285], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L284_C0", "vector": [14, 1, 0.9694, 0.0034, 1, 0.79, 0.0, 770, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "geom_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geom_type = 'MULTILINESTRING'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L286_C4", "label": "description = _()", "type": "assigned_variable", "loc": [286, 286], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L284_C0", "vector": [14, 1, 0.9728, 0.0034, 1, 0.79, 1.0, 306, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "description", "arg_names": [], "import_names": [], "rhs_call_name": "_", "annotation": ""}, "snippet": " description = _(\"Multi-line string\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L288_C0", "label": "MultiPolygonField", "type": "class", "loc": [288, 290], "level": 0, "parent": null, "vector": [3, 0, 0.983, 0.0102, 0, 0.66, 0.9333, 682, 0, 0, 0, 0, 100, 0, 1], "semantic": {"name": "MultiPolygonField", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MultiPolygonField(GeometryField):\n geom_type = 'MULTIPOLYGON'\n description = _(\"Multi polygon\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L289_C4", "label": "geom_type =", "type": "assigned_variable", "loc": [289, 289], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L288_C0", "vector": [14, 1, 0.983, 0.0034, 1, 0.33, 0.0, 770, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "geom_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geom_type = 'MULTIPOLYGON'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L290_C4", "label": "description = _()", "type": "assigned_variable", "loc": [290, 290], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L288_C0", "vector": [14, 1, 0.9864, 0.0034, 1, 0.33, 1.0, 306, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "description", "arg_names": [], "import_names": [], "rhs_call_name": "_", "annotation": ""}, "snippet": " description = _(\"Multi polygon\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L292_C0", "label": "GeometryCollectionField", "type": "class", "loc": [292, 294], "level": 0, "parent": null, "vector": [3, 0, 0.9966, 0.0102, 0, 0.66, 1.0, 798, 0, 0, 0, 0, 100, 0, 1], "semantic": {"name": "GeometryCollectionField", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GeometryCollectionField(GeometryField):\n geom_type = 'GEOMETRYCOLLECTION'\n description = _(\"Geometry collection\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L293_C4", "label": "geom_type =", "type": "assigned_variable", "loc": [293, 293], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L292_C0", "vector": [14, 1, 0.9966, 0.0034, 1, 0.68, 0.0, 770, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "geom_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geom_type = 'GEOMETRYCOLLECTION'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L294_C4", "label": "description = _()", "type": "assigned_variable", "loc": [294, 294], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L292_C0", "vector": [14, 1, 1.0, 0.0034, 1, 0.68, 1.0, 306, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "description", "arg_names": [], "import_names": [], "rhs_call_name": "_", "annotation": ""}, "snippet": " description = _(\"Geometry collection\")"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Try_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:Try_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:Try_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L110_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L111_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L112_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L110_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L117_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L120_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L121_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L122_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L120_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L141_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L141_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L149_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L150_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L149_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L151_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L152_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L151_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L153_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L151_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L155_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L151_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L156_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L141_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L160_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L162_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Try_L163_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:Try_L163_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L164_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L141_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L171_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L141_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L173_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L173_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L174_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L173_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L175_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L173_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L176_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L173_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L178_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L180_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L181_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L186_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L187_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L187_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L188_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L187_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L190_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L193_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L193_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L194_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L193_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L197_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L199_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L203_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L208_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L209_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L211_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L211_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L212_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L211_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L219_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L219_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L221_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L221_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L222_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L219_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L226_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L226_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L227_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L226_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L228_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L228_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L231_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L226_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L237_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L237_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L238_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L237_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L240_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L219_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L242_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L247_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L247_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L248_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L248_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L249_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L248_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L251_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L253_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L254_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L255_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L255_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L256_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:If_L255_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L258_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L260_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L260_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L261_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L260_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Return_L265_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L269_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L270_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L272_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L273_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L272_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L274_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L276_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L277_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L276_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L278_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L280_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L281_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L280_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L282_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L284_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L285_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L284_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L286_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L288_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L289_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L288_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L290_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L292_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L293_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:ClassDef_L292_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Assign_L294_C4"}] |
"""
The GeometryProxy object, allows for lazy-geometries. The proxy uses
Python descriptors for instantiating and setting Geometry objects
corresponding to geographic model fields.
Thanks to Robert Coup for providing this functionality (see #4322).
"""
class GeometryProxy(object):
def __init__(self, klass, field):
"""
Proxy initializes on the given Geometry class (not an instance) and
the GeometryField.
"""
self._field = field
self._klass = klass
def __get__(self, obj, type=None):
"""
This accessor retrieves the geometry, initializing it using the geometry
class specified during initialization and the HEXEWKB value of the field.
Currently, only GEOS or OGR geometries are supported.
"""
if obj is None:
# Accessed on a class, not an instance
return self
# Getting the value of the field.
geom_value = obj.__dict__[self._field.attname]
if isinstance(geom_value, self._klass):
geom = geom_value
elif (geom_value is None) or (geom_value==''):
geom = None
else:
# Otherwise, a Geometry object is built using the field's contents,
# and the model's corresponding attribute is set.
geom = self._klass(geom_value)
setattr(obj, self._field.attname, geom)
return geom
def __set__(self, obj, value):
"""
This accessor sets the proxied geometry with the geometry class
specified during initialization. Values of None, HEXEWKB, or WKT may
be used to set the geometry as well.
"""
# The OGC Geometry type of the field.
gtype = self._field.geom_type
# The geometry type must match that of the field -- unless the
# general GeometryField is used.
if isinstance(value, self._klass) and (str(value.geom_type).upper() == gtype or gtype == 'GEOMETRY'):
# Assigning the SRID to the geometry.
if value.srid is None: value.srid = self._field.srid
elif value is None or isinstance(value, (basestring, buffer)):
# Set with None, WKT, HEX, or WKB
pass
else:
raise TypeError('cannot set %s GeometryProxy with value of type: %s' % (obj.__class__.__name__, type(value)))
# Setting the objects dictionary with the value, and returning.
obj.__dict__[self._field.attname] = value
return value
| ajibawa-2023/Python-Code-Large/train/row_98752 | 27 | 64 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98752:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0625, 0.1094, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThe GeometryProxy object, allows for lazy-geometries. The proxy uses\nPython descriptors for instantiating and setting Geometry objects\ncorresponding to geographic model fields.\n\nThanks to Robert Coup for providing this functionality (see #4322).\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:ClassDef_L9_C0", "label": "GeometryProxy", "type": "class", "loc": [9, 64], "level": 0, "parent": null, "vector": [3, 0, 0.5703, 0.875, 0, 0.66, 1.0, 637, 0, 3, 0, 0, 186, 0, 9], "semantic": {"name": "GeometryProxy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GeometryProxy(object):\n def __init__(self, klass, field):\n \"\"\"\n Proxy initializes on the given Geometry class (not an instance) and\n the GeometryField.\n \"\"\"\n self._field = field\n self._klass = klass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L10_C4", "label": "__init__", "type": "function", "loc": [10, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98752:ClassDef_L9_C0", "vector": [2, 1, 0.2031, 0.1094, 1, 0.3, 0.0, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "klass", "field"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, klass, field):\n \"\"\"\n Proxy initializes on the given Geometry class (not an instance) and\n the GeometryField.\n \"\"\"\n self._field = field\n self._klass = klass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:Expr_L11_C8", "label": "expression", "type": "expression", "loc": [11, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L10_C4", "vector": [8, 2, 0.1953, 0.0625, 2, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Proxy initializes on the given Geometry class (not an instance) and\n the GeometryField.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:Assign_L15_C8", "label": "self._field =", "type": "assigned_variable", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L10_C4", "vector": [14, 2, 0.2344, 0.0156, 2, 0.54, 0.5, 904, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._field = field"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:Assign_L16_C8", "label": "self._klass =", "type": "assigned_variable", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L10_C4", "vector": [14, 2, 0.25, 0.0156, 2, 0.54, 1.0, 280, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._klass", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._klass = klass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L18_C4", "label": "__get__", "type": "function", "loc": [18, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98752:ClassDef_L9_C0", "vector": [2, 1, 0.4531, 0.3594, 1, 0.3, 0.5, 93, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "__get__", "arg_names": ["self", "obj", "type"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __get__(self, obj, type=None):\n \"\"\"\n This accessor retrieves the geometry, initializing it using the geometry\n class specified during initialization and the HEXEWKB value of the field.\n Currently, only GEOS or OGR geometries are supported.\n \"\"\"\n if obj is None:\n # Accessed on a class, not an instance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:Expr_L19_C8", "label": "expression", "type": "expression", "loc": [19, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L18_C4", "vector": [8, 2, 0.3281, 0.0781, 2, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n This accessor retrieves the geometry, initializing it using the geometry\n class specified during initialization and the HEXEWKB value of the field.\n Currently, only GEOS or OGR geometries are supported.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L24_C8", "label": "if", "type": "if", "loc": [24, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L18_C4", "vector": [4, 2, 0.3906, 0.0469, 2, 0.88, 0.25, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if obj is None:\n # Accessed on a class, not an instance\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:Return_L26_C12", "label": "return", "type": "return", "loc": [26, 26], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L24_C8", "vector": [13, 3, 0.4062, 0.0156, 3, 0.68, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:Assign_L29_C8", "label": "geom_value =", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L18_C4", "vector": [14, 2, 0.4531, 0.0156, 2, 0.88, 0.5, 109, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geom_value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geom_value = obj.__dict__[self._field.attname]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L31_C8", "label": "if", "type": "if", "loc": [31, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L18_C4", "vector": [4, 2, 0.5469, 0.1406, 2, 0.88, 0.75, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(geom_value, self._klass):\n geom = geom_value\n elif (geom_value is None) or (geom_value==''):\n geom = None\n else:\n # Otherwise, a Geometry object is built using the field's contents,\n # and the model's corresponding attribute is set.\n geom = self._klass(geom_value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:Assign_L32_C12", "label": "geom =", "type": "assigned_variable", "loc": [32, 32], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L31_C8", "vector": [14, 3, 0.5, 0.0156, 3, 0.43, 0.0, 5, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geom", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geom = geom_value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L33_C8", "label": "if", "type": "if", "loc": [33, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L31_C8", "vector": [4, 3, 0.5625, 0.1094, 3, 0.43, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif (geom_value is None) or (geom_value==''):\n geom = None\n else:\n # Otherwise, a Geometry object is built using the field's contents,\n # and the model's corresponding attribute is set.\n geom = self._klass(geom_value)\n setattr(obj, self._field.attname, geom)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:Assign_L34_C12", "label": "geom =", "type": "assigned_variable", "loc": [34, 34], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L33_C8", "vector": [14, 4, 0.5312, 0.0156, 4, 0.01, 0.0, 5, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "geom", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geom = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:Assign_L38_C12", "label": "geom = _klass()", "type": "assigned_variable", "loc": [38, 38], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L33_C8", "vector": [14, 4, 0.5938, 0.0156, 4, 0.01, 0.5, 5, 3, 1, 0, 0, 991, 10, 1], "semantic": {"name": "geom", "arg_names": [], "import_names": [], "rhs_call_name": "_klass", "annotation": ""}, "snippet": " geom = self._klass(geom_value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:Expr_L39_C12", "label": "setattr()", "type": "expression", "loc": [39, 39], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L33_C8", "vector": [8, 4, 0.6094, 0.0156, 4, 0.01, 1.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(obj, self._field.attname, geom)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:Return_L40_C8", "label": "return", "type": "return", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L18_C4", "vector": [13, 2, 0.625, 0.0156, 2, 0.88, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return geom"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L42_C4", "label": "__set__", "type": "function", "loc": [42, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98752:ClassDef_L9_C0", "vector": [2, 1, 0.8281, 0.3594, 1, 0.3, 1.0, 145, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "__set__", "arg_names": ["self", "obj", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __set__(self, obj, value):\n \"\"\"\n This accessor sets the proxied geometry with the geometry class\n specified during initialization. Values of None, HEXEWKB, or WKT may\n be used to set the geometry as well.\n \"\"\"\n # The OGC Geometry type of the field.\n gtype = self._field.geom_type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:Expr_L43_C8", "label": "expression", "type": "expression", "loc": [43, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L42_C4", "vector": [8, 2, 0.7031, 0.0781, 2, 0.4, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n This accessor sets the proxied geometry with the geometry class\n specified during initialization. Values of None, HEXEWKB, or WKT may\n be used to set the geometry as well.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:Assign_L49_C8", "label": "gtype =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L42_C4", "vector": [14, 2, 0.7656, 0.0156, 2, 0.4, 0.25, 377, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "gtype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " gtype = self._field.geom_type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L53_C8", "label": "if", "type": "if", "loc": [53, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L42_C4", "vector": [4, 2, 0.8828, 0.125, 2, 0.4, 0.5, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, self._klass) and (str(value.geom_type).upper() == gtype or gtype == 'GEOMETRY'):\n # Assigning the SRID to the geometry.\n if value.srid is None: value.srid = self._field.srid\n elif value is None or isinstance(value, (basestring, buffer)):\n # Set with None, WKT, HEX, or WKB\n pass\n else:\n raise TypeError('cannot set %s GeometryProxy with value of type: %s' % (obj.__class__.__name__, type(value)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L55_C12", "label": "if", "type": "if", "loc": [55, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L53_C8", "vector": [4, 3, 0.8594, 0.0156, 3, 0.41, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value.srid is None: value.srid = self._field.srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:Assign_L55_C35", "label": "value.srid =", "type": "assigned_variable", "loc": [55, 55], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L55_C12", "vector": [14, 4, 0.8594, 0.0156, 4, 0.04, 0.0, 431, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "value.srid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value.srid is None: value.srid = self._field.srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L56_C8", "label": "if", "type": "if", "loc": [56, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L53_C8", "vector": [4, 3, 0.9062, 0.0781, 3, 0.41, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is None or isinstance(value, (basestring, buffer)):\n # Set with None, WKT, HEX, or WKB\n pass\n else:\n raise TypeError('cannot set %s GeometryProxy with value of type: %s' % (obj.__class__.__name__, type(value)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:Assign_L63_C8", "label": "assign", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L42_C4", "vector": [14, 2, 0.9844, 0.0156, 2, 0.4, 0.75, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj.__dict__[self._field.attname] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98752:Return_L64_C8", "label": "return", "type": "return", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L42_C4", "vector": [13, 2, 1.0, 0.0156, 2, 0.4, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return value"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98752:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:Expr_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:Assign_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98752:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:Expr_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L24_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:Return_L26_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L31_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:Assign_L32_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L31_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:Assign_L34_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:Assign_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:Expr_L39_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:Return_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98752:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:Expr_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L53_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L55_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:Assign_L55_C35"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L53_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:If_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:Assign_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:Return_L64_C8"}] |
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.contrib.gis.db.models.sql.where import GeoWhereNode
from django.contrib.gis.geometry.backend import Geometry
from django.contrib.gis.measure import Area, Distance
ALL_TERMS = dict([(x, None) for x in (
'bbcontains', 'bboverlaps', 'contained', 'contains',
'contains_properly', 'coveredby', 'covers', 'crosses', 'disjoint',
'distance_gt', 'distance_gte', 'distance_lt', 'distance_lte',
'dwithin', 'equals', 'exact',
'intersects', 'overlaps', 'relate', 'same_as', 'touches', 'within',
'left', 'right', 'overlaps_left', 'overlaps_right',
'overlaps_above', 'overlaps_below',
'strictly_above', 'strictly_below'
)])
ALL_TERMS.update(sql.constants.QUERY_TERMS)
class GeoQuery(sql.Query):
"""
A single spatial SQL query.
"""
# Overridding the valid query terms.
query_terms = ALL_TERMS
aggregates_module = gis_aggregates
compiler = 'GeoSQLCompiler'
#### Methods overridden from the base Query class ####
def __init__(self, model, where=GeoWhereNode):
super(GeoQuery, self).__init__(model, where)
# The following attributes are customized for the GeoQuerySet.
# The GeoWhereNode and SpatialBackend classes contain backend-specific
# routines and functions.
self.custom_select = {}
self.transformed_srid = None
self.extra_select_fields = {}
def clone(self, *args, **kwargs):
obj = super(GeoQuery, self).clone(*args, **kwargs)
# Customized selection dictionary and transformed srid flag have
# to also be added to obj.
obj.custom_select = self.custom_select.copy()
obj.transformed_srid = self.transformed_srid
obj.extra_select_fields = self.extra_select_fields.copy()
return obj
def convert_values(self, value, field, connection):
"""
Using the same routines that Oracle does we can convert our
extra selection objects into Geometry and Distance objects.
TODO: Make converted objects 'lazy' for less overhead.
"""
if connection.ops.oracle:
# Running through Oracle's first.
value = super(GeoQuery, self).convert_values(value, field or GeomField(), connection)
if value is None:
# Output from spatial function is NULL (e.g., called
# function on a geometry field with NULL value).
pass
elif isinstance(field, DistanceField):
# Using the field's distance attribute, can instantiate
# `Distance` with the right context.
value = Distance(**{field.distance_att : value})
elif isinstance(field, AreaField):
value = Area(**{field.area_att : value})
elif isinstance(field, (GeomField, GeometryField)) and value:
value = Geometry(value)
return value
def get_aggregation(self, using):
# Remove any aggregates marked for reduction from the subquery
# and move them to the outer AggregateQuery.
connection = connections[using]
for alias, aggregate in self.aggregate_select.items():
if isinstance(aggregate, gis_aggregates.GeoAggregate):
if not getattr(aggregate, 'is_extent', False) or connection.ops.oracle:
self.extra_select_fields[alias] = GeomField()
return super(GeoQuery, self).get_aggregation(using)
def resolve_aggregate(self, value, aggregate, connection):
"""
Overridden from GeoQuery's normalize to handle the conversion of
GeoAggregate objects.
"""
if isinstance(aggregate, self.aggregates_module.GeoAggregate):
if aggregate.is_extent:
if aggregate.is_extent == '3D':
return connection.ops.convert_extent3d(value)
else:
return connection.ops.convert_extent(value)
else:
return connection.ops.convert_geom(value, aggregate.source)
else:
return super(GeoQuery, self).resolve_aggregate(value, aggregate, connection)
# Private API utilities, subject to change.
def _geo_field(self, field_name=None):
"""
Returns the first Geometry field encountered; or specified via the
`field_name` keyword. The `field_name` may be a string specifying
the geometry field on this GeoQuery's model, or a lookup string
to a geometry field via a ForeignKey relation.
"""
if field_name is None:
# Incrementing until the first geographic field is found.
for fld in self.model._meta.fields:
if isinstance(fld, GeometryField): return fld
return False
else:
# Otherwise, check by the given field name -- which may be
# a lookup to a _related_ geographic field.
return GeoWhereNode._check_geo_field(self.model._meta, field_name)
| ajibawa-2023/Python-Code-Large/train/row_98753 | 62 | 119 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98753:ImportFrom_L1_C0", "label": "from django.db import connections", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0084, 0.0084, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["connections"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db import connections"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:ImportFrom_L2_C0", "label": "from django.db.models.query import sql", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0168, 0.0084, 0, 0.66, 0.1, 793, 0, 1, 0, 0, 793, 0, 0], "semantic": {"name": "django.db.models.query", "arg_names": [], "import_names": ["sql"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.models.query import sql"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:ImportFrom_L4_C0", "label": "from django.contrib.gis.db.models.fields import GeometryField", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0336, 0.0084, 0, 0.66, 0.2, 708, 0, 1, 0, 0, 708, 0, 0], "semantic": {"name": "django.contrib.gis.db.models.fields", "arg_names": [], "import_names": ["GeometryField"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.models.fields import GeometryField"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:ImportFrom_L5_C0", "label": "from django.contrib.gis.db.models.sql import gis_aggregates", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.042, 0.0084, 0, 0.66, 0.3, 437, 0, 1, 0, 0, 437, 0, 0], "semantic": {"name": "django.contrib.gis.db.models.sql", "arg_names": [], "import_names": ["gis_aggregates"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.models.sql import aggregates as gis_aggregates"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:ImportFrom_L6_C0", "label": "from django.contrib.gis.db.models.sql.conversion import AreaField, DistanceField, GeomField", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0504, 0.0084, 0, 0.66, 0.4, 100, 0, 3, 0, 0, 100, 0, 0], "semantic": {"name": "django.contrib.gis.db.models.sql.conversion", "arg_names": [], "import_names": ["AreaField", "DistanceField", "GeomField"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.models.sql.conversion import AreaField, DistanceField, GeomField"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:ImportFrom_L7_C0", "label": "from django.contrib.gis.db.models.sql.where import GeoWhereNode", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0084, 0, 0.66, 0.5, 398, 0, 1, 0, 0, 398, 0, 0], "semantic": {"name": "django.contrib.gis.db.models.sql.where", "arg_names": [], "import_names": ["GeoWhereNode"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.models.sql.where import GeoWhereNode"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:ImportFrom_L8_C0", "label": "from django.contrib.gis.geometry.backend import Geometry", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0672, 0.0084, 0, 0.66, 0.6, 299, 0, 1, 0, 0, 299, 0, 0], "semantic": {"name": "django.contrib.gis.geometry.backend", "arg_names": [], "import_names": ["Geometry"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geometry.backend import Geometry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:ImportFrom_L9_C0", "label": "from django.contrib.gis.measure import Area, Distance", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0756, 0.0084, 0, 0.66, 0.7, 844, 0, 2, 0, 0, 844, 0, 0], "semantic": {"name": "django.contrib.gis.measure", "arg_names": [], "import_names": ["Area", "Distance"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.measure import Area, Distance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L12_C0", "label": "ALL_TERMS = dict()", "type": "assigned_variable", "loc": [12, 21], "level": 0, "parent": null, "vector": [14, 0, 0.1387, 0.084, 0, 0.66, 0.8, 274, 3, 1, 0, 0, 827, 10, 1], "semantic": {"name": "ALL_TERMS", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": "ALL_TERMS = dict([(x, None) for x in (\n 'bbcontains', 'bboverlaps', 'contained', 'contains',\n 'contains_properly', 'coveredby', 'covers', 'crosses', 'disjoint',\n 'distance_gt', 'distance_gte', 'distance_lt', 'distance_lte',\n 'dwithin', 'equals', 'exact',\n 'intersects', 'overlaps', 'relate', 'same_as', 'touches', 'within',\n 'left', 'right', 'overlaps_left', 'overlaps_right',\n 'overlaps_above', 'overlaps_below',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Expr_L22_C0", "label": "update()", "type": "expression", "loc": [22, 22], "level": 0, "parent": null, "vector": [8, 0, 0.1849, 0.0084, 0, 0.66, 0.9, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": "ALL_TERMS.update(sql.constants.QUERY_TERMS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:ClassDef_L24_C0", "label": "GeoQuery", "type": "class", "loc": [24, 119], "level": 0, "parent": null, "vector": [3, 0, 0.6008, 0.8067, 0, 0.66, 1.0, 557, 0, 6, 0, 0, 661, 0, 29], "semantic": {"name": "GeoQuery", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GeoQuery(sql.Query):\n \"\"\"\n A single spatial SQL query.\n \"\"\"\n # Overridding the valid query terms.\n query_terms = ALL_TERMS\n aggregates_module = gis_aggregates\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Expr_L25_C4", "label": "expression", "type": "expression", "loc": [25, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:ClassDef_L24_C0", "vector": [8, 1, 0.2185, 0.0252, 1, 0.01, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n A single spatial SQL query.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L29_C4", "label": "query_terms =", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:ClassDef_L24_C0", "vector": [14, 1, 0.2437, 0.0084, 1, 0.01, 0.1111, 836, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "query_terms", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query_terms = ALL_TERMS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L30_C4", "label": "aggregates_module =", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:ClassDef_L24_C0", "vector": [14, 1, 0.2521, 0.0084, 1, 0.01, 0.2222, 531, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "aggregates_module", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " aggregates_module = gis_aggregates"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L32_C4", "label": "compiler =", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:ClassDef_L24_C0", "vector": [14, 1, 0.2689, 0.0084, 1, 0.01, 0.3333, 738, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "compiler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " compiler = 'GeoSQLCompiler'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L35_C4", "label": "__init__", "type": "function", "loc": [35, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:ClassDef_L24_C0", "vector": [2, 1, 0.3235, 0.0672, 1, 0.01, 0.4444, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "model", "where"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, model, where=GeoWhereNode):\n super(GeoQuery, self).__init__(model, where)\n # The following attributes are customized for the GeoQuerySet.\n # The GeoWhereNode and SpatialBackend classes contain backend-specific\n # routines and functions.\n self.custom_select = {}\n self.transformed_srid = None\n self.extra_select_fields = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Expr_L36_C8", "label": "__init__()", "type": "expression", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L35_C4", "vector": [8, 2, 0.3025, 0.0084, 2, 0.46, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(GeoQuery, self).__init__(model, where)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L40_C8", "label": "self.custom_select =", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L35_C4", "vector": [14, 2, 0.3361, 0.0084, 2, 0.46, 0.3333, 600, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.custom_select", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.custom_select = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L41_C8", "label": "self.transformed_srid =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L35_C4", "vector": [14, 2, 0.3445, 0.0084, 2, 0.46, 0.6667, 920, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.transformed_srid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.transformed_srid = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L42_C8", "label": "self.extra_select_fields =", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L35_C4", "vector": [14, 2, 0.3529, 0.0084, 2, 0.46, 1.0, 95, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.extra_select_fields", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.extra_select_fields = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L44_C4", "label": "clone", "type": "function", "loc": [44, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:ClassDef_L24_C0", "vector": [2, 1, 0.3992, 0.0672, 1, 0.01, 0.5556, 911, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "clone", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clone(self, *args, **kwargs):\n obj = super(GeoQuery, self).clone(*args, **kwargs)\n # Customized selection dictionary and transformed srid flag have\n # to also be added to obj.\n obj.custom_select = self.custom_select.copy()\n obj.transformed_srid = self.transformed_srid\n obj.extra_select_fields = self.extra_select_fields.copy()\n return obj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L45_C8", "label": "obj = clone()", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L44_C4", "vector": [14, 2, 0.3782, 0.0084, 2, 0.17, 0.0, 505, 3, 2, 0, 0, 911, 10, 2], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "clone", "annotation": ""}, "snippet": " obj = super(GeoQuery, self).clone(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L48_C8", "label": "obj.custom_select = copy()", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L44_C4", "vector": [14, 2, 0.4034, 0.0084, 2, 0.17, 0.25, 316, 3, 0, 0, 0, 739, 10, 1], "semantic": {"name": "obj.custom_select", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " obj.custom_select = self.custom_select.copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L49_C8", "label": "obj.transformed_srid =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L44_C4", "vector": [14, 2, 0.4118, 0.0084, 2, 0.17, 0.5, 171, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj.transformed_srid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj.transformed_srid = self.transformed_srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L50_C8", "label": "obj.extra_select_fields = copy()", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L44_C4", "vector": [14, 2, 0.4202, 0.0084, 2, 0.17, 0.75, 510, 3, 0, 0, 0, 739, 10, 1], "semantic": {"name": "obj.extra_select_fields", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " obj.extra_select_fields = self.extra_select_fields.copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Return_L51_C8", "label": "return", "type": "return", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L44_C4", "vector": [13, 2, 0.4286, 0.0084, 2, 0.17, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return obj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L53_C4", "label": "convert_values", "type": "function", "loc": [53, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:ClassDef_L24_C0", "vector": [2, 1, 0.5378, 0.1933, 1, 0.01, 0.6667, 870, 0, 4, 1, 0, 0, 0, 9], "semantic": {"name": "convert_values", "arg_names": ["self", "value", "field", "connection"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def convert_values(self, value, field, connection):\n \"\"\"\n Using the same routines that Oracle does we can convert our\n extra selection objects into Geometry and Distance objects.\n TODO: Make converted objects 'lazy' for less overhead.\n \"\"\"\n if connection.ops.oracle:\n # Running through Oracle's first."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Expr_L54_C8", "label": "expression", "type": "expression", "loc": [54, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L53_C4", "vector": [8, 2, 0.4706, 0.042, 2, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Using the same routines that Oracle does we can convert our\n extra selection objects into Geometry and Distance objects.\n TODO: Make converted objects 'lazy' for less overhead.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L59_C8", "label": "if", "type": "if", "loc": [59, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L53_C4", "vector": [4, 2, 0.5042, 0.0252, 2, 0.07, 0.3333, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if connection.ops.oracle:\n # Running through Oracle's first.\n value = super(GeoQuery, self).convert_values(value, field or GeomField(), connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L61_C12", "label": "value = convert_values()", "type": "assigned_variable", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L59_C8", "vector": [14, 3, 0.5126, 0.0084, 3, 0.13, 0.0, 441, 3, 3, 0, 0, 870, 10, 3], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "convert_values", "annotation": ""}, "snippet": " value = super(GeoQuery, self).convert_values(value, field or GeomField(), connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L63_C8", "label": "if", "type": "if", "loc": [63, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L53_C4", "vector": [4, 2, 0.5756, 0.1008, 2, 0.07, 0.6667, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value is None:\n # Output from spatial function is NULL (e.g., called\n # function on a geometry field with NULL value).\n pass\n elif isinstance(field, DistanceField):\n # Using the field's distance attribute, can instantiate\n # `Distance` with the right context.\n value = Distance(**{field.distance_att : value})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L67_C8", "label": "if", "type": "if", "loc": [67, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L63_C8", "vector": [4, 3, 0.5924, 0.0672, 3, 0.35, 0.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(field, DistanceField):\n # Using the field's distance attribute, can instantiate\n # `Distance` with the right context.\n value = Distance(**{field.distance_att : value})\n elif isinstance(field, AreaField):\n value = Area(**{field.area_att : value})\n elif isinstance(field, (GeomField, GeometryField)) and value:\n value = Geometry(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L70_C12", "label": "value = Distance()", "type": "assigned_variable", "loc": [70, 70], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L67_C8", "vector": [14, 4, 0.5882, 0.0084, 4, 0.45, 0.0, 441, 3, 1, 0, 0, 420, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "Distance", "annotation": ""}, "snippet": " value = Distance(**{field.distance_att : value})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L71_C8", "label": "if", "type": "if", "loc": [71, 74], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L67_C8", "vector": [4, 4, 0.6092, 0.0336, 4, 0.45, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(field, AreaField):\n value = Area(**{field.area_att : value})\n elif isinstance(field, (GeomField, GeometryField)) and value:\n value = Geometry(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L72_C12", "label": "value = Area()", "type": "assigned_variable", "loc": [72, 72], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L71_C8", "vector": [14, 5, 0.605, 0.0084, 5, 0.52, 0.0, 441, 3, 1, 0, 0, 116, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "Area", "annotation": ""}, "snippet": " value = Area(**{field.area_att : value})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L73_C8", "label": "if", "type": "if", "loc": [73, 74], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L71_C8", "vector": [4, 5, 0.6176, 0.0168, 5, 0.52, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(field, (GeomField, GeometryField)) and value:\n value = Geometry(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L74_C12", "label": "value = Geometry()", "type": "assigned_variable", "loc": [74, 74], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L73_C8", "vector": [14, 6, 0.6218, 0.0084, 6, 0.33, 0.0, 441, 3, 1, 0, 0, 361, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "Geometry", "annotation": ""}, "snippet": " value = Geometry(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Return_L75_C8", "label": "return", "type": "return", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L53_C4", "vector": [13, 2, 0.6303, 0.0084, 2, 0.07, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L77_C4", "label": "get_aggregation", "type": "function", "loc": [77, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:ClassDef_L24_C0", "vector": [2, 1, 0.6807, 0.0756, 1, 0.01, 0.7778, 820, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "get_aggregation", "arg_names": ["self", "using"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_aggregation(self, using):\n # Remove any aggregates marked for reduction from the subquery\n # and move them to the outer AggregateQuery.\n connection = connections[using]\n for alias, aggregate in self.aggregate_select.items():\n if isinstance(aggregate, gis_aggregates.GeoAggregate):\n if not getattr(aggregate, 'is_extent', False) or connection.ops.oracle:\n self.extra_select_fields[alias] = GeomField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L80_C8", "label": "connection =", "type": "assigned_variable", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L77_C4", "vector": [14, 2, 0.6723, 0.0084, 2, 0.27, 0.0, 351, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "connection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " connection = connections[using]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:For_L81_C8", "label": "for alias, aggregate", "type": "for", "loc": [81, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L77_C4", "vector": [6, 2, 0.6933, 0.0336, 2, 0.27, 0.5, 58, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "alias, aggregate", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for alias, aggregate in self.aggregate_select.items():\n if isinstance(aggregate, gis_aggregates.GeoAggregate):\n if not getattr(aggregate, 'is_extent', False) or connection.ops.oracle:\n self.extra_select_fields[alias] = GeomField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L82_C12", "label": "if", "type": "if", "loc": [82, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:For_L81_C8", "vector": [4, 3, 0.6975, 0.0252, 3, 0.37, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(aggregate, gis_aggregates.GeoAggregate):\n if not getattr(aggregate, 'is_extent', False) or connection.ops.oracle:\n self.extra_select_fields[alias] = GeomField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L83_C16", "label": "if", "type": "if", "loc": [83, 84], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L82_C12", "vector": [4, 4, 0.7017, 0.0168, 4, 0.4, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not getattr(aggregate, 'is_extent', False) or connection.ops.oracle:\n self.extra_select_fields[alias] = GeomField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L84_C20", "label": " = GeomField()", "type": "assigned_variable", "loc": [84, 84], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L83_C16", "vector": [14, 5, 0.7059, 0.0084, 5, 0.13, 0.0, 0, 3, 0, 0, 0, 944, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "GeomField", "annotation": ""}, "snippet": " self.extra_select_fields[alias] = GeomField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Return_L85_C8", "label": "return", "type": "return", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L77_C4", "vector": [13, 2, 0.7143, 0.0084, 2, 0.27, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return super(GeoQuery, self).get_aggregation(using)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L87_C4", "label": "resolve_aggregate", "type": "function", "loc": [87, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:ClassDef_L24_C0", "vector": [2, 1, 0.7899, 0.1261, 1, 0.01, 0.8889, 474, 0, 4, 1, 0, 0, 0, 6], "semantic": {"name": "resolve_aggregate", "arg_names": ["self", "value", "aggregate", "connection"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def resolve_aggregate(self, value, aggregate, connection):\n \"\"\"\n Overridden from GeoQuery's normalize to handle the conversion of\n GeoAggregate objects.\n \"\"\"\n if isinstance(aggregate, self.aggregates_module.GeoAggregate):\n if aggregate.is_extent:\n if aggregate.is_extent == '3D':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Expr_L88_C8", "label": "expression", "type": "expression", "loc": [88, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L87_C4", "vector": [8, 2, 0.7521, 0.0336, 2, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Overridden from GeoQuery's normalize to handle the conversion of\n GeoAggregate objects.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L92_C8", "label": "if", "type": "if", "loc": [92, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L87_C4", "vector": [4, 2, 0.8109, 0.084, 2, 0.72, 1.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(aggregate, self.aggregates_module.GeoAggregate):\n if aggregate.is_extent:\n if aggregate.is_extent == '3D':\n return connection.ops.convert_extent3d(value)\n else:\n return connection.ops.convert_extent(value)\n else:\n return connection.ops.convert_geom(value, aggregate.source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L93_C12", "label": "if", "type": "if", "loc": [93, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L92_C8", "vector": [4, 3, 0.8067, 0.0588, 3, 0.3, 0.0, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if aggregate.is_extent:\n if aggregate.is_extent == '3D':\n return connection.ops.convert_extent3d(value)\n else:\n return connection.ops.convert_extent(value)\n else:\n return connection.ops.convert_geom(value, aggregate.source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L94_C16", "label": "if", "type": "if", "loc": [94, 97], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L93_C12", "vector": [4, 4, 0.8025, 0.0336, 4, 0.77, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if aggregate.is_extent == '3D':\n return connection.ops.convert_extent3d(value)\n else:\n return connection.ops.convert_extent(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Return_L95_C20", "label": "return", "type": "return", "loc": [95, 95], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L94_C16", "vector": [13, 5, 0.7983, 0.0084, 5, 0.88, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return connection.ops.convert_extent3d(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Return_L97_C20", "label": "return", "type": "return", "loc": [97, 97], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L94_C16", "vector": [13, 5, 0.8151, 0.0084, 5, 0.88, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return connection.ops.convert_extent(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Return_L99_C16", "label": "return", "type": "return", "loc": [99, 99], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L93_C12", "vector": [13, 4, 0.8319, 0.0084, 4, 0.77, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return connection.ops.convert_geom(value, aggregate.source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Return_L101_C12", "label": "return", "type": "return", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L92_C8", "vector": [13, 3, 0.8487, 0.0084, 3, 0.3, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return super(GeoQuery, self).resolve_aggregate(value, aggregate, connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L104_C4", "label": "_geo_field", "type": "function", "loc": [104, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:ClassDef_L24_C0", "vector": [2, 1, 0.937, 0.1345, 1, 0.01, 1.0, 123, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "_geo_field", "arg_names": ["self", "field_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _geo_field(self, field_name=None):\n \"\"\"\n Returns the first Geometry field encountered; or specified via the\n `field_name` keyword. The `field_name` may be a string specifying\n the geometry field on this GeoQuery's model, or a lookup string\n to a geometry field via a ForeignKey relation.\n \"\"\"\n if field_name is None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Expr_L105_C8", "label": "expression", "type": "expression", "loc": [105, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L104_C4", "vector": [8, 2, 0.9034, 0.0504, 2, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the first Geometry field encountered; or specified via the\n `field_name` keyword. The `field_name` may be a string specifying\n the geometry field on this GeoQuery's model, or a lookup string\n to a geometry field via a ForeignKey relation.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L111_C8", "label": "if", "type": "if", "loc": [111, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L104_C4", "vector": [4, 2, 0.9664, 0.0756, 2, 0.67, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if field_name is None:\n # Incrementing until the first geographic field is found.\n for fld in self.model._meta.fields:\n if isinstance(fld, GeometryField): return fld\n return False\n else:\n # Otherwise, check by the given field name -- which may be\n # a lookup to a _related_ geographic field."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:For_L113_C12", "label": "for fld", "type": "for", "loc": [113, 114], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L111_C8", "vector": [6, 3, 0.9538, 0.0168, 3, 0.92, 0.0, 243, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "fld", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for fld in self.model._meta.fields:\n if isinstance(fld, GeometryField): return fld"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L114_C16", "label": "if", "type": "if", "loc": [114, 114], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:For_L113_C12", "vector": [4, 4, 0.958, 0.0084, 4, 0.76, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(fld, GeometryField): return fld"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Return_L114_C51", "label": "return", "type": "return", "loc": [114, 114], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L114_C16", "vector": [13, 5, 0.958, 0.0084, 5, 0.26, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(fld, GeometryField): return fld"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Return_L115_C12", "label": "return", "type": "return", "loc": [115, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L111_C8", "vector": [13, 3, 0.9664, 0.0084, 3, 0.92, 0.5, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98753:Return_L119_C12", "label": "return", "type": "return", "loc": [119, 119], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L111_C8", "vector": [13, 3, 1.0, 0.0084, 3, 0.92, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return GeoWhereNode._check_geo_field(self.model._meta, field_name)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98753:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Expr_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Return_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Expr_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L61_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L63_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L67_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L70_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L67_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L71_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L72_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L71_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L73_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L74_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Return_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:For_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:For_L81_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L82_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L82_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L83_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L83_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L84_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Return_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Expr_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L92_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L93_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L93_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L94_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L94_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Return_L95_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L94_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Return_L97_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L93_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Return_L99_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L92_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Return_L101_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Expr_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L111_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:For_L113_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:For_L113_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L114_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L114_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Return_L114_C51"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L111_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Return_L115_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:If_L111_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Return_L119_C12"}] |
from itertools import izip
from django.db.backends.util import truncate_name
from django.db.models.sql import compiler
from django.db.models.sql.constants import TABLE_NAME
from django.db.models.sql.query import get_proxied_model
SQLCompiler = compiler.SQLCompiler
class GeoSQLCompiler(compiler.SQLCompiler):
def get_columns(self, with_aliases=False):
"""
Return the list of columns to use in the select statement. If no
columns have been specified, returns all columns relating to fields in
the model.
If 'with_aliases' is true, any column names that are duplicated
(without the table names) are given unique aliases. This is needed in
some cases to avoid ambiguitity with nested queries.
This routine is overridden from Query to handle customized selection of
geometry columns.
"""
qn = self.quote_name_unless_alias
qn2 = self.connection.ops.quote_name
result = ['(%s) AS %s' % (self.get_extra_select_format(alias) % col[0], qn2(alias))
for alias, col in self.query.extra_select.iteritems()]
aliases = set(self.query.extra_select.keys())
if with_aliases:
col_aliases = aliases.copy()
else:
col_aliases = set()
if self.query.select:
only_load = self.deferred_to_columns()
# This loop customized for GeoQuery.
for col, field in izip(self.query.select, self.query.select_fields):
if isinstance(col, (list, tuple)):
alias, column = col
table = self.query.alias_map[alias][TABLE_NAME]
if table in only_load and col not in only_load[table]:
continue
r = self.get_field_select(field, alias, column)
if with_aliases:
if col[1] in col_aliases:
c_alias = 'Col%d' % len(col_aliases)
result.append('%s AS %s' % (r, c_alias))
aliases.add(c_alias)
col_aliases.add(c_alias)
else:
result.append('%s AS %s' % (r, qn2(col[1])))
aliases.add(r)
col_aliases.add(col[1])
else:
result.append(r)
aliases.add(r)
col_aliases.add(col[1])
else:
result.append(col.as_sql(qn, self.connection))
if hasattr(col, 'alias'):
aliases.add(col.alias)
col_aliases.add(col.alias)
elif self.query.default_cols:
cols, new_aliases = self.get_default_columns(with_aliases,
col_aliases)
result.extend(cols)
aliases.update(new_aliases)
max_name_length = self.connection.ops.max_name_length()
result.extend([
'%s%s' % (
self.get_extra_select_format(alias) % aggregate.as_sql(qn, self.connection),
alias is not None
and ' AS %s' % qn(truncate_name(alias, max_name_length))
or ''
)
for alias, aggregate in self.query.aggregate_select.items()
])
# This loop customized for GeoQuery.
for (table, col), field in izip(self.query.related_select_cols, self.query.related_select_fields):
r = self.get_field_select(field, table, col)
if with_aliases and col in col_aliases:
c_alias = 'Col%d' % len(col_aliases)
result.append('%s AS %s' % (r, c_alias))
aliases.add(c_alias)
col_aliases.add(c_alias)
else:
result.append(r)
aliases.add(r)
col_aliases.add(col)
self._select_aliases = aliases
return result
def get_default_columns(self, with_aliases=False, col_aliases=None,
start_alias=None, opts=None, as_pairs=False, local_only=False):
"""
Computes the default columns for selecting every field in the base
model. Will sometimes be called to pull in related models (e.g. via
select_related), in which case "opts" and "start_alias" will be given
to provide a starting point for the traversal.
Returns a list of strings, quoted appropriately for use in SQL
directly, as well as a set of aliases used in the select statement (if
'as_pairs' is True, returns a list of (alias, col_name) pairs instead
of strings as the first component and None as the second component).
This routine is overridden from Query to handle customized selection of
geometry columns.
"""
result = []
if opts is None:
opts = self.query.model._meta
aliases = set()
only_load = self.deferred_to_columns()
# Skip all proxy to the root proxied model
proxied_model = get_proxied_model(opts)
if start_alias:
seen = {None: start_alias}
for field, model in opts.get_fields_with_model():
if local_only and model is not None:
continue
if start_alias:
try:
alias = seen[model]
except KeyError:
if model is proxied_model:
alias = start_alias
else:
link_field = opts.get_ancestor_link(model)
alias = self.query.join((start_alias, model._meta.db_table,
link_field.column, model._meta.pk.column))
seen[model] = alias
else:
# If we're starting from the base model of the queryset, the
# aliases will have already been set up in pre_sql_setup(), so
# we can save time here.
alias = self.query.included_inherited_models[model]
table = self.query.alias_map[alias][TABLE_NAME]
if table in only_load and field.column not in only_load[table]:
continue
if as_pairs:
result.append((alias, field.column))
aliases.add(alias)
continue
# This part of the function is customized for GeoQuery. We
# see if there was any custom selection specified in the
# dictionary, and set up the selection format appropriately.
field_sel = self.get_field_select(field, alias)
if with_aliases and field.column in col_aliases:
c_alias = 'Col%d' % len(col_aliases)
result.append('%s AS %s' % (field_sel, c_alias))
col_aliases.add(c_alias)
aliases.add(c_alias)
else:
r = field_sel
result.append(r)
aliases.add(r)
if with_aliases:
col_aliases.add(field.column)
return result, aliases
def resolve_columns(self, row, fields=()):
"""
This routine is necessary so that distances and geometries returned
from extra selection SQL get resolved appropriately into Python
objects.
"""
values = []
aliases = self.query.extra_select.keys()
if self.query.aggregates:
# If we have an aggregate annotation, must extend the aliases
# so their corresponding row values are included.
aliases.extend([None for i in xrange(len(self.query.aggregates))])
# Have to set a starting row number offset that is used for
# determining the correct starting row index -- needed for
# doing pagination with Oracle.
rn_offset = 0
if self.connection.ops.oracle:
if self.query.high_mark is not None or self.query.low_mark: rn_offset = 1
index_start = rn_offset + len(aliases)
# Converting any extra selection values (e.g., geometries and
# distance objects added by GeoQuerySet methods).
values = [self.query.convert_values(v,
self.query.extra_select_fields.get(a, None),
self.connection)
for v, a in izip(row[rn_offset:index_start], aliases)]
if self.connection.ops.oracle or getattr(self.query, 'geo_values', False):
# We resolve the rest of the columns if we're on Oracle or if
# the `geo_values` attribute is defined.
for value, field in map(None, row[index_start:], fields):
values.append(self.query.convert_values(value, field, connection=self.connection))
else:
values.extend(row[index_start:])
return tuple(values)
#### Routines unique to GeoQuery ####
def get_extra_select_format(self, alias):
sel_fmt = '%s'
if alias in self.query.custom_select:
sel_fmt = sel_fmt % self.query.custom_select[alias]
return sel_fmt
def get_field_select(self, field, alias=None, column=None):
"""
Returns the SELECT SQL string for the given field. Figures out
if any custom selection SQL is needed for the column The `alias`
keyword may be used to manually specify the database table where
the column exists, if not in the model associated with this
`GeoQuery`. Similarly, `column` may be used to specify the exact
column name, rather than using the `column` attribute on `field`.
"""
sel_fmt = self.get_select_format(field)
if field in self.query.custom_select:
field_sel = sel_fmt % self.query.custom_select[field]
else:
field_sel = sel_fmt % self._field_column(field, alias, column)
return field_sel
def get_select_format(self, fld):
"""
Returns the selection format string, depending on the requirements
of the spatial backend. For example, Oracle and MySQL require custom
selection formats in order to retrieve geometries in OGC WKT. For all
other fields a simple '%s' format string is returned.
"""
if self.connection.ops.select and hasattr(fld, 'geom_type'):
# This allows operations to be done on fields in the SELECT,
# overriding their values -- used by the Oracle and MySQL
# spatial backends to get database values as WKT, and by the
# `transform` method.
sel_fmt = self.connection.ops.select
# Because WKT doesn't contain spatial reference information,
# the SRID is prefixed to the returned WKT to ensure that the
# transformed geometries have an SRID different than that of the
# field -- this is only used by `transform` for Oracle and
# SpatiaLite backends.
if self.query.transformed_srid and ( self.connection.ops.oracle or
self.connection.ops.spatialite ):
sel_fmt = "'SRID=%d;'||%s" % (self.query.transformed_srid, sel_fmt)
else:
sel_fmt = '%s'
return sel_fmt
# Private API utilities, subject to change.
def _field_column(self, field, table_alias=None, column=None):
"""
Helper function that returns the database column for the given field.
The table and column are returned (quoted) in the proper format, e.g.,
`"geoapp_city"."point"`. If `table_alias` is not specified, the
database table associated with the model of this `GeoQuery` will be
used. If `column` is specified, it will be used instead of the value
in `field.column`.
"""
if table_alias is None: table_alias = self.query.model._meta.db_table
return "%s.%s" % (self.quote_name_unless_alias(table_alias),
self.connection.ops.quote_name(column or field.column))
class SQLInsertCompiler(compiler.SQLInsertCompiler, GeoSQLCompiler):
pass
class SQLDeleteCompiler(compiler.SQLDeleteCompiler, GeoSQLCompiler):
pass
class SQLUpdateCompiler(compiler.SQLUpdateCompiler, GeoSQLCompiler):
pass
class SQLAggregateCompiler(compiler.SQLAggregateCompiler, GeoSQLCompiler):
pass
class SQLDateCompiler(compiler.SQLDateCompiler, GeoSQLCompiler):
pass
| ajibawa-2023/Python-Code-Large/train/row_98754 | 143 | 278 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98754:ImportFrom_L1_C0", "label": "from itertools import izip", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0036, 0.0036, 0, 0.66, 0.0, 808, 0, 1, 0, 0, 808, 0, 0], "semantic": {"name": "itertools", "arg_names": [], "import_names": ["izip"], "rhs_call_name": "", "annotation": ""}, "snippet": "from itertools import izip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:ImportFrom_L2_C0", "label": "from django.db.backends.util import truncate_name", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0072, 0.0036, 0, 0.66, 0.0909, 446, 0, 1, 0, 0, 446, 0, 0], "semantic": {"name": "django.db.backends.util", "arg_names": [], "import_names": ["truncate_name"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.backends.util import truncate_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:ImportFrom_L3_C0", "label": "from django.db.models.sql import compiler", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0108, 0.0036, 0, 0.66, 0.1818, 841, 0, 1, 0, 0, 841, 0, 0], "semantic": {"name": "django.db.models.sql", "arg_names": [], "import_names": ["compiler"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.models.sql import compiler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:ImportFrom_L4_C0", "label": "from django.db.models.sql.constants import TABLE_NAME", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0144, 0.0036, 0, 0.66, 0.2727, 971, 0, 1, 0, 0, 971, 0, 0], "semantic": {"name": "django.db.models.sql.constants", "arg_names": [], "import_names": ["TABLE_NAME"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.models.sql.constants import TABLE_NAME"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:ImportFrom_L5_C0", "label": "from django.db.models.sql.query import get_proxied_model", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.018, 0.0036, 0, 0.66, 0.3636, 656, 0, 1, 0, 0, 656, 0, 0], "semantic": {"name": "django.db.models.sql.query", "arg_names": [], "import_names": ["get_proxied_model"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.models.sql.query import get_proxied_model"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L7_C0", "label": "SQLCompiler =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.0252, 0.0036, 0, 0.66, 0.4545, 718, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "SQLCompiler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SQLCompiler = compiler.SQLCompiler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:ClassDef_L9_C0", "label": "GeoSQLCompiler", "type": "class", "loc": [9, 263], "level": 0, "parent": null, "vector": [3, 0, 0.4892, 0.9173, 0, 0.66, 0.5455, 214, 0, 7, 0, 0, 749, 0, 81], "semantic": {"name": "GeoSQLCompiler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GeoSQLCompiler(compiler.SQLCompiler):\n\n def get_columns(self, with_aliases=False):\n \"\"\"\n Return the list of columns to use in the select statement. If no\n columns have been specified, returns all columns relating to fields in\n the model.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "label": "get_columns", "type": "function", "loc": [11, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:ClassDef_L9_C0", "vector": [2, 1, 0.1906, 0.3058, 1, 0.37, 0.0, 636, 0, 2, 1, 0, 0, 0, 46], "semantic": {"name": "get_columns", "arg_names": ["self", "with_aliases"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_columns(self, with_aliases=False):\n \"\"\"\n Return the list of columns to use in the select statement. If no\n columns have been specified, returns all columns relating to fields in\n the model.\n\n If 'with_aliases' is true, any column names that are duplicated\n (without the table names) are given unique aliases. This is needed in"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L12_C8", "label": "expression", "type": "expression", "loc": [12, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "vector": [8, 2, 0.0629, 0.0432, 2, 0.58, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Return the list of columns to use in the select statement. If no\n columns have been specified, returns all columns relating to fields in\n the model.\n\n If 'with_aliases' is true, any column names that are duplicated\n (without the table names) are given unique aliases. This is needed in\n some cases to avoid ambiguitity with nested queries."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L24_C8", "label": "qn =", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "vector": [14, 2, 0.0863, 0.0036, 2, 0.58, 0.0909, 514, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "qn", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " qn = self.quote_name_unless_alias"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L25_C8", "label": "qn2 =", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "vector": [14, 2, 0.0899, 0.0036, 2, 0.58, 0.1818, 240, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "qn2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " qn2 = self.connection.ops.quote_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L26_C8", "label": "result =", "type": "assigned_variable", "loc": [26, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "vector": [14, 2, 0.0953, 0.0072, 2, 0.58, 0.2727, 51, 5, 0, 0, 0, 0, 0, 3], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " result = ['(%s) AS %s' % (self.get_extra_select_format(alias) % col[0], qn2(alias))\n for alias, col in self.query.extra_select.iteritems()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L28_C8", "label": "aliases = set()", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "vector": [14, 2, 0.1007, 0.0036, 2, 0.58, 0.3636, 88, 3, 1, 0, 0, 21, 10, 2], "semantic": {"name": "aliases", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " aliases = set(self.query.extra_select.keys())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L29_C8", "label": "if", "type": "if", "loc": [29, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "vector": [4, 2, 0.1097, 0.0144, 2, 0.58, 0.4545, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if with_aliases:\n col_aliases = aliases.copy()\n else:\n col_aliases = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L30_C12", "label": "col_aliases = copy()", "type": "assigned_variable", "loc": [30, 30], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L29_C8", "vector": [14, 3, 0.1079, 0.0036, 3, 0.72, 0.0, 654, 3, 0, 0, 0, 739, 10, 1], "semantic": {"name": "col_aliases", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " col_aliases = aliases.copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L32_C12", "label": "col_aliases = set()", "type": "assigned_variable", "loc": [32, 32], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L29_C8", "vector": [14, 3, 0.1151, 0.0036, 3, 0.72, 1.0, 654, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "col_aliases", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " col_aliases = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L33_C8", "label": "if", "type": "if", "loc": [33, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "vector": [4, 2, 0.1817, 0.1295, 2, 0.58, 0.5455, 0, 7, 0, 0, 0, 0, 0, 23], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.query.select:\n only_load = self.deferred_to_columns()\n # This loop customized for GeoQuery.\n for col, field in izip(self.query.select, self.query.select_fields):\n if isinstance(col, (list, tuple)):\n alias, column = col\n table = self.query.alias_map[alias][TABLE_NAME]\n if table in only_load and col not in only_load[table]:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L34_C12", "label": "only_load = deferred_to_columns()", "type": "assigned_variable", "loc": [34, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L33_C8", "vector": [14, 3, 0.1223, 0.0036, 3, 0.39, 0.0, 982, 3, 0, 0, 0, 25, 10, 1], "semantic": {"name": "only_load", "arg_names": [], "import_names": [], "rhs_call_name": "deferred_to_columns", "annotation": ""}, "snippet": " only_load = self.deferred_to_columns()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L36_C12", "label": "for col, field", "type": "for", "loc": [36, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L33_C8", "vector": [6, 3, 0.1763, 0.0971, 3, 0.39, 0.5, 552, 3, 0, 0, 0, 0, 0, 19], "semantic": {"name": "col, field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for col, field in izip(self.query.select, self.query.select_fields):\n if isinstance(col, (list, tuple)):\n alias, column = col\n table = self.query.alias_map[alias][TABLE_NAME]\n if table in only_load and col not in only_load[table]:\n continue\n r = self.get_field_select(field, alias, column)\n if with_aliases:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L37_C16", "label": "if", "type": "if", "loc": [37, 62], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L36_C12", "vector": [4, 4, 0.1781, 0.0935, 4, 0.11, 0.0, 0, 3, 0, 0, 0, 0, 0, 18], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(col, (list, tuple)):\n alias, column = col\n table = self.query.alias_map[alias][TABLE_NAME]\n if table in only_load and col not in only_load[table]:\n continue\n r = self.get_field_select(field, alias, column)\n if with_aliases:\n if col[1] in col_aliases:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L38_C20", "label": "alias, column =", "type": "assigned_variable", "loc": [38, 38], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L37_C16", "vector": [14, 5, 0.1367, 0.0036, 5, 0.62, 0.0, 408, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "alias, column", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " alias, column = col"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L39_C20", "label": "table =", "type": "assigned_variable", "loc": [39, 39], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L37_C16", "vector": [14, 5, 0.1403, 0.0036, 5, 0.62, 0.1667, 338, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " table = self.query.alias_map[alias][TABLE_NAME]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L40_C20", "label": "if", "type": "if", "loc": [40, 41], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L37_C16", "vector": [4, 5, 0.1457, 0.0072, 5, 0.62, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if table in only_load and col not in only_load[table]:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L42_C20", "label": "r = get_field_select()", "type": "assigned_variable", "loc": [42, 42], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L37_C16", "vector": [14, 5, 0.1511, 0.0036, 5, 0.62, 0.5, 436, 3, 3, 0, 0, 106, 10, 1], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "get_field_select", "annotation": ""}, "snippet": " r = self.get_field_select(field, alias, column)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L43_C20", "label": "if", "type": "if", "loc": [43, 56], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L37_C16", "vector": [4, 5, 0.1781, 0.0504, 5, 0.62, 0.6667, 0, 2, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if with_aliases:\n if col[1] in col_aliases:\n c_alias = 'Col%d' % len(col_aliases)\n result.append('%s AS %s' % (r, c_alias))\n aliases.add(c_alias)\n col_aliases.add(c_alias)\n else:\n result.append('%s AS %s' % (r, qn2(col[1])))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L44_C24", "label": "if", "type": "if", "loc": [44, 52], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L43_C20", "vector": [4, 6, 0.1727, 0.0324, 6, 0.41, 0.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if col[1] in col_aliases:\n c_alias = 'Col%d' % len(col_aliases)\n result.append('%s AS %s' % (r, c_alias))\n aliases.add(c_alias)\n col_aliases.add(c_alias)\n else:\n result.append('%s AS %s' % (r, qn2(col[1])))\n aliases.add(r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L45_C28", "label": "c_alias =", "type": "assigned_variable", "loc": [45, 45], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L44_C24", "vector": [14, 7, 0.1619, 0.0036, 7, 0.24, 0.0, 89, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "c_alias", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c_alias = 'Col%d' % len(col_aliases)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L46_C28", "label": "append()", "type": "expression", "loc": [46, 46], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L44_C24", "vector": [8, 7, 0.1655, 0.0036, 7, 0.24, 0.1667, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " result.append('%s AS %s' % (r, c_alias))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L47_C28", "label": "add()", "type": "expression", "loc": [47, 47], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L44_C24", "vector": [8, 7, 0.1691, 0.0036, 7, 0.24, 0.3333, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " aliases.add(c_alias)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L48_C28", "label": "add()", "type": "expression", "loc": [48, 48], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L44_C24", "vector": [8, 7, 0.1727, 0.0036, 7, 0.24, 0.5, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " col_aliases.add(c_alias)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L50_C28", "label": "append()", "type": "expression", "loc": [50, 50], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L44_C24", "vector": [8, 7, 0.1799, 0.0036, 7, 0.24, 0.6667, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " result.append('%s AS %s' % (r, qn2(col[1])))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L51_C28", "label": "add()", "type": "expression", "loc": [51, 51], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L44_C24", "vector": [8, 7, 0.1835, 0.0036, 7, 0.24, 0.8333, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " aliases.add(r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L52_C28", "label": "add()", "type": "expression", "loc": [52, 52], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L44_C24", "vector": [8, 7, 0.1871, 0.0036, 7, 0.24, 1.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " col_aliases.add(col[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L54_C24", "label": "append()", "type": "expression", "loc": [54, 54], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L43_C20", "vector": [8, 6, 0.1942, 0.0036, 6, 0.41, 0.3333, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " result.append(r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L55_C24", "label": "add()", "type": "expression", "loc": [55, 55], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L43_C20", "vector": [8, 6, 0.1978, 0.0036, 6, 0.41, 0.6667, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " aliases.add(r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L56_C24", "label": "add()", "type": "expression", "loc": [56, 56], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L43_C20", "vector": [8, 6, 0.2014, 0.0036, 6, 0.41, 1.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " col_aliases.add(col[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L58_C20", "label": "append()", "type": "expression", "loc": [58, 58], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L37_C16", "vector": [8, 5, 0.2086, 0.0036, 5, 0.62, 0.8333, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " result.append(col.as_sql(qn, self.connection))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L60_C20", "label": "if", "type": "if", "loc": [60, 62], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L37_C16", "vector": [4, 5, 0.2194, 0.0108, 5, 0.62, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(col, 'alias'):\n aliases.add(col.alias)\n col_aliases.add(col.alias)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L61_C24", "label": "add()", "type": "expression", "loc": [61, 61], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L60_C20", "vector": [8, 6, 0.2194, 0.0036, 6, 0.09, 0.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " aliases.add(col.alias)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L62_C24", "label": "add()", "type": "expression", "loc": [62, 62], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L60_C20", "vector": [8, 6, 0.223, 0.0036, 6, 0.09, 1.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " col_aliases.add(col.alias)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L64_C8", "label": "if", "type": "if", "loc": [64, 68], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L33_C8", "vector": [4, 3, 0.2374, 0.018, 3, 0.39, 1.0, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self.query.default_cols:\n cols, new_aliases = self.get_default_columns(with_aliases,\n col_aliases)\n result.extend(cols)\n aliases.update(new_aliases)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L65_C12", "label": "cols, new_aliases = get_default_columns()", "type": "assigned_variable", "loc": [65, 66], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L64_C8", "vector": [14, 4, 0.2356, 0.0072, 4, 0.3, 0.0, 806, 3, 2, 0, 0, 149, 10, 1], "semantic": {"name": "cols, new_aliases", "arg_names": [], "import_names": [], "rhs_call_name": "get_default_columns", "annotation": ""}, "snippet": " cols, new_aliases = self.get_default_columns(with_aliases,\n col_aliases)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L67_C12", "label": "extend()", "type": "expression", "loc": [67, 67], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L64_C8", "vector": [8, 4, 0.241, 0.0036, 4, 0.3, 0.5, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " result.extend(cols)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L68_C12", "label": "update()", "type": "expression", "loc": [68, 68], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L64_C8", "vector": [8, 4, 0.2446, 0.0036, 4, 0.3, 1.0, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " aliases.update(new_aliases)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L70_C8", "label": "max_name_length = max_name_length()", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "vector": [14, 2, 0.2518, 0.0036, 2, 0.58, 0.6364, 680, 3, 0, 0, 0, 680, 10, 1], "semantic": {"name": "max_name_length", "arg_names": [], "import_names": [], "rhs_call_name": "max_name_length", "annotation": ""}, "snippet": " max_name_length = self.connection.ops.max_name_length()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L71_C8", "label": "extend()", "type": "expression", "loc": [71, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "vector": [8, 2, 0.2698, 0.0324, 2, 0.58, 0.7273, 660, 3, 1, 0, 0, 0, 0, 6], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " result.extend([\n '%s%s' % (\n self.get_extra_select_format(alias) % aggregate.as_sql(qn, self.connection),\n alias is not None\n and ' AS %s' % qn(truncate_name(alias, max_name_length))\n or ''\n )\n for alias, aggregate in self.query.aggregate_select.items()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L82_C8", "label": "for field", "type": "for", "loc": [82, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "vector": [6, 2, 0.3129, 0.0396, 2, 0.58, 0.8182, 480, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for (table, col), field in izip(self.query.related_select_cols, self.query.related_select_fields):\n r = self.get_field_select(field, table, col)\n if with_aliases and col in col_aliases:\n c_alias = 'Col%d' % len(col_aliases)\n result.append('%s AS %s' % (r, c_alias))\n aliases.add(c_alias)\n col_aliases.add(c_alias)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L83_C12", "label": "r = get_field_select()", "type": "assigned_variable", "loc": [83, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L82_C8", "vector": [14, 3, 0.2986, 0.0036, 3, 0.71, 0.0, 436, 3, 3, 0, 0, 106, 10, 1], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "get_field_select", "annotation": ""}, "snippet": " r = self.get_field_select(field, table, col)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L84_C12", "label": "if", "type": "if", "loc": [84, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L82_C8", "vector": [4, 3, 0.3165, 0.0324, 3, 0.71, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if with_aliases and col in col_aliases:\n c_alias = 'Col%d' % len(col_aliases)\n result.append('%s AS %s' % (r, c_alias))\n aliases.add(c_alias)\n col_aliases.add(c_alias)\n else:\n result.append(r)\n aliases.add(r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L85_C16", "label": "c_alias =", "type": "assigned_variable", "loc": [85, 85], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L84_C12", "vector": [14, 4, 0.3058, 0.0036, 4, 0.18, 0.0, 89, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "c_alias", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c_alias = 'Col%d' % len(col_aliases)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L86_C16", "label": "append()", "type": "expression", "loc": [86, 86], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L84_C12", "vector": [8, 4, 0.3094, 0.0036, 4, 0.18, 0.1667, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " result.append('%s AS %s' % (r, c_alias))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L87_C16", "label": "add()", "type": "expression", "loc": [87, 87], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L84_C12", "vector": [8, 4, 0.3129, 0.0036, 4, 0.18, 0.3333, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " aliases.add(c_alias)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L88_C16", "label": "add()", "type": "expression", "loc": [88, 88], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L84_C12", "vector": [8, 4, 0.3165, 0.0036, 4, 0.18, 0.5, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " col_aliases.add(c_alias)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L90_C16", "label": "append()", "type": "expression", "loc": [90, 90], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L84_C12", "vector": [8, 4, 0.3237, 0.0036, 4, 0.18, 0.6667, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " result.append(r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L91_C16", "label": "add()", "type": "expression", "loc": [91, 91], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L84_C12", "vector": [8, 4, 0.3273, 0.0036, 4, 0.18, 0.8333, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " aliases.add(r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L92_C16", "label": "add()", "type": "expression", "loc": [92, 92], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L84_C12", "vector": [8, 4, 0.3309, 0.0036, 4, 0.18, 1.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " col_aliases.add(col)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L94_C8", "label": "self._select_aliases =", "type": "assigned_variable", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "vector": [14, 2, 0.3381, 0.0036, 2, 0.58, 0.9091, 583, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._select_aliases", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._select_aliases = aliases"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Return_L95_C8", "label": "return", "type": "return", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "vector": [13, 2, 0.3417, 0.0036, 2, 0.58, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L97_C4", "label": "get_default_columns", "type": "function", "loc": [97, 164], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:ClassDef_L9_C0", "vector": [2, 1, 0.4694, 0.2446, 1, 0.37, 0.1667, 149, 0, 7, 1, 0, 0, 0, 16], "semantic": {"name": "get_default_columns", "arg_names": ["self", "with_aliases", "col_aliases", "start_alias", "opts", "as_pairs", "local_only"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_default_columns(self, with_aliases=False, col_aliases=None,\n start_alias=None, opts=None, as_pairs=False, local_only=False):\n \"\"\"\n Computes the default columns for selecting every field in the base\n model. Will sometimes be called to pull in related models (e.g. via\n select_related), in which case \"opts\" and \"start_alias\" will be given\n to provide a starting point for the traversal.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L99_C8", "label": "expression", "type": "expression", "loc": [99, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L97_C4", "vector": [8, 2, 0.3795, 0.0504, 2, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Computes the default columns for selecting every field in the base\n model. Will sometimes be called to pull in related models (e.g. via\n select_related), in which case \"opts\" and \"start_alias\" will be given\n to provide a starting point for the traversal.\n\n Returns a list of strings, quoted appropriately for use in SQL\n directly, as well as a set of aliases used in the select statement (if"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L113_C8", "label": "result =", "type": "assigned_variable", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L97_C4", "vector": [14, 2, 0.4065, 0.0036, 2, 0.84, 0.125, 51, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " result = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L114_C8", "label": "if", "type": "if", "loc": [114, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L97_C4", "vector": [4, 2, 0.4119, 0.0072, 2, 0.84, 0.25, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opts is None:\n opts = self.query.model._meta"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L115_C12", "label": "opts =", "type": "assigned_variable", "loc": [115, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L114_C8", "vector": [14, 3, 0.4137, 0.0036, 3, 0.54, 0.0, 631, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "opts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " opts = self.query.model._meta"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L116_C8", "label": "aliases = set()", "type": "assigned_variable", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L97_C4", "vector": [14, 2, 0.4173, 0.0036, 2, 0.84, 0.375, 88, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "aliases", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " aliases = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L117_C8", "label": "only_load = deferred_to_columns()", "type": "assigned_variable", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L97_C4", "vector": [14, 2, 0.4209, 0.0036, 2, 0.84, 0.5, 982, 3, 0, 0, 0, 25, 10, 1], "semantic": {"name": "only_load", "arg_names": [], "import_names": [], "rhs_call_name": "deferred_to_columns", "annotation": ""}, "snippet": " only_load = self.deferred_to_columns()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L119_C8", "label": "proxied_model = get_proxied_model()", "type": "assigned_variable", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L97_C4", "vector": [14, 2, 0.4281, 0.0036, 2, 0.84, 0.625, 797, 3, 1, 0, 0, 229, 10, 1], "semantic": {"name": "proxied_model", "arg_names": [], "import_names": [], "rhs_call_name": "get_proxied_model", "annotation": ""}, "snippet": " proxied_model = get_proxied_model(opts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L121_C8", "label": "if", "type": "if", "loc": [121, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L97_C4", "vector": [4, 2, 0.4371, 0.0072, 2, 0.84, 0.75, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if start_alias:\n seen = {None: start_alias}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L122_C12", "label": "seen =", "type": "assigned_variable", "loc": [122, 122], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L121_C8", "vector": [14, 3, 0.4388, 0.0036, 3, 0.23, 0.0, 212, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "seen", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " seen = {None: start_alias}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L123_C8", "label": "for field, model", "type": "for", "loc": [123, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L97_C4", "vector": [6, 2, 0.5144, 0.1475, 2, 0.84, 0.875, 407, 3, 0, 0, 0, 0, 0, 13], "semantic": {"name": "field, model", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for field, model in opts.get_fields_with_model():\n if local_only and model is not None:\n continue\n if start_alias:\n try:\n alias = seen[model]\n except KeyError:\n if model is proxied_model:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L124_C12", "label": "if", "type": "if", "loc": [124, 125], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L123_C8", "vector": [4, 3, 0.4478, 0.0072, 3, 0.26, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if local_only and model is not None:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L126_C12", "label": "if", "type": "if", "loc": [126, 141], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L123_C8", "vector": [4, 3, 0.4802, 0.0576, 3, 0.26, 0.1667, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if start_alias:\n try:\n alias = seen[model]\n except KeyError:\n if model is proxied_model:\n alias = start_alias\n else:\n link_field = opts.get_ancestor_link(model)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Try_L127_C16", "label": "try", "type": "try", "loc": [127, 136], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L126_C12", "vector": [7, 4, 0.473, 0.036, 4, 0.84, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n alias = seen[model]\n except KeyError:\n if model is proxied_model:\n alias = start_alias\n else:\n link_field = opts.get_ancestor_link(model)\n alias = self.query.join((start_alias, model._meta.db_table,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L128_C20", "label": "alias =", "type": "assigned_variable", "loc": [128, 128], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:Try_L127_C16", "vector": [14, 5, 0.4604, 0.0036, 5, 0.87, 0.0, 657, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "alias", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " alias = seen[model]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L130_C20", "label": "if", "type": "if", "loc": [130, 135], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:Try_L127_C16", "vector": [4, 5, 0.4766, 0.0216, 5, 0.87, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if model is proxied_model:\n alias = start_alias\n else:\n link_field = opts.get_ancestor_link(model)\n alias = self.query.join((start_alias, model._meta.db_table,\n link_field.column, model._meta.pk.column))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L131_C24", "label": "alias =", "type": "assigned_variable", "loc": [131, 131], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L130_C20", "vector": [14, 6, 0.4712, 0.0036, 6, 0.78, 0.0, 657, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "alias", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " alias = start_alias"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L133_C24", "label": "link_field = get_ancestor_link()", "type": "assigned_variable", "loc": [133, 133], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L130_C20", "vector": [14, 6, 0.4784, 0.0036, 6, 0.78, 0.5, 887, 3, 1, 0, 0, 646, 10, 1], "semantic": {"name": "link_field", "arg_names": [], "import_names": [], "rhs_call_name": "get_ancestor_link", "annotation": ""}, "snippet": " link_field = opts.get_ancestor_link(model)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L134_C24", "label": "alias = join()", "type": "assigned_variable", "loc": [134, 135], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L130_C20", "vector": [14, 6, 0.4838, 0.0072, 6, 0.78, 1.0, 657, 3, 1, 0, 0, 933, 10, 1], "semantic": {"name": "alias", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " alias = self.query.join((start_alias, model._meta.db_table,\n link_field.column, model._meta.pk.column))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L136_C20", "label": "assign", "type": "assigned_variable", "loc": [136, 136], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:Try_L127_C16", "vector": [14, 5, 0.4892, 0.0036, 5, 0.87, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " seen[model] = alias"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L141_C16", "label": "alias =", "type": "assigned_variable", "loc": [141, 141], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L126_C12", "vector": [14, 4, 0.5072, 0.0036, 4, 0.84, 1.0, 657, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "alias", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " alias = self.query.included_inherited_models[model]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L142_C12", "label": "table =", "type": "assigned_variable", "loc": [142, 142], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L123_C8", "vector": [14, 3, 0.5108, 0.0036, 3, 0.26, 0.3333, 338, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " table = self.query.alias_map[alias][TABLE_NAME]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L143_C12", "label": "if", "type": "if", "loc": [143, 144], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L123_C8", "vector": [4, 3, 0.5162, 0.0072, 3, 0.26, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if table in only_load and field.column not in only_load[table]:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L145_C12", "label": "if", "type": "if", "loc": [145, 148], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L123_C8", "vector": [4, 3, 0.527, 0.0144, 3, 0.26, 0.6667, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if as_pairs:\n result.append((alias, field.column))\n aliases.add(alias)\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L146_C16", "label": "append()", "type": "expression", "loc": [146, 146], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L145_C12", "vector": [8, 4, 0.5252, 0.0036, 4, 0.59, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " result.append((alias, field.column))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L147_C16", "label": "add()", "type": "expression", "loc": [147, 147], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L145_C12", "vector": [8, 4, 0.5288, 0.0036, 4, 0.59, 1.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " aliases.add(alias)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L152_C12", "label": "field_sel = get_field_select()", "type": "assigned_variable", "loc": [152, 152], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L123_C8", "vector": [14, 3, 0.5468, 0.0036, 3, 0.26, 0.8333, 548, 3, 2, 0, 0, 106, 10, 1], "semantic": {"name": "field_sel", "arg_names": [], "import_names": [], "rhs_call_name": "get_field_select", "annotation": ""}, "snippet": " field_sel = self.get_field_select(field, alias)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L153_C12", "label": "if", "type": "if", "loc": [153, 163], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L123_C8", "vector": [4, 3, 0.5683, 0.0396, 3, 0.26, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if with_aliases and field.column in col_aliases:\n c_alias = 'Col%d' % len(col_aliases)\n result.append('%s AS %s' % (field_sel, c_alias))\n col_aliases.add(c_alias)\n aliases.add(c_alias)\n else:\n r = field_sel\n result.append(r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L154_C16", "label": "c_alias =", "type": "assigned_variable", "loc": [154, 154], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L153_C12", "vector": [14, 4, 0.554, 0.0036, 4, 0.87, 0.0, 89, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "c_alias", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c_alias = 'Col%d' % len(col_aliases)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L155_C16", "label": "append()", "type": "expression", "loc": [155, 155], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L153_C12", "vector": [8, 4, 0.5576, 0.0036, 4, 0.87, 0.1429, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " result.append('%s AS %s' % (field_sel, c_alias))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L156_C16", "label": "add()", "type": "expression", "loc": [156, 156], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L153_C12", "vector": [8, 4, 0.5612, 0.0036, 4, 0.87, 0.2857, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " col_aliases.add(c_alias)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L157_C16", "label": "add()", "type": "expression", "loc": [157, 157], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L153_C12", "vector": [8, 4, 0.5647, 0.0036, 4, 0.87, 0.4286, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " aliases.add(c_alias)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L159_C16", "label": "r =", "type": "assigned_variable", "loc": [159, 159], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L153_C12", "vector": [14, 4, 0.5719, 0.0036, 4, 0.87, 0.5714, 436, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r = field_sel"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L160_C16", "label": "append()", "type": "expression", "loc": [160, 160], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L153_C12", "vector": [8, 4, 0.5755, 0.0036, 4, 0.87, 0.7143, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " result.append(r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L161_C16", "label": "add()", "type": "expression", "loc": [161, 161], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L153_C12", "vector": [8, 4, 0.5791, 0.0036, 4, 0.87, 0.8571, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " aliases.add(r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L162_C16", "label": "if", "type": "if", "loc": [162, 163], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L153_C12", "vector": [4, 4, 0.5845, 0.0072, 4, 0.87, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if with_aliases:\n col_aliases.add(field.column)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L163_C20", "label": "add()", "type": "expression", "loc": [163, 163], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L162_C16", "vector": [8, 5, 0.5863, 0.0036, 5, 0.64, 0.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " col_aliases.add(field.column)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Return_L164_C8", "label": "return", "type": "return", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L97_C4", "vector": [13, 2, 0.5899, 0.0036, 2, 0.84, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return result, aliases"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L166_C4", "label": "resolve_columns", "type": "function", "loc": [166, 200], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:ClassDef_L9_C0", "vector": [2, 1, 0.6583, 0.1259, 1, 0.37, 0.3333, 224, 0, 3, 1, 0, 0, 0, 14], "semantic": {"name": "resolve_columns", "arg_names": ["self", "row", "fields"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def resolve_columns(self, row, fields=()):\n \"\"\"\n This routine is necessary so that distances and geometries returned\n from extra selection SQL get resolved appropriately into Python\n objects.\n \"\"\"\n values = []\n aliases = self.query.extra_select.keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L167_C8", "label": "expression", "type": "expression", "loc": [167, 171], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L166_C4", "vector": [8, 2, 0.6079, 0.018, 2, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n This routine is necessary so that distances and geometries returned\n from extra selection SQL get resolved appropriately into Python\n objects.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L172_C8", "label": "values =", "type": "assigned_variable", "loc": [172, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L166_C4", "vector": [14, 2, 0.6187, 0.0036, 2, 0.72, 0.1111, 721, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "values", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " values = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L173_C8", "label": "aliases = keys()", "type": "assigned_variable", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L166_C4", "vector": [14, 2, 0.6223, 0.0036, 2, 0.72, 0.2222, 88, 3, 0, 0, 0, 204, 10, 1], "semantic": {"name": "aliases", "arg_names": [], "import_names": [], "rhs_call_name": "keys", "annotation": ""}, "snippet": " aliases = self.query.extra_select.keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L174_C8", "label": "if", "type": "if", "loc": [174, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L166_C4", "vector": [4, 2, 0.6313, 0.0144, 2, 0.72, 0.3333, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.query.aggregates:\n # If we have an aggregate annotation, must extend the aliases\n # so their corresponding row values are included.\n aliases.extend([None for i in xrange(len(self.query.aggregates))])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L177_C12", "label": "extend()", "type": "expression", "loc": [177, 177], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L174_C8", "vector": [8, 3, 0.6367, 0.0036, 3, 0.81, 0.0, 660, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " aliases.extend([None for i in xrange(len(self.query.aggregates))])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L182_C8", "label": "rn_offset =", "type": "assigned_variable", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L166_C4", "vector": [14, 2, 0.6547, 0.0036, 2, 0.72, 0.4444, 143, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "rn_offset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rn_offset = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L183_C8", "label": "if", "type": "if", "loc": [183, 184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L166_C4", "vector": [4, 2, 0.6601, 0.0072, 2, 0.72, 0.5556, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.connection.ops.oracle:\n if self.query.high_mark is not None or self.query.low_mark: rn_offset = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L184_C12", "label": "if", "type": "if", "loc": [184, 184], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L183_C8", "vector": [4, 3, 0.6619, 0.0036, 3, 0.6, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.query.high_mark is not None or self.query.low_mark: rn_offset = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L184_C72", "label": "rn_offset =", "type": "assigned_variable", "loc": [184, 184], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L184_C12", "vector": [14, 4, 0.6619, 0.0036, 4, 0.41, 0.0, 143, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "rn_offset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.query.high_mark is not None or self.query.low_mark: rn_offset = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L185_C8", "label": "index_start =", "type": "assigned_variable", "loc": [185, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L166_C4", "vector": [14, 2, 0.6655, 0.0036, 2, 0.72, 0.6667, 645, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "index_start", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " index_start = rn_offset + len(aliases)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L189_C8", "label": "values =", "type": "assigned_variable", "loc": [189, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L166_C4", "vector": [14, 2, 0.6853, 0.0144, 2, 0.72, 0.7778, 721, 5, 0, 0, 0, 0, 0, 3], "semantic": {"name": "values", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " values = [self.query.convert_values(v,\n self.query.extra_select_fields.get(a, None),\n self.connection)\n for v, a in izip(row[rn_offset:index_start], aliases)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L193_C8", "label": "if", "type": "if", "loc": [193, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L166_C4", "vector": [4, 2, 0.705, 0.0252, 2, 0.72, 0.8889, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.connection.ops.oracle or getattr(self.query, 'geo_values', False):\n # We resolve the rest of the columns if we're on Oracle or if\n # the `geo_values` attribute is defined.\n for value, field in map(None, row[index_start:], fields):\n values.append(self.query.convert_values(value, field, connection=self.connection))\n else:\n values.extend(row[index_start:])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L196_C12", "label": "for value, field", "type": "for", "loc": [196, 197], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L193_C8", "vector": [6, 3, 0.7068, 0.0072, 3, 0.43, 0.0, 261, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "value, field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for value, field in map(None, row[index_start:], fields):\n values.append(self.query.convert_values(value, field, connection=self.connection))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L197_C16", "label": "append()", "type": "expression", "loc": [197, 197], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L196_C12", "vector": [8, 4, 0.7086, 0.0036, 4, 0.44, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " values.append(self.query.convert_values(value, field, connection=self.connection))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L199_C12", "label": "extend()", "type": "expression", "loc": [199, 199], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L193_C8", "vector": [8, 3, 0.7158, 0.0036, 3, 0.43, 1.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " values.extend(row[index_start:])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Return_L200_C8", "label": "return", "type": "return", "loc": [200, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L166_C4", "vector": [13, 2, 0.7194, 0.0036, 2, 0.72, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return tuple(values)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L203_C4", "label": "get_extra_select_format", "type": "function", "loc": [203, 207], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:ClassDef_L9_C0", "vector": [2, 1, 0.7374, 0.018, 1, 0.37, 0.5, 375, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "get_extra_select_format", "arg_names": ["self", "alias"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_extra_select_format(self, alias):\n sel_fmt = '%s'\n if alias in self.query.custom_select:\n sel_fmt = sel_fmt % self.query.custom_select[alias]\n return sel_fmt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L204_C8", "label": "sel_fmt =", "type": "assigned_variable", "loc": [204, 204], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L203_C4", "vector": [14, 2, 0.7338, 0.0036, 2, 0.5, 0.0, 917, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sel_fmt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sel_fmt = '%s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L205_C8", "label": "if", "type": "if", "loc": [205, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L203_C4", "vector": [4, 2, 0.7392, 0.0072, 2, 0.5, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if alias in self.query.custom_select:\n sel_fmt = sel_fmt % self.query.custom_select[alias]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L206_C12", "label": "sel_fmt =", "type": "assigned_variable", "loc": [206, 206], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L205_C8", "vector": [14, 3, 0.741, 0.0036, 3, 0.76, 0.0, 917, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sel_fmt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sel_fmt = sel_fmt % self.query.custom_select[alias]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Return_L207_C8", "label": "return", "type": "return", "loc": [207, 207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L203_C4", "vector": [13, 2, 0.7446, 0.0036, 2, 0.5, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sel_fmt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L209_C4", "label": "get_field_select", "type": "function", "loc": [209, 223], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:ClassDef_L9_C0", "vector": [2, 1, 0.777, 0.054, 1, 0.37, 0.6667, 106, 0, 4, 1, 0, 0, 0, 2], "semantic": {"name": "get_field_select", "arg_names": ["self", "field", "alias", "column"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_field_select(self, field, alias=None, column=None):\n \"\"\"\n Returns the SELECT SQL string for the given field. Figures out\n if any custom selection SQL is needed for the column The `alias`\n keyword may be used to manually specify the database table where\n the column exists, if not in the model associated with this\n `GeoQuery`. Similarly, `column` may be used to specify the exact\n column name, rather than using the `column` attribute on `field`."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L210_C8", "label": "expression", "type": "expression", "loc": [210, 217], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L209_C4", "vector": [8, 2, 0.768, 0.0288, 2, 0.5, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the SELECT SQL string for the given field. Figures out\n if any custom selection SQL is needed for the column The `alias`\n keyword may be used to manually specify the database table where\n the column exists, if not in the model associated with this\n `GeoQuery`. Similarly, `column` may be used to specify the exact\n column name, rather than using the `column` attribute on `field`.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L218_C8", "label": "sel_fmt = get_select_format()", "type": "assigned_variable", "loc": [218, 218], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L209_C4", "vector": [14, 2, 0.7842, 0.0036, 2, 0.5, 0.3333, 917, 3, 1, 0, 0, 344, 10, 1], "semantic": {"name": "sel_fmt", "arg_names": [], "import_names": [], "rhs_call_name": "get_select_format", "annotation": ""}, "snippet": " sel_fmt = self.get_select_format(field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L219_C8", "label": "if", "type": "if", "loc": [219, 222], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L209_C4", "vector": [4, 2, 0.7932, 0.0144, 2, 0.5, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if field in self.query.custom_select:\n field_sel = sel_fmt % self.query.custom_select[field]\n else:\n field_sel = sel_fmt % self._field_column(field, alias, column)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L220_C12", "label": "field_sel =", "type": "assigned_variable", "loc": [220, 220], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L219_C8", "vector": [14, 3, 0.7914, 0.0036, 3, 0.84, 0.0, 548, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "field_sel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " field_sel = sel_fmt % self.query.custom_select[field]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L222_C12", "label": "field_sel =", "type": "assigned_variable", "loc": [222, 222], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L219_C8", "vector": [14, 3, 0.7986, 0.0036, 3, 0.84, 1.0, 548, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "field_sel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " field_sel = sel_fmt % self._field_column(field, alias, column)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Return_L223_C8", "label": "return", "type": "return", "loc": [223, 223], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L209_C4", "vector": [13, 2, 0.8022, 0.0036, 2, 0.5, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return field_sel"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L225_C4", "label": "get_select_format", "type": "function", "loc": [225, 249], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:ClassDef_L9_C0", "vector": [2, 1, 0.8525, 0.0899, 1, 0.37, 0.8333, 344, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "get_select_format", "arg_names": ["self", "fld"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_select_format(self, fld):\n \"\"\"\n Returns the selection format string, depending on the requirements\n of the spatial backend. For example, Oracle and MySQL require custom\n selection formats in order to retrieve geometries in OGC WKT. For all\n other fields a simple '%s' format string is returned.\n \"\"\"\n if self.connection.ops.select and hasattr(fld, 'geom_type'):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L226_C8", "label": "expression", "type": "expression", "loc": [226, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L225_C4", "vector": [8, 2, 0.8219, 0.0216, 2, 0.92, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the selection format string, depending on the requirements\n of the spatial backend. For example, Oracle and MySQL require custom\n selection formats in order to retrieve geometries in OGC WKT. For all\n other fields a simple '%s' format string is returned.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L232_C8", "label": "if", "type": "if", "loc": [232, 248], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L225_C4", "vector": [4, 2, 0.8633, 0.0612, 2, 0.92, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.connection.ops.select and hasattr(fld, 'geom_type'):\n # This allows operations to be done on fields in the SELECT,\n # overriding their values -- used by the Oracle and MySQL\n # spatial backends to get database values as WKT, and by the\n # `transform` method.\n sel_fmt = self.connection.ops.select\n\n # Because WKT doesn't contain spatial reference information,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L237_C12", "label": "sel_fmt =", "type": "assigned_variable", "loc": [237, 237], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L232_C8", "vector": [14, 3, 0.8525, 0.0036, 3, 0.42, 0.0, 917, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sel_fmt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sel_fmt = self.connection.ops.select"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L244_C12", "label": "if", "type": "if", "loc": [244, 246], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L232_C8", "vector": [4, 3, 0.8813, 0.0108, 3, 0.42, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.query.transformed_srid and ( self.connection.ops.oracle or\n self.connection.ops.spatialite ):\n sel_fmt = \"'SRID=%d;'||%s\" % (self.query.transformed_srid, sel_fmt)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L246_C16", "label": "sel_fmt =", "type": "assigned_variable", "loc": [246, 246], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L244_C12", "vector": [14, 4, 0.8849, 0.0036, 4, 0.63, 0.0, 917, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sel_fmt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sel_fmt = \"'SRID=%d;'||%s\" % (self.query.transformed_srid, sel_fmt)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L248_C12", "label": "sel_fmt =", "type": "assigned_variable", "loc": [248, 248], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L232_C8", "vector": [14, 3, 0.8921, 0.0036, 3, 0.42, 1.0, 917, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sel_fmt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sel_fmt = '%s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Return_L249_C8", "label": "return", "type": "return", "loc": [249, 249], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L225_C4", "vector": [13, 2, 0.8957, 0.0036, 2, 0.92, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sel_fmt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L252_C4", "label": "_field_column", "type": "function", "loc": [252, 263], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:ClassDef_L9_C0", "vector": [2, 1, 0.9263, 0.0432, 1, 0.37, 1.0, 805, 0, 4, 1, 0, 0, 0, 2], "semantic": {"name": "_field_column", "arg_names": ["self", "field", "table_alias", "column"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _field_column(self, field, table_alias=None, column=None):\n \"\"\"\n Helper function that returns the database column for the given field.\n The table and column are returned (quoted) in the proper format, e.g.,\n `\"geoapp_city\".\"point\"`. If `table_alias` is not specified, the\n database table associated with the model of this `GeoQuery` will be\n used. If `column` is specified, it will be used instead of the value\n in `field.column`."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L253_C8", "label": "expression", "type": "expression", "loc": [253, 260], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L252_C4", "vector": [8, 2, 0.9227, 0.0288, 2, 0.87, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Helper function that returns the database column for the given field.\n The table and column are returned (quoted) in the proper format, e.g.,\n `\"geoapp_city\".\"point\"`. If `table_alias` is not specified, the\n database table associated with the model of this `GeoQuery` will be\n used. If `column` is specified, it will be used instead of the value\n in `field.column`.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L261_C8", "label": "if", "type": "if", "loc": [261, 261], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L252_C4", "vector": [4, 2, 0.9388, 0.0036, 2, 0.87, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if table_alias is None: table_alias = self.query.model._meta.db_table"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L261_C32", "label": "table_alias =", "type": "assigned_variable", "loc": [261, 261], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L261_C8", "vector": [14, 3, 0.9388, 0.0036, 3, 0.29, 0.0, 441, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "table_alias", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if table_alias is None: table_alias = self.query.model._meta.db_table"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:Return_L262_C8", "label": "return", "type": "return", "loc": [262, 263], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L252_C4", "vector": [13, 2, 0.9442, 0.0072, 2, 0.87, 1.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"%s.%s\" % (self.quote_name_unless_alias(table_alias),\n self.connection.ops.quote_name(column or field.column))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:ClassDef_L265_C0", "label": "SQLInsertCompiler", "type": "class", "loc": [265, 266], "level": 0, "parent": null, "vector": [3, 0, 0.955, 0.0072, 0, 0.66, 0.6364, 217, 0, 0, 0, 0, 928, 0, 0], "semantic": {"name": "SQLInsertCompiler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SQLInsertCompiler(compiler.SQLInsertCompiler, GeoSQLCompiler):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:ClassDef_L268_C0", "label": "SQLDeleteCompiler", "type": "class", "loc": [268, 269], "level": 0, "parent": null, "vector": [3, 0, 0.9658, 0.0072, 0, 0.66, 0.7273, 715, 0, 0, 0, 0, 754, 0, 0], "semantic": {"name": "SQLDeleteCompiler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SQLDeleteCompiler(compiler.SQLDeleteCompiler, GeoSQLCompiler):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:ClassDef_L271_C0", "label": "SQLUpdateCompiler", "type": "class", "loc": [271, 272], "level": 0, "parent": null, "vector": [3, 0, 0.9766, 0.0072, 0, 0.66, 0.8182, 756, 0, 0, 0, 0, 592, 0, 0], "semantic": {"name": "SQLUpdateCompiler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SQLUpdateCompiler(compiler.SQLUpdateCompiler, GeoSQLCompiler):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:ClassDef_L274_C0", "label": "SQLAggregateCompiler", "type": "class", "loc": [274, 275], "level": 0, "parent": null, "vector": [3, 0, 0.9874, 0.0072, 0, 0.66, 0.9091, 216, 0, 0, 0, 0, 742, 0, 0], "semantic": {"name": "SQLAggregateCompiler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SQLAggregateCompiler(compiler.SQLAggregateCompiler, GeoSQLCompiler):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98754:ClassDef_L277_C0", "label": "SQLDateCompiler", "type": "class", "loc": [277, 278], "level": 0, "parent": null, "vector": [3, 0, 0.9982, 0.0072, 0, 0.66, 1.0, 583, 0, 0, 0, 0, 171, 0, 0], "semantic": {"name": "SQLDateCompiler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SQLDateCompiler(compiler.SQLDateCompiler, GeoSQLCompiler):\n pass"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98754:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L29_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L30_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L29_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L32_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L34_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L36_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L36_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L37_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L37_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L38_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L37_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L39_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L37_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L40_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L37_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L42_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L37_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L43_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L43_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L44_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L44_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L45_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L44_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L46_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L44_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L47_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L44_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L48_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L44_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L50_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L44_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L51_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L44_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L52_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L43_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L54_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L43_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L55_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L43_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L56_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L37_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L58_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L37_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L60_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L60_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L61_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L60_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L62_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L64_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L65_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L64_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L67_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L64_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L68_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L83_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L84_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L84_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L85_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L84_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L86_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L84_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L87_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L84_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L88_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L84_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L90_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L84_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L91_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L84_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L92_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Return_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L114_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L115_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L121_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L122_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L124_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L126_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L126_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Try_L127_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:Try_L127_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L128_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:Try_L127_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L130_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L130_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L131_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L130_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L133_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L130_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L134_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:Try_L127_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L136_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L126_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L141_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L142_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L143_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L145_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L145_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L146_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L145_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L147_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L152_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L153_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L153_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L154_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L153_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L155_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L153_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L156_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L153_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L157_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L153_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L159_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L153_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L160_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L153_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L161_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L153_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L162_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L162_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L163_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Return_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L166_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L166_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L172_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L166_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L173_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L166_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L174_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L174_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L177_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L166_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L182_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L166_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L183_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L184_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L184_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L184_C72"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L166_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L185_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L166_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L166_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L193_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L196_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:For_L196_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L197_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L193_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L199_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L166_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Return_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L203_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L203_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L204_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L203_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L205_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L205_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L206_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L203_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Return_L207_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L209_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L209_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L210_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L209_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L218_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L209_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L219_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L219_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L220_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L219_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L222_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L209_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Return_L223_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L225_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L225_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L226_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L225_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L232_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L232_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L237_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L232_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L244_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L244_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L246_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L232_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L248_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L225_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Return_L249_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L252_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L252_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L253_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L252_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L261_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:If_L261_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Assign_L261_C32"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L252_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Return_L262_C8"}] |
"""
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 AreaField(BaseField):
"Wrapper for Area values."
def __init__(self, area_att):
self.area_att = area_att
class DistanceField(BaseField):
"Wrapper for Distance values."
def __init__(self, distance_att):
self.distance_att = distance_att
class GeomField(BaseField):
"""
Wrapper for Geometry values. It is a lightweight alternative to
using GeometryField (which requires a SQL query upon instantiation).
"""
pass
| ajibawa-2023/Python-Code-Large/train/row_98755 | 16 | 27 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98755:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0926, 0.1481, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis module holds simple classes used by GeoQuery.convert_values\nto convert geospatial values from the database.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98755:ClassDef_L6_C0", "label": "BaseField", "type": "class", "loc": [6, 10], "level": 0, "parent": null, "vector": [3, 0, 0.2963, 0.1852, 0, 0.66, 0.25, 638, 0, 1, 0, 0, 186, 0, 0], "semantic": {"name": "BaseField", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BaseField(object):\n empty_strings_allowed = True\n def get_internal_type(self):\n \"Overloaded method so OracleQuery.convert_values doesn't balk.\"\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98755:Assign_L7_C4", "label": "empty_strings_allowed =", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98755:ClassDef_L6_C0", "vector": [14, 1, 0.2593, 0.037, 1, 0.98, 0.0, 336, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "empty_strings_allowed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " empty_strings_allowed = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98755:FunctionDef_L8_C4", "label": "get_internal_type", "type": "function", "loc": [8, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98755:ClassDef_L6_C0", "vector": [2, 1, 0.3333, 0.1111, 1, 0.98, 1.0, 291, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_internal_type", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_internal_type(self):\n \"Overloaded method so OracleQuery.convert_values doesn't balk.\"\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98755:Expr_L9_C8", "label": "expression", "type": "expression", "loc": [9, 9], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98755:FunctionDef_L8_C4", "vector": [8, 2, 0.3333, 0.037, 2, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Overloaded method so OracleQuery.convert_values doesn't balk.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98755:Return_L10_C8", "label": "return", "type": "return", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98755:FunctionDef_L8_C4", "vector": [13, 2, 0.3704, 0.037, 2, 0.41, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98755:ClassDef_L12_C0", "label": "AreaField", "type": "class", "loc": [12, 15], "level": 0, "parent": null, "vector": [3, 0, 0.5, 0.1481, 0, 0.66, 0.5, 721, 0, 1, 0, 0, 638, 0, 0], "semantic": {"name": "AreaField", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class AreaField(BaseField):\n \"Wrapper for Area values.\"\n def __init__(self, area_att):\n self.area_att = area_att"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98755:Expr_L13_C4", "label": "expression", "type": "expression", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98755:ClassDef_L12_C0", "vector": [8, 1, 0.4815, 0.037, 1, 0.58, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Wrapper for Area values.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98755:FunctionDef_L14_C4", "label": "__init__", "type": "function", "loc": [14, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98755:ClassDef_L12_C0", "vector": [2, 1, 0.537, 0.0741, 1, 0.58, 1.0, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "area_att"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, area_att):\n self.area_att = area_att"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98755:Assign_L15_C8", "label": "self.area_att =", "type": "assigned_variable", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98755:FunctionDef_L14_C4", "vector": [14, 2, 0.5556, 0.037, 2, 0.35, 0.0, 372, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.area_att", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.area_att = area_att"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98755:ClassDef_L17_C0", "label": "DistanceField", "type": "class", "loc": [17, 20], "level": 0, "parent": null, "vector": [3, 0, 0.6852, 0.1481, 0, 0.66, 0.75, 312, 0, 1, 0, 0, 638, 0, 0], "semantic": {"name": "DistanceField", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DistanceField(BaseField):\n \"Wrapper for Distance values.\"\n def __init__(self, distance_att):\n self.distance_att = distance_att"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98755:Expr_L18_C4", "label": "expression", "type": "expression", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98755:ClassDef_L17_C0", "vector": [8, 1, 0.6667, 0.037, 1, 0.34, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Wrapper for Distance values.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98755:FunctionDef_L19_C4", "label": "__init__", "type": "function", "loc": [19, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98755:ClassDef_L17_C0", "vector": [2, 1, 0.7222, 0.0741, 1, 0.34, 1.0, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "distance_att"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, distance_att):\n self.distance_att = distance_att"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98755:Assign_L20_C8", "label": "self.distance_att =", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98755:FunctionDef_L19_C4", "vector": [14, 2, 0.7407, 0.037, 2, 0.48, 0.0, 682, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.distance_att", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.distance_att = distance_att"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98755:ClassDef_L22_C0", "label": "GeomField", "type": "class", "loc": [22, 27], "level": 0, "parent": null, "vector": [3, 0, 0.9074, 0.2222, 0, 0.66, 1.0, 944, 0, 0, 0, 0, 638, 0, 0], "semantic": {"name": "GeomField", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GeomField(BaseField):\n \"\"\"\n Wrapper for Geometry values. It is a lightweight alternative to \n using GeometryField (which requires a SQL query upon instantiation).\n \"\"\"\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98755:Expr_L23_C4", "label": "expression", "type": "expression", "loc": [23, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98755:ClassDef_L22_C0", "vector": [8, 1, 0.9074, 0.1481, 1, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Wrapper for Geometry values. It is a lightweight alternative to \n using GeometryField (which requires a SQL query upon instantiation).\n \"\"\""}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98755:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98755:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98755:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98755:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98755:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98755:Expr_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98755:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98755:Return_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98755:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98755:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98755:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98755:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98755:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98755:Assign_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98755:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98755:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98755:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98755:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98755:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98755:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98755:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98755:Expr_L23_C4"}] |
from django.db.models.sql.aggregates import *
from django.contrib.gis.db.models.fields import GeometryField
from django.contrib.gis.db.models.sql.conversion import GeomField
class GeoAggregate(Aggregate):
# Default SQL template for spatial aggregates.
sql_template = '%(function)s(%(field)s)'
# Conversion class, if necessary.
conversion_class = None
# Flags for indicating the type of the aggregate.
is_extent = False
def __init__(self, col, source=None, is_summary=False, tolerance=0.05, **extra):
super(GeoAggregate, self).__init__(col, source, is_summary, **extra)
# Required by some Oracle aggregates.
self.tolerance = tolerance
# Can't use geographic aggregates on non-geometry fields.
if not isinstance(self.source, GeometryField):
raise ValueError('Geospatial aggregates only allowed on geometry fields.')
def as_sql(self, qn, connection):
"Return the aggregate, rendered as SQL."
if connection.ops.oracle:
self.extra['tolerance'] = self.tolerance
if hasattr(self.col, 'as_sql'):
field_name = self.col.as_sql(qn, connection)
elif isinstance(self.col, (list, tuple)):
field_name = '.'.join([qn(c) for c in self.col])
else:
field_name = self.col
sql_template, sql_function = connection.ops.spatial_aggregate_sql(self)
params = {
'function': sql_function,
'field': field_name
}
params.update(self.extra)
return sql_template % params
class Collect(GeoAggregate):
pass
class Extent(GeoAggregate):
is_extent = '2D'
class Extent3D(GeoAggregate):
is_extent = '3D'
class MakeLine(GeoAggregate):
pass
class Union(GeoAggregate):
pass
| ajibawa-2023/Python-Code-Large/train/row_98756 | 31 | 61 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98756:ImportFrom_L1_C0", "label": "from django.db.models.sql.aggregates import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0164, 0.0164, 0, 0.66, 0.0, 101, 0, 1, 0, 0, 101, 0, 0], "semantic": {"name": "django.db.models.sql.aggregates", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.models.sql.aggregates import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:ImportFrom_L2_C0", "label": "from django.contrib.gis.db.models.fields import GeometryField", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0328, 0.0164, 0, 0.66, 0.125, 708, 0, 1, 0, 0, 708, 0, 0], "semantic": {"name": "django.contrib.gis.db.models.fields", "arg_names": [], "import_names": ["GeometryField"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.models.fields import GeometryField"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:ImportFrom_L3_C0", "label": "from django.contrib.gis.db.models.sql.conversion import GeomField", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0492, 0.0164, 0, 0.66, 0.25, 100, 0, 1, 0, 0, 100, 0, 0], "semantic": {"name": "django.contrib.gis.db.models.sql.conversion", "arg_names": [], "import_names": ["GeomField"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.models.sql.conversion import GeomField"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:ClassDef_L5_C0", "label": "GeoAggregate", "type": "class", "loc": [5, 46], "level": 0, "parent": null, "vector": [3, 0, 0.418, 0.6885, 0, 0.66, 0.375, 5, 0, 2, 0, 0, 451, 0, 11], "semantic": {"name": "GeoAggregate", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GeoAggregate(Aggregate):\n # Default SQL template for spatial aggregates.\n sql_template = '%(function)s(%(field)s)'\n\n # Conversion class, if necessary.\n conversion_class = None\n\n # Flags for indicating the type of the aggregate."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L7_C4", "label": "sql_template =", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98756:ClassDef_L5_C0", "vector": [14, 1, 0.1148, 0.0164, 1, 0.5, 0.0, 765, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sql_template", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sql_template = '%(function)s(%(field)s)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L10_C4", "label": "conversion_class =", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98756:ClassDef_L5_C0", "vector": [14, 1, 0.1639, 0.0164, 1, 0.5, 0.25, 915, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "conversion_class", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " conversion_class = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L13_C4", "label": "is_extent =", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98756:ClassDef_L5_C0", "vector": [14, 1, 0.2131, 0.0164, 1, 0.5, 0.5, 663, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "is_extent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " is_extent = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:FunctionDef_L15_C4", "label": "__init__", "type": "function", "loc": [15, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98756:ClassDef_L5_C0", "vector": [2, 1, 0.3115, 0.1475, 1, 0.5, 0.75, 555, 0, 6, 0, 0, 0, 0, 4], "semantic": {"name": "__init__", "arg_names": ["self", "col", "source", "is_summary", "tolerance", "extra"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, col, source=None, is_summary=False, tolerance=0.05, **extra):\n super(GeoAggregate, self).__init__(col, source, is_summary, **extra)\n\n # Required by some Oracle aggregates.\n self.tolerance = tolerance\n\n # Can't use geographic aggregates on non-geometry fields.\n if not isinstance(self.source, GeometryField):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:Expr_L16_C8", "label": "__init__()", "type": "expression", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98756:FunctionDef_L15_C4", "vector": [8, 2, 0.2623, 0.0164, 2, 0.93, 0.0, 555, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(GeoAggregate, self).__init__(col, source, is_summary, **extra)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L19_C8", "label": "self.tolerance =", "type": "assigned_variable", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98756:FunctionDef_L15_C4", "vector": [14, 2, 0.3115, 0.0164, 2, 0.93, 0.5, 948, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.tolerance", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.tolerance = tolerance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:If_L22_C8", "label": "if", "type": "if", "loc": [22, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98756:FunctionDef_L15_C4", "vector": [4, 2, 0.3689, 0.0328, 2, 0.93, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(self.source, GeometryField):\n raise ValueError('Geospatial aggregates only allowed on geometry fields.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:FunctionDef_L25_C4", "label": "as_sql", "type": "function", "loc": [25, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98756:ClassDef_L5_C0", "vector": [2, 1, 0.582, 0.3607, 1, 0.5, 1.0, 122, 0, 3, 1, 0, 0, 0, 7], "semantic": {"name": "as_sql", "arg_names": ["self", "qn", "connection"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def as_sql(self, qn, connection):\n \"Return the aggregate, rendered as SQL.\"\n\n if connection.ops.oracle:\n self.extra['tolerance'] = self.tolerance\n\n if hasattr(self.col, 'as_sql'):\n field_name = self.col.as_sql(qn, connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:Expr_L26_C8", "label": "expression", "type": "expression", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98756:FunctionDef_L25_C4", "vector": [8, 2, 0.4262, 0.0164, 2, 0.19, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Return the aggregate, rendered as SQL.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:If_L28_C8", "label": "if", "type": "if", "loc": [28, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98756:FunctionDef_L25_C4", "vector": [4, 2, 0.4672, 0.0328, 2, 0.19, 0.1667, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if connection.ops.oracle:\n self.extra['tolerance'] = self.tolerance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L29_C12", "label": "assign", "type": "assigned_variable", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98756:If_L28_C8", "vector": [14, 3, 0.4754, 0.0164, 3, 0.33, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.extra['tolerance'] = self.tolerance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:If_L31_C8", "label": "if", "type": "if", "loc": [31, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98756:FunctionDef_L25_C4", "vector": [4, 2, 0.5492, 0.0984, 2, 0.19, 0.3333, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(self.col, 'as_sql'):\n field_name = self.col.as_sql(qn, connection)\n elif isinstance(self.col, (list, tuple)):\n field_name = '.'.join([qn(c) for c in self.col])\n else:\n field_name = self.col"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L32_C12", "label": "field_name = as_sql()", "type": "assigned_variable", "loc": [32, 32], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98756:If_L31_C8", "vector": [14, 3, 0.5246, 0.0164, 3, 0.17, 0.0, 918, 3, 2, 0, 0, 122, 10, 1], "semantic": {"name": "field_name", "arg_names": [], "import_names": [], "rhs_call_name": "as_sql", "annotation": ""}, "snippet": " field_name = self.col.as_sql(qn, connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:If_L33_C8", "label": "if", "type": "if", "loc": [33, 36], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98756:If_L31_C8", "vector": [4, 3, 0.5656, 0.0656, 3, 0.17, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(self.col, (list, tuple)):\n field_name = '.'.join([qn(c) for c in self.col])\n else:\n field_name = self.col"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L34_C12", "label": "field_name = join()", "type": "assigned_variable", "loc": [34, 34], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98756:If_L33_C8", "vector": [14, 4, 0.5574, 0.0164, 4, 0.43, 0.0, 918, 3, 1, 0, 0, 933, 10, 2], "semantic": {"name": "field_name", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " field_name = '.'.join([qn(c) for c in self.col])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L36_C12", "label": "field_name =", "type": "assigned_variable", "loc": [36, 36], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98756:If_L33_C8", "vector": [14, 4, 0.5902, 0.0164, 4, 0.43, 1.0, 918, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "field_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " field_name = self.col"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L38_C8", "label": "sql_template, sql_function = spatial_aggregate_sql()", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98756:FunctionDef_L25_C4", "vector": [14, 2, 0.623, 0.0164, 2, 0.19, 0.5, 251, 3, 1, 0, 0, 835, 10, 1], "semantic": {"name": "sql_template, sql_function", "arg_names": [], "import_names": [], "rhs_call_name": "spatial_aggregate_sql", "annotation": ""}, "snippet": " sql_template, sql_function = connection.ops.spatial_aggregate_sql(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L40_C8", "label": "params =", "type": "assigned_variable", "loc": [40, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98756:FunctionDef_L25_C4", "vector": [14, 2, 0.6803, 0.0656, 2, 0.19, 0.6667, 206, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = {\n 'function': sql_function,\n 'field': field_name\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:Expr_L44_C8", "label": "update()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98756:FunctionDef_L25_C4", "vector": [8, 2, 0.7213, 0.0164, 2, 0.19, 0.8333, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " params.update(self.extra)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:Return_L46_C8", "label": "return", "type": "return", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98756:FunctionDef_L25_C4", "vector": [13, 2, 0.7541, 0.0164, 2, 0.19, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sql_template % params"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:ClassDef_L48_C0", "label": "Collect", "type": "class", "loc": [48, 49], "level": 0, "parent": null, "vector": [3, 0, 0.7951, 0.0328, 0, 0.66, 0.5, 31, 0, 0, 0, 0, 5, 0, 0], "semantic": {"name": "Collect", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Collect(GeoAggregate):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:ClassDef_L51_C0", "label": "Extent", "type": "class", "loc": [51, 52], "level": 0, "parent": null, "vector": [3, 0, 0.8443, 0.0328, 0, 0.66, 0.625, 350, 0, 0, 0, 0, 5, 0, 0], "semantic": {"name": "Extent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Extent(GeoAggregate):\n is_extent = '2D'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L52_C4", "label": "is_extent =", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98756:ClassDef_L51_C0", "vector": [14, 1, 0.8525, 0.0164, 1, 0.92, 0.0, 663, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "is_extent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " is_extent = '2D'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:ClassDef_L54_C0", "label": "Extent3D", "type": "class", "loc": [54, 55], "level": 0, "parent": null, "vector": [3, 0, 0.8934, 0.0328, 0, 0.66, 0.75, 642, 0, 0, 0, 0, 5, 0, 0], "semantic": {"name": "Extent3D", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Extent3D(GeoAggregate):\n is_extent = '3D'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L55_C4", "label": "is_extent =", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98756:ClassDef_L54_C0", "vector": [14, 1, 0.9016, 0.0164, 1, 0.37, 0.0, 663, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "is_extent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " is_extent = '3D'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:ClassDef_L57_C0", "label": "MakeLine", "type": "class", "loc": [57, 58], "level": 0, "parent": null, "vector": [3, 0, 0.9426, 0.0328, 0, 0.66, 0.875, 128, 0, 0, 0, 0, 5, 0, 0], "semantic": {"name": "MakeLine", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MakeLine(GeoAggregate):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98756:ClassDef_L60_C0", "label": "Union", "type": "class", "loc": [60, 61], "level": 0, "parent": null, "vector": [3, 0, 0.9918, 0.0328, 0, 0.66, 1.0, 404, 0, 0, 0, 0, 5, 0, 0], "semantic": {"name": "Union", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Union(GeoAggregate):\n pass"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98756:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98756:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98756:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98756:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98756:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98756:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98756:Expr_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98756:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98756:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98756:If_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98756:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98756:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98756:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98756:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98756:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98756:If_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98756:If_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L29_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98756:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98756:If_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98756:If_L31_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L32_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98756:If_L31_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98756:If_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98756:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L34_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98756:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L36_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98756:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98756:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98756:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98756:Expr_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98756:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98756:Return_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98756:ClassDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98756:ClassDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L55_C4"}] |
from django.db.models.fields import Field, FieldDoesNotExist
from django.db.models.sql.constants import LOOKUP_SEP
from django.db.models.sql.expressions import SQLEvaluator
from django.db.models.sql.where import Constraint, WhereNode
from django.contrib.gis.db.models.fields import GeometryField
class GeoConstraint(Constraint):
"""
This subclass overrides `process` to better handle geographic SQL
construction.
"""
def __init__(self, init_constraint):
self.alias = init_constraint.alias
self.col = init_constraint.col
self.field = init_constraint.field
def process(self, lookup_type, value, connection):
if isinstance(value, SQLEvaluator):
# Make sure the F Expression destination field exists, and
# set an `srid` attribute with the same as that of the
# destination.
geo_fld = GeoWhereNode._check_geo_field(value.opts, value.expression.name)
if not geo_fld:
raise ValueError('No geographic field found in expression.')
value.srid = geo_fld.srid
db_type = self.field.db_type(connection=connection)
params = self.field.get_db_prep_lookup(lookup_type, value, connection=connection)
return (self.alias, self.col, db_type), params
class GeoWhereNode(WhereNode):
"""
Used to represent the SQL where-clause for spatial databases --
these are tied to the GeoQuery class that created it.
"""
def add(self, data, connector):
if isinstance(data, (list, tuple)):
obj, lookup_type, value = data
if ( isinstance(obj, Constraint) and
isinstance(obj.field, GeometryField) ):
data = (GeoConstraint(obj), lookup_type, value)
super(GeoWhereNode, self).add(data, connector)
def make_atom(self, child, qn, connection):
lvalue, lookup_type, value_annot, params_or_value = child
if isinstance(lvalue, GeoConstraint):
data, params = lvalue.process(lookup_type, params_or_value, connection)
spatial_sql = connection.ops.spatial_lookup_sql(data, lookup_type, params_or_value, lvalue.field, qn)
return spatial_sql, params
else:
return super(GeoWhereNode, self).make_atom(child, qn, connection)
@classmethod
def _check_geo_field(cls, opts, lookup):
"""
Utility for checking the given lookup with the given model options.
The lookup is a string either specifying the geographic field, e.g.
'point, 'the_geom', or a related lookup on a geographic field like
'address__point'.
If a GeometryField exists according to the given lookup on the model
options, it will be returned. Otherwise returns None.
"""
# This takes into account the situation where the lookup is a
# lookup to a related geographic field, e.g., 'address__point'.
field_list = lookup.split(LOOKUP_SEP)
# Reversing so list operates like a queue of related lookups,
# and popping the top lookup.
field_list.reverse()
fld_name = field_list.pop()
try:
geo_fld = opts.get_field(fld_name)
# If the field list is still around, then it means that the
# lookup was for a geometry field across a relationship --
# thus we keep on getting the related model options and the
# model field associated with the next field in the list
# until there's no more left.
while len(field_list):
opts = geo_fld.rel.to._meta
geo_fld = opts.get_field(field_list.pop())
except (FieldDoesNotExist, AttributeError):
return False
# Finally, make sure we got a Geographic field and return.
if isinstance(geo_fld, GeometryField):
return geo_fld
else:
return False
| ajibawa-2023/Python-Code-Large/train/row_98757 | 48 | 89 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98757:ImportFrom_L1_C0", "label": "from django.db.models.fields import Field, FieldDoesNotExist", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0112, 0.0112, 0, 0.66, 0.0, 5, 0, 2, 0, 0, 5, 0, 0], "semantic": {"name": "django.db.models.fields", "arg_names": [], "import_names": ["Field", "FieldDoesNotExist"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.models.fields import Field, FieldDoesNotExist"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:ImportFrom_L2_C0", "label": "from django.db.models.sql.constants import LOOKUP_SEP", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0225, 0.0112, 0, 0.66, 0.1667, 971, 0, 1, 0, 0, 971, 0, 0], "semantic": {"name": "django.db.models.sql.constants", "arg_names": [], "import_names": ["LOOKUP_SEP"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.models.sql.constants import LOOKUP_SEP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:ImportFrom_L3_C0", "label": "from django.db.models.sql.expressions import SQLEvaluator", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0337, 0.0112, 0, 0.66, 0.3333, 438, 0, 1, 0, 0, 438, 0, 0], "semantic": {"name": "django.db.models.sql.expressions", "arg_names": [], "import_names": ["SQLEvaluator"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.models.sql.expressions import SQLEvaluator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:ImportFrom_L4_C0", "label": "from django.db.models.sql.where import Constraint, WhereNode", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0449, 0.0112, 0, 0.66, 0.5, 737, 0, 2, 0, 0, 737, 0, 0], "semantic": {"name": "django.db.models.sql.where", "arg_names": [], "import_names": ["Constraint", "WhereNode"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.models.sql.where import Constraint, WhereNode"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:ImportFrom_L5_C0", "label": "from django.contrib.gis.db.models.fields import GeometryField", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0562, 0.0112, 0, 0.66, 0.6667, 708, 0, 1, 0, 0, 708, 0, 0], "semantic": {"name": "django.contrib.gis.db.models.fields", "arg_names": [], "import_names": ["GeometryField"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.models.fields import GeometryField"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:ClassDef_L7_C0", "label": "GeoConstraint", "type": "class", "loc": [7, 28], "level": 0, "parent": null, "vector": [3, 0, 0.1966, 0.2472, 0, 0.66, 0.8333, 224, 0, 2, 0, 0, 957, 0, 5], "semantic": {"name": "GeoConstraint", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GeoConstraint(Constraint):\n \"\"\"\n This subclass overrides `process` to better handle geographic SQL\n construction.\n \"\"\"\n def __init__(self, init_constraint):\n self.alias = init_constraint.alias\n self.col = init_constraint.col"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Expr_L8_C4", "label": "expression", "type": "expression", "loc": [8, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:ClassDef_L7_C0", "vector": [8, 1, 0.1067, 0.0449, 1, 0.68, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n This subclass overrides `process` to better handle geographic SQL\n construction.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L12_C4", "label": "__init__", "type": "function", "loc": [12, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:ClassDef_L7_C0", "vector": [2, 1, 0.1517, 0.0449, 1, 0.68, 0.5, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "init_constraint"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, init_constraint):\n self.alias = init_constraint.alias\n self.col = init_constraint.col\n self.field = init_constraint.field"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L13_C8", "label": "self.alias =", "type": "assigned_variable", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L12_C4", "vector": [14, 2, 0.1461, 0.0112, 2, 0.19, 0.0, 503, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.alias", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.alias = init_constraint.alias"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L14_C8", "label": "self.col =", "type": "assigned_variable", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L12_C4", "vector": [14, 2, 0.1573, 0.0112, 2, 0.19, 0.5, 11, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.col", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.col = init_constraint.col"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L15_C8", "label": "self.field =", "type": "assigned_variable", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L12_C4", "vector": [14, 2, 0.1685, 0.0112, 2, 0.19, 1.0, 951, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.field = init_constraint.field"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L17_C4", "label": "process", "type": "function", "loc": [17, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:ClassDef_L7_C0", "vector": [2, 1, 0.2528, 0.1348, 1, 0.68, 1.0, 712, 0, 4, 1, 0, 0, 0, 5], "semantic": {"name": "process", "arg_names": ["self", "lookup_type", "value", "connection"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def process(self, lookup_type, value, connection):\n if isinstance(value, SQLEvaluator):\n # Make sure the F Expression destination field exists, and\n # set an `srid` attribute with the same as that of the\n # destination.\n geo_fld = GeoWhereNode._check_geo_field(value.opts, value.expression.name)\n if not geo_fld:\n raise ValueError('No geographic field found in expression.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L18_C8", "label": "if", "type": "if", "loc": [18, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L17_C4", "vector": [4, 2, 0.2416, 0.0899, 2, 0.63, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, SQLEvaluator):\n # Make sure the F Expression destination field exists, and\n # set an `srid` attribute with the same as that of the\n # destination.\n geo_fld = GeoWhereNode._check_geo_field(value.opts, value.expression.name)\n if not geo_fld:\n raise ValueError('No geographic field found in expression.')\n value.srid = geo_fld.srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L22_C12", "label": "geo_fld = _check_geo_field()", "type": "assigned_variable", "loc": [22, 22], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L18_C8", "vector": [14, 3, 0.2472, 0.0112, 3, 0.81, 0.0, 290, 3, 2, 0, 0, 165, 10, 1], "semantic": {"name": "geo_fld", "arg_names": [], "import_names": [], "rhs_call_name": "_check_geo_field", "annotation": ""}, "snippet": " geo_fld = GeoWhereNode._check_geo_field(value.opts, value.expression.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L23_C12", "label": "if", "type": "if", "loc": [23, 24], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L18_C8", "vector": [4, 3, 0.264, 0.0225, 3, 0.81, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not geo_fld:\n raise ValueError('No geographic field found in expression.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L25_C12", "label": "value.srid =", "type": "assigned_variable", "loc": [25, 25], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L18_C8", "vector": [14, 3, 0.2809, 0.0112, 3, 0.81, 1.0, 431, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "value.srid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value.srid = geo_fld.srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L26_C8", "label": "db_type = db_type()", "type": "assigned_variable", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L17_C4", "vector": [14, 2, 0.2921, 0.0112, 2, 0.63, 0.3333, 976, 3, 1, 0, 0, 976, 10, 1], "semantic": {"name": "db_type", "arg_names": [], "import_names": [], "rhs_call_name": "db_type", "annotation": ""}, "snippet": " db_type = self.field.db_type(connection=connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L27_C8", "label": "params = get_db_prep_lookup()", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L17_C4", "vector": [14, 2, 0.3034, 0.0112, 2, 0.63, 0.6667, 206, 3, 3, 0, 0, 681, 10, 1], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "get_db_prep_lookup", "annotation": ""}, "snippet": " params = self.field.get_db_prep_lookup(lookup_type, value, connection=connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Return_L28_C8", "label": "return", "type": "return", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L17_C4", "vector": [13, 2, 0.3146, 0.0112, 2, 0.63, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (self.alias, self.col, db_type), params"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:ClassDef_L30_C0", "label": "GeoWhereNode", "type": "class", "loc": [30, 89], "level": 0, "parent": null, "vector": [3, 0, 0.6685, 0.6742, 0, 0.66, 1.0, 560, 0, 3, 0, 0, 202, 0, 19], "semantic": {"name": "GeoWhereNode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GeoWhereNode(WhereNode):\n \"\"\"\n Used to represent the SQL where-clause for spatial databases --\n these are tied to the GeoQuery class that created it.\n \"\"\"\n def add(self, data, connector):\n if isinstance(data, (list, tuple)):\n obj, lookup_type, value = data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Expr_L31_C4", "label": "expression", "type": "expression", "loc": [31, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:ClassDef_L30_C0", "vector": [8, 1, 0.3652, 0.0449, 1, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Used to represent the SQL where-clause for spatial databases --\n these are tied to the GeoQuery class that created it.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L35_C4", "label": "add", "type": "function", "loc": [35, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:ClassDef_L30_C0", "vector": [2, 1, 0.427, 0.0787, 1, 0.85, 0.3333, 241, 0, 3, 0, 0, 0, 0, 6], "semantic": {"name": "add", "arg_names": ["self", "data", "connector"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add(self, data, connector):\n if isinstance(data, (list, tuple)):\n obj, lookup_type, value = data\n if ( isinstance(obj, Constraint) and\n isinstance(obj.field, GeometryField) ):\n data = (GeoConstraint(obj), lookup_type, value)\n super(GeoWhereNode, self).add(data, connector)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L36_C8", "label": "if", "type": "if", "loc": [36, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L35_C4", "vector": [4, 2, 0.427, 0.0562, 2, 0.02, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(data, (list, tuple)):\n obj, lookup_type, value = data\n if ( isinstance(obj, Constraint) and\n isinstance(obj.field, GeometryField) ):\n data = (GeoConstraint(obj), lookup_type, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L37_C12", "label": "obj, lookup_type, value =", "type": "assigned_variable", "loc": [37, 37], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L36_C8", "vector": [14, 3, 0.4157, 0.0112, 3, 0.02, 0.0, 157, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj, lookup_type, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj, lookup_type, value = data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L38_C12", "label": "if", "type": "if", "loc": [38, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L36_C8", "vector": [4, 3, 0.4382, 0.0337, 3, 0.02, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ( isinstance(obj, Constraint) and\n isinstance(obj.field, GeometryField) ):\n data = (GeoConstraint(obj), lookup_type, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L40_C16", "label": "data =", "type": "assigned_variable", "loc": [40, 40], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L38_C12", "vector": [14, 4, 0.4494, 0.0112, 4, 0.71, 0.0, 929, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = (GeoConstraint(obj), lookup_type, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Expr_L41_C8", "label": "add()", "type": "expression", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L35_C4", "vector": [8, 2, 0.4607, 0.0112, 2, 0.02, 1.0, 241, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " super(GeoWhereNode, self).add(data, connector)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L43_C4", "label": "make_atom", "type": "function", "loc": [43, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:ClassDef_L30_C0", "vector": [2, 1, 0.5225, 0.0899, 1, 0.85, 0.6667, 307, 0, 4, 1, 0, 0, 0, 5], "semantic": {"name": "make_atom", "arg_names": ["self", "child", "qn", "connection"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def make_atom(self, child, qn, connection):\n lvalue, lookup_type, value_annot, params_or_value = child\n if isinstance(lvalue, GeoConstraint):\n data, params = lvalue.process(lookup_type, params_or_value, connection)\n spatial_sql = connection.ops.spatial_lookup_sql(data, lookup_type, params_or_value, lvalue.field, qn)\n return spatial_sql, params\n else:\n return super(GeoWhereNode, self).make_atom(child, qn, connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L44_C8", "label": "lvalue, lookup_type, value_annot, params_or_value =", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L43_C4", "vector": [14, 2, 0.4944, 0.0112, 2, 0.83, 0.0, 58, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "lvalue, lookup_type, value_annot, params_or_value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lvalue, lookup_type, value_annot, params_or_value = child"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L45_C8", "label": "if", "type": "if", "loc": [45, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L43_C4", "vector": [4, 2, 0.5337, 0.0674, 2, 0.83, 1.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(lvalue, GeoConstraint):\n data, params = lvalue.process(lookup_type, params_or_value, connection)\n spatial_sql = connection.ops.spatial_lookup_sql(data, lookup_type, params_or_value, lvalue.field, qn)\n return spatial_sql, params\n else:\n return super(GeoWhereNode, self).make_atom(child, qn, connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L46_C12", "label": "data, params = process()", "type": "assigned_variable", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L45_C8", "vector": [14, 3, 0.5169, 0.0112, 3, 0.44, 0.0, 201, 3, 3, 0, 0, 712, 10, 1], "semantic": {"name": "data, params", "arg_names": [], "import_names": [], "rhs_call_name": "process", "annotation": ""}, "snippet": " data, params = lvalue.process(lookup_type, params_or_value, connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L47_C12", "label": "spatial_sql = spatial_lookup_sql()", "type": "assigned_variable", "loc": [47, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L45_C8", "vector": [14, 3, 0.5281, 0.0112, 3, 0.44, 0.3333, 784, 3, 5, 0, 0, 975, 10, 1], "semantic": {"name": "spatial_sql", "arg_names": [], "import_names": [], "rhs_call_name": "spatial_lookup_sql", "annotation": ""}, "snippet": " spatial_sql = connection.ops.spatial_lookup_sql(data, lookup_type, params_or_value, lvalue.field, qn)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Return_L48_C12", "label": "return", "type": "return", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L45_C8", "vector": [13, 3, 0.5393, 0.0112, 3, 0.44, 0.6667, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return spatial_sql, params"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Return_L50_C12", "label": "return", "type": "return", "loc": [50, 50], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L45_C8", "vector": [13, 3, 0.5618, 0.0112, 3, 0.44, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return super(GeoWhereNode, self).make_atom(child, qn, connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L53_C4", "label": "_check_geo_field", "type": "function", "loc": [53, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:ClassDef_L30_C0", "vector": [2, 1, 0.7978, 0.4157, 1, 0.85, 1.0, 165, 0, 3, 1, 0, 0, 0, 8], "semantic": {"name": "_check_geo_field", "arg_names": ["cls", "opts", "lookup"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _check_geo_field(cls, opts, lookup):\n \"\"\"\n Utility for checking the given lookup with the given model options.\n The lookup is a string either specifying the geographic field, e.g.\n 'point, 'the_geom', or a related lookup on a geographic field like\n 'address__point'.\n\n If a GeometryField exists according to the given lookup on the model"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Expr_L54_C8", "label": "expression", "type": "expression", "loc": [54, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L53_C4", "vector": [8, 2, 0.6517, 0.1011, 2, 0.35, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Utility for checking the given lookup with the given model options.\n The lookup is a string either specifying the geographic field, e.g.\n 'point, 'the_geom', or a related lookup on a geographic field like\n 'address__point'.\n\n If a GeometryField exists according to the given lookup on the model\n options, it will be returned. Otherwise returns None."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L65_C8", "label": "field_list = split()", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L53_C4", "vector": [14, 2, 0.7303, 0.0112, 2, 0.35, 0.2, 97, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "field_list", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " field_list = lookup.split(LOOKUP_SEP)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Expr_L69_C8", "label": "reverse()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L53_C4", "vector": [8, 2, 0.7753, 0.0112, 2, 0.35, 0.4, 109, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "reverse", "arg_names": [], "import_names": [], "rhs_call_name": "reverse", "annotation": ""}, "snippet": " field_list.reverse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L70_C8", "label": "fld_name = pop()", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L53_C4", "vector": [14, 2, 0.7865, 0.0112, 2, 0.35, 0.6, 402, 3, 0, 0, 0, 969, 10, 1], "semantic": {"name": "fld_name", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " fld_name = field_list.pop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Try_L72_C8", "label": "try", "type": "try", "loc": [72, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L53_C4", "vector": [7, 2, 0.8708, 0.1348, 2, 0.35, 0.8, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n geo_fld = opts.get_field(fld_name)\n # If the field list is still around, then it means that the\n # lookup was for a geometry field across a relationship --\n # thus we keep on getting the related model options and the\n # model field associated with the next field in the list\n # until there's no more left.\n while len(field_list):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L73_C12", "label": "geo_fld = get_field()", "type": "assigned_variable", "loc": [73, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:Try_L72_C8", "vector": [14, 3, 0.8202, 0.0112, 3, 0.25, 0.0, 290, 3, 1, 0, 0, 389, 10, 1], "semantic": {"name": "geo_fld", "arg_names": [], "import_names": [], "rhs_call_name": "get_field", "annotation": ""}, "snippet": " geo_fld = opts.get_field(fld_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:While_L79_C12", "label": "while", "type": "while", "loc": [79, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:Try_L72_C8", "vector": [5, 3, 0.8989, 0.0337, 3, 0.25, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while len(field_list):\n opts = geo_fld.rel.to._meta\n geo_fld = opts.get_field(field_list.pop())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L80_C16", "label": "opts =", "type": "assigned_variable", "loc": [80, 80], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:While_L79_C12", "vector": [14, 4, 0.8989, 0.0112, 4, 0.04, 0.0, 631, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "opts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " opts = geo_fld.rel.to._meta"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L81_C16", "label": "geo_fld = get_field()", "type": "assigned_variable", "loc": [81, 81], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:While_L79_C12", "vector": [14, 4, 0.9101, 0.0112, 4, 0.04, 1.0, 290, 3, 1, 0, 0, 389, 10, 2], "semantic": {"name": "geo_fld", "arg_names": [], "import_names": [], "rhs_call_name": "get_field", "annotation": ""}, "snippet": " geo_fld = opts.get_field(field_list.pop())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Return_L83_C12", "label": "return", "type": "return", "loc": [83, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:Try_L72_C8", "vector": [13, 3, 0.9326, 0.0112, 3, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L86_C8", "label": "if", "type": "if", "loc": [86, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L53_C4", "vector": [4, 2, 0.9831, 0.0449, 2, 0.35, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(geo_fld, GeometryField):\n return geo_fld\n else:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Return_L87_C12", "label": "return", "type": "return", "loc": [87, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L86_C8", "vector": [13, 3, 0.9775, 0.0112, 3, 0.85, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return geo_fld"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98757:Return_L89_C12", "label": "return", "type": "return", "loc": [89, 89], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L86_C8", "vector": [13, 3, 1.0, 0.0112, 3, 0.85, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98757:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L18_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L22_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L18_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L23_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L18_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L25_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Return_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L36_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L37_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L36_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L38_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L40_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Expr_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Return_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Return_L50_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Expr_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Expr_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Try_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:Try_L72_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L73_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:Try_L72_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:While_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:While_L79_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L80_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:While_L79_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Assign_L81_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:Try_L72_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Return_L83_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L86_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Return_L87_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:If_L86_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Return_L89_C12"}] |
from django.contrib.gis.db.models.sql.conversion import AreaField, DistanceField, GeomField
from django.contrib.gis.db.models.sql.query import GeoQuery
from django.contrib.gis.db.models.sql.where import GeoWhereNode
| ajibawa-2023/Python-Code-Large/train/row_98758 | 3 | 3 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98758:ImportFrom_L1_C0", "label": "from django.contrib.gis.db.models.sql.conversion import AreaField, DistanceField, GeomField", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.3333, 0, 0.66, 0.0, 100, 0, 3, 0, 0, 100, 0, 0], "semantic": {"name": "django.contrib.gis.db.models.sql.conversion", "arg_names": [], "import_names": ["AreaField", "DistanceField", "GeomField"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.models.sql.conversion import AreaField, DistanceField, GeomField"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98758:ImportFrom_L2_C0", "label": "from django.contrib.gis.db.models.sql.query import GeoQuery", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.6667, 0.3333, 0, 0.66, 0.5, 223, 0, 1, 0, 0, 223, 0, 0], "semantic": {"name": "django.contrib.gis.db.models.sql.query", "arg_names": [], "import_names": ["GeoQuery"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.models.sql.query import GeoQuery"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98758:ImportFrom_L3_C0", "label": "from django.contrib.gis.db.models.sql.where import GeoWhereNode", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 1.0, 0.3333, 0, 0.66, 1.0, 398, 0, 1, 0, 0, 398, 0, 0], "semantic": {"name": "django.contrib.gis.db.models.sql.where", "arg_names": [], "import_names": ["GeoWhereNode"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.models.sql.where import GeoWhereNode"}] | [] |
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):
name = 'Union'
| ajibawa-2023/Python-Code-Large/train/row_98759 | 12 | 17 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98759:ImportFrom_L1_C0", "label": "from django.db.models import Aggregate", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0588, 0, 0.66, 0.0, 680, 0, 1, 0, 0, 680, 0, 0], "semantic": {"name": "django.db.models", "arg_names": [], "import_names": ["Aggregate"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.models import Aggregate"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98759:ImportFrom_L2_C0", "label": "from django.contrib.gis.db.models.sql import GeomField", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1176, 0.0588, 0, 0.66, 0.1667, 437, 0, 1, 0, 0, 437, 0, 0], "semantic": {"name": "django.contrib.gis.db.models.sql", "arg_names": [], "import_names": ["GeomField"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.models.sql import GeomField"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98759:ClassDef_L4_C0", "label": "Collect", "type": "class", "loc": [4, 5], "level": 0, "parent": null, "vector": [3, 0, 0.2647, 0.1176, 0, 0.66, 0.3333, 31, 0, 0, 0, 0, 451, 0, 0], "semantic": {"name": "Collect", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Collect(Aggregate):\n name = 'Collect'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98759:Assign_L5_C4", "label": "name =", "type": "assigned_variable", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98759:ClassDef_L4_C0", "vector": [14, 1, 0.2941, 0.0588, 1, 0.0, 0.0, 57, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = 'Collect'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98759:ClassDef_L7_C0", "label": "Extent", "type": "class", "loc": [7, 8], "level": 0, "parent": null, "vector": [3, 0, 0.4412, 0.1176, 0, 0.66, 0.5, 350, 0, 0, 0, 0, 451, 0, 0], "semantic": {"name": "Extent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Extent(Aggregate):\n name = 'Extent'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98759:Assign_L8_C4", "label": "name =", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98759:ClassDef_L7_C0", "vector": [14, 1, 0.4706, 0.0588, 1, 0.9, 0.0, 57, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = 'Extent'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98759:ClassDef_L10_C0", "label": "Extent3D", "type": "class", "loc": [10, 11], "level": 0, "parent": null, "vector": [3, 0, 0.6176, 0.1176, 0, 0.66, 0.6667, 642, 0, 0, 0, 0, 451, 0, 0], "semantic": {"name": "Extent3D", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Extent3D(Aggregate):\n name = 'Extent3D'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98759:Assign_L11_C4", "label": "name =", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98759:ClassDef_L10_C0", "vector": [14, 1, 0.6471, 0.0588, 1, 0.71, 0.0, 57, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = 'Extent3D'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98759:ClassDef_L13_C0", "label": "MakeLine", "type": "class", "loc": [13, 14], "level": 0, "parent": null, "vector": [3, 0, 0.7941, 0.1176, 0, 0.66, 0.8333, 128, 0, 0, 0, 0, 451, 0, 0], "semantic": {"name": "MakeLine", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MakeLine(Aggregate):\n name = 'MakeLine'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98759:Assign_L14_C4", "label": "name =", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98759:ClassDef_L13_C0", "vector": [14, 1, 0.8235, 0.0588, 1, 0.17, 0.0, 57, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = 'MakeLine'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98759:ClassDef_L16_C0", "label": "Union", "type": "class", "loc": [16, 17], "level": 0, "parent": null, "vector": [3, 0, 0.9706, 0.1176, 0, 0.66, 1.0, 404, 0, 0, 0, 0, 451, 0, 0], "semantic": {"name": "Union", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Union(Aggregate):\n name = 'Union'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98759:Assign_L17_C4", "label": "name =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98759:ClassDef_L16_C0", "vector": [14, 1, 1.0, 0.0588, 1, 0.65, 0.0, 57, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = 'Union'"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98759:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98759:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98759:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98759:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98759:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98759:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98759:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98759:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98759:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98759:Assign_L17_C4"}] |
# 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.models.fields import \
GeometryField, PointField, LineStringField, PolygonField, \
MultiPointField, MultiLineStringField, MultiPolygonField, \
GeometryCollectionField
| ajibawa-2023/Python-Code-Large/train/row_98760 | 4 | 14 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98760:ImportFrom_L2_C0", "label": "from django.db.models import *", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0714, 0, 0.66, 0.0, 680, 0, 1, 0, 0, 680, 0, 0], "semantic": {"name": "django.db.models", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.models import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98760:ImportFrom_L5_C0", "label": "from django.contrib.gis.db.models.aggregates import *", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.3571, 0.0714, 0, 0.66, 0.3333, 920, 0, 1, 0, 0, 920, 0, 0], "semantic": {"name": "django.contrib.gis.db.models.aggregates", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.models.aggregates import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98760:ImportFrom_L8_C0", "label": "from django.contrib.gis.db.models.manager import GeoManager", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.5714, 0.0714, 0, 0.66, 0.6667, 399, 0, 1, 0, 0, 399, 0, 0], "semantic": {"name": "django.contrib.gis.db.models.manager", "arg_names": [], "import_names": ["GeoManager"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.models.manager import GeoManager"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98760:ImportFrom_L11_C0", "label": "from django.contrib.gis.db.models.fields import GeometryField, PointField, LineStringField\u2026", "type": "import", "loc": [11, 14], "level": 0, "parent": null, "vector": [1, 0, 0.8929, 0.2857, 0, 0.66, 1.0, 708, 0, 8, 0, 0, 708, 0, 0], "semantic": {"name": "django.contrib.gis.db.models.fields", "arg_names": [], "import_names": ["GeometryField", "PointField", "LineStringField", "PolygonField", "MultiPointField", "MultiLineStringField", "MultiPolygonField", "GeometryCollectionField"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.models.fields import \\\n GeometryField, PointField, LineStringField, PolygonField, \\\n MultiPointField, MultiLineStringField, MultiPolygonField, \\\n GeometryCollectionField"}] | [] |
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
# properly.
use_for_related_fields = True
def get_query_set(self):
return GeoQuerySet(self.model, using=self._db)
def area(self, *args, **kwargs):
return self.get_query_set().area(*args, **kwargs)
def centroid(self, *args, **kwargs):
return self.get_query_set().centroid(*args, **kwargs)
def collect(self, *args, **kwargs):
return self.get_query_set().collect(*args, **kwargs)
def difference(self, *args, **kwargs):
return self.get_query_set().difference(*args, **kwargs)
def distance(self, *args, **kwargs):
return self.get_query_set().distance(*args, **kwargs)
def envelope(self, *args, **kwargs):
return self.get_query_set().envelope(*args, **kwargs)
def extent(self, *args, **kwargs):
return self.get_query_set().extent(*args, **kwargs)
def extent3d(self, *args, **kwargs):
return self.get_query_set().extent3d(*args, **kwargs)
def force_rhr(self, *args, **kwargs):
return self.get_query_set().force_rhr(*args, **kwargs)
def geohash(self, *args, **kwargs):
return self.get_query_set().geohash(*args, **kwargs)
def geojson(self, *args, **kwargs):
return self.get_query_set().geojson(*args, **kwargs)
def gml(self, *args, **kwargs):
return self.get_query_set().gml(*args, **kwargs)
def intersection(self, *args, **kwargs):
return self.get_query_set().intersection(*args, **kwargs)
def kml(self, *args, **kwargs):
return self.get_query_set().kml(*args, **kwargs)
def length(self, *args, **kwargs):
return self.get_query_set().length(*args, **kwargs)
def make_line(self, *args, **kwargs):
return self.get_query_set().make_line(*args, **kwargs)
def mem_size(self, *args, **kwargs):
return self.get_query_set().mem_size(*args, **kwargs)
def num_geom(self, *args, **kwargs):
return self.get_query_set().num_geom(*args, **kwargs)
def num_points(self, *args, **kwargs):
return self.get_query_set().num_points(*args, **kwargs)
def perimeter(self, *args, **kwargs):
return self.get_query_set().perimeter(*args, **kwargs)
def point_on_surface(self, *args, **kwargs):
return self.get_query_set().point_on_surface(*args, **kwargs)
def reverse_geom(self, *args, **kwargs):
return self.get_query_set().reverse_geom(*args, **kwargs)
def scale(self, *args, **kwargs):
return self.get_query_set().scale(*args, **kwargs)
def snap_to_grid(self, *args, **kwargs):
return self.get_query_set().snap_to_grid(*args, **kwargs)
def svg(self, *args, **kwargs):
return self.get_query_set().svg(*args, **kwargs)
def sym_difference(self, *args, **kwargs):
return self.get_query_set().sym_difference(*args, **kwargs)
def transform(self, *args, **kwargs):
return self.get_query_set().transform(*args, **kwargs)
def translate(self, *args, **kwargs):
return self.get_query_set().translate(*args, **kwargs)
def union(self, *args, **kwargs):
return self.get_query_set().union(*args, **kwargs)
def unionagg(self, *args, **kwargs):
return self.get_query_set().unionagg(*args, **kwargs)
| ajibawa-2023/Python-Code-Large/train/row_98761 | 67 | 103 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98761:ImportFrom_L1_C0", "label": "from django.db.models.manager import Manager", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0097, 0.0097, 0, 0.66, 0.0, 59, 0, 1, 0, 0, 59, 0, 0], "semantic": {"name": "django.db.models.manager", "arg_names": [], "import_names": ["Manager"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.models.manager import Manager"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:ImportFrom_L2_C0", "label": "from django.contrib.gis.db.models.query import GeoQuerySet", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0194, 0.0097, 0, 0.66, 0.5, 817, 0, 1, 0, 0, 817, 0, 0], "semantic": {"name": "django.contrib.gis.db.models.query", "arg_names": [], "import_names": ["GeoQuerySet"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.models.query import GeoQuerySet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "label": "GeoManager", "type": "class", "loc": [4, 103], "level": 0, "parent": null, "vector": [3, 0, 0.5194, 0.9709, 0, 0.66, 1.0, 665, 0, 31, 0, 0, 412, 0, 61], "semantic": {"name": "GeoManager", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GeoManager(Manager):\n \"Overrides Manager to return Geographic QuerySets.\"\n\n # This manager should be used for queries on related fields\n # so that geometry columns on Oracle and MySQL are selected\n # properly.\n use_for_related_fields = True\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Expr_L5_C4", "label": "expression", "type": "expression", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [8, 1, 0.0485, 0.0097, 1, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Overrides Manager to return Geographic QuerySets.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Assign_L10_C4", "label": "use_for_related_fields =", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [14, 1, 0.0971, 0.0097, 1, 0.57, 0.0312, 84, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "use_for_related_fields", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " use_for_related_fields = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L12_C4", "label": "get_query_set", "type": "function", "loc": [12, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.1214, 0.0194, 1, 0.57, 0.0625, 696, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_query_set", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_query_set(self):\n return GeoQuerySet(self.model, using=self._db)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L13_C8", "label": "return", "type": "return", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L12_C4", "vector": [13, 2, 0.1262, 0.0097, 2, 0.85, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return GeoQuerySet(self.model, using=self._db)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L15_C4", "label": "area", "type": "function", "loc": [15, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.1505, 0.0194, 1, 0.57, 0.0938, 715, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "area", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def area(self, *args, **kwargs):\n return self.get_query_set().area(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L16_C8", "label": "return", "type": "return", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L15_C4", "vector": [13, 2, 0.1553, 0.0097, 2, 0.76, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().area(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L18_C4", "label": "centroid", "type": "function", "loc": [18, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.1796, 0.0194, 1, 0.57, 0.125, 439, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "centroid", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def centroid(self, *args, **kwargs):\n return self.get_query_set().centroid(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L19_C8", "label": "return", "type": "return", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L18_C4", "vector": [13, 2, 0.1845, 0.0097, 2, 0.04, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().centroid(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L21_C4", "label": "collect", "type": "function", "loc": [21, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.2087, 0.0194, 1, 0.57, 0.1562, 34, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "collect", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def collect(self, *args, **kwargs):\n return self.get_query_set().collect(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L22_C8", "label": "return", "type": "return", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L21_C4", "vector": [13, 2, 0.2136, 0.0097, 2, 0.96, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().collect(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L24_C4", "label": "difference", "type": "function", "loc": [24, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.2379, 0.0194, 1, 0.57, 0.1875, 498, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "difference", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def difference(self, *args, **kwargs):\n return self.get_query_set().difference(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L25_C8", "label": "return", "type": "return", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L24_C4", "vector": [13, 2, 0.2427, 0.0097, 2, 0.19, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().difference(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L27_C4", "label": "distance", "type": "function", "loc": [27, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.267, 0.0194, 1, 0.57, 0.2188, 145, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "distance", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def distance(self, *args, **kwargs):\n return self.get_query_set().distance(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L28_C8", "label": "return", "type": "return", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L27_C4", "vector": [13, 2, 0.2718, 0.0097, 2, 0.68, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().distance(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L30_C4", "label": "envelope", "type": "function", "loc": [30, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.2961, 0.0194, 1, 0.57, 0.25, 48, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "envelope", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def envelope(self, *args, **kwargs):\n return self.get_query_set().envelope(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L31_C8", "label": "return", "type": "return", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L30_C4", "vector": [13, 2, 0.301, 0.0097, 2, 0.82, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().envelope(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L33_C4", "label": "extent", "type": "function", "loc": [33, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.3252, 0.0194, 1, 0.57, 0.2812, 962, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "extent", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def extent(self, *args, **kwargs):\n return self.get_query_set().extent(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L34_C8", "label": "return", "type": "return", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L33_C4", "vector": [13, 2, 0.3301, 0.0097, 2, 0.05, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().extent(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L36_C4", "label": "extent3d", "type": "function", "loc": [36, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.3544, 0.0194, 1, 0.57, 0.3125, 187, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "extent3d", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def extent3d(self, *args, **kwargs):\n return self.get_query_set().extent3d(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L37_C8", "label": "return", "type": "return", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L36_C4", "vector": [13, 2, 0.3592, 0.0097, 2, 0.41, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().extent3d(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L39_C4", "label": "force_rhr", "type": "function", "loc": [39, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.3835, 0.0194, 1, 0.57, 0.3438, 927, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "force_rhr", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def force_rhr(self, *args, **kwargs):\n return self.get_query_set().force_rhr(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L40_C8", "label": "return", "type": "return", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L39_C4", "vector": [13, 2, 0.3883, 0.0097, 2, 0.01, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().force_rhr(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L42_C4", "label": "geohash", "type": "function", "loc": [42, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.4126, 0.0194, 1, 0.57, 0.375, 766, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "geohash", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geohash(self, *args, **kwargs):\n return self.get_query_set().geohash(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L43_C8", "label": "return", "type": "return", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L42_C4", "vector": [13, 2, 0.4175, 0.0097, 2, 0.67, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().geohash(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L45_C4", "label": "geojson", "type": "function", "loc": [45, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.4417, 0.0194, 1, 0.57, 0.4062, 89, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "geojson", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geojson(self, *args, **kwargs):\n return self.get_query_set().geojson(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L46_C8", "label": "return", "type": "return", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L45_C4", "vector": [13, 2, 0.4466, 0.0097, 2, 0.0, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().geojson(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L48_C4", "label": "gml", "type": "function", "loc": [48, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.4709, 0.0194, 1, 0.57, 0.4375, 410, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "gml", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def gml(self, *args, **kwargs):\n return self.get_query_set().gml(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L49_C8", "label": "return", "type": "return", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L48_C4", "vector": [13, 2, 0.4757, 0.0097, 2, 0.37, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().gml(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L51_C4", "label": "intersection", "type": "function", "loc": [51, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.5, 0.0194, 1, 0.57, 0.4688, 568, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "intersection", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def intersection(self, *args, **kwargs):\n return self.get_query_set().intersection(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L52_C8", "label": "return", "type": "return", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L51_C4", "vector": [13, 2, 0.5049, 0.0097, 2, 0.18, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().intersection(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L54_C4", "label": "kml", "type": "function", "loc": [54, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.5291, 0.0194, 1, 0.57, 0.5, 168, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "kml", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def kml(self, *args, **kwargs):\n return self.get_query_set().kml(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L55_C8", "label": "return", "type": "return", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L54_C4", "vector": [13, 2, 0.534, 0.0097, 2, 0.41, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().kml(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L57_C4", "label": "length", "type": "function", "loc": [57, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.5583, 0.0194, 1, 0.57, 0.5312, 221, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "length", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def length(self, *args, **kwargs):\n return self.get_query_set().length(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L58_C8", "label": "return", "type": "return", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L57_C4", "vector": [13, 2, 0.5631, 0.0097, 2, 0.65, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().length(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L60_C4", "label": "make_line", "type": "function", "loc": [60, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.5874, 0.0194, 1, 0.57, 0.5625, 702, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "make_line", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def make_line(self, *args, **kwargs):\n return self.get_query_set().make_line(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L61_C8", "label": "return", "type": "return", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L60_C4", "vector": [13, 2, 0.5922, 0.0097, 2, 0.03, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().make_line(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L63_C4", "label": "mem_size", "type": "function", "loc": [63, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.6165, 0.0194, 1, 0.57, 0.5938, 200, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "mem_size", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def mem_size(self, *args, **kwargs):\n return self.get_query_set().mem_size(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L64_C8", "label": "return", "type": "return", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L63_C4", "vector": [13, 2, 0.6214, 0.0097, 2, 0.33, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().mem_size(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L66_C4", "label": "num_geom", "type": "function", "loc": [66, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.6456, 0.0194, 1, 0.57, 0.625, 574, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "num_geom", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def num_geom(self, *args, **kwargs):\n return self.get_query_set().num_geom(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L67_C8", "label": "return", "type": "return", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L66_C4", "vector": [13, 2, 0.6505, 0.0097, 2, 0.98, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().num_geom(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L69_C4", "label": "num_points", "type": "function", "loc": [69, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.6748, 0.0194, 1, 0.57, 0.6562, 754, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "num_points", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def num_points(self, *args, **kwargs):\n return self.get_query_set().num_points(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L70_C8", "label": "return", "type": "return", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L69_C4", "vector": [13, 2, 0.6796, 0.0097, 2, 0.5, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().num_points(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L72_C4", "label": "perimeter", "type": "function", "loc": [72, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.7039, 0.0194, 1, 0.57, 0.6875, 896, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "perimeter", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def perimeter(self, *args, **kwargs):\n return self.get_query_set().perimeter(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L73_C8", "label": "return", "type": "return", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L72_C4", "vector": [13, 2, 0.7087, 0.0097, 2, 0.29, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().perimeter(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L75_C4", "label": "point_on_surface", "type": "function", "loc": [75, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.733, 0.0194, 1, 0.57, 0.7188, 858, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "point_on_surface", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def point_on_surface(self, *args, **kwargs):\n return self.get_query_set().point_on_surface(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L76_C8", "label": "return", "type": "return", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L75_C4", "vector": [13, 2, 0.7379, 0.0097, 2, 0.67, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().point_on_surface(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L78_C4", "label": "reverse_geom", "type": "function", "loc": [78, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.7621, 0.0194, 1, 0.57, 0.75, 638, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "reverse_geom", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def reverse_geom(self, *args, **kwargs):\n return self.get_query_set().reverse_geom(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L79_C8", "label": "return", "type": "return", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L78_C4", "vector": [13, 2, 0.767, 0.0097, 2, 0.48, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().reverse_geom(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L81_C4", "label": "scale", "type": "function", "loc": [81, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.7913, 0.0194, 1, 0.57, 0.7812, 18, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "scale", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def scale(self, *args, **kwargs):\n return self.get_query_set().scale(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L82_C8", "label": "return", "type": "return", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L81_C4", "vector": [13, 2, 0.7961, 0.0097, 2, 0.78, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().scale(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L84_C4", "label": "snap_to_grid", "type": "function", "loc": [84, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.8204, 0.0194, 1, 0.57, 0.8125, 324, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "snap_to_grid", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def snap_to_grid(self, *args, **kwargs):\n return self.get_query_set().snap_to_grid(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L85_C8", "label": "return", "type": "return", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L84_C4", "vector": [13, 2, 0.8252, 0.0097, 2, 0.28, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().snap_to_grid(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L87_C4", "label": "svg", "type": "function", "loc": [87, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.8495, 0.0194, 1, 0.57, 0.8438, 873, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "svg", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def svg(self, *args, **kwargs):\n return self.get_query_set().svg(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L88_C8", "label": "return", "type": "return", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L87_C4", "vector": [13, 2, 0.8544, 0.0097, 2, 0.1, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().svg(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L90_C4", "label": "sym_difference", "type": "function", "loc": [90, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.8786, 0.0194, 1, 0.57, 0.875, 37, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "sym_difference", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def sym_difference(self, *args, **kwargs):\n return self.get_query_set().sym_difference(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L91_C8", "label": "return", "type": "return", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L90_C4", "vector": [13, 2, 0.8835, 0.0097, 2, 0.49, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().sym_difference(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L93_C4", "label": "transform", "type": "function", "loc": [93, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.9078, 0.0194, 1, 0.57, 0.9062, 48, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "transform", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def transform(self, *args, **kwargs):\n return self.get_query_set().transform(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L94_C8", "label": "return", "type": "return", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L93_C4", "vector": [13, 2, 0.9126, 0.0097, 2, 0.91, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().transform(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L96_C4", "label": "translate", "type": "function", "loc": [96, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.9369, 0.0194, 1, 0.57, 0.9375, 384, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "translate", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def translate(self, *args, **kwargs):\n return self.get_query_set().translate(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L97_C8", "label": "return", "type": "return", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L96_C4", "vector": [13, 2, 0.9417, 0.0097, 2, 0.87, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().translate(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L99_C4", "label": "union", "type": "function", "loc": [99, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.966, 0.0194, 1, 0.57, 0.9688, 140, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "union", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def union(self, *args, **kwargs):\n return self.get_query_set().union(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L100_C8", "label": "return", "type": "return", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L99_C4", "vector": [13, 2, 0.9709, 0.0097, 2, 0.08, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().union(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L102_C4", "label": "unionagg", "type": "function", "loc": [102, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "vector": [2, 1, 0.9951, 0.0194, 1, 0.57, 1.0, 886, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "unionagg", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def unionagg(self, *args, **kwargs):\n return self.get_query_set().unionagg(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L103_C8", "label": "return", "type": "return", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L102_C4", "vector": [13, 2, 1.0, 0.0097, 2, 0.55, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_query_set().unionagg(*args, **kwargs)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L39_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L90_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:FunctionDef_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Return_L103_C8"}] |
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.
data_types_reverse = DatabaseIntrospection.data_types_reverse.copy()
data_types_reverse[FIELD_TYPE.GEOMETRY] = 'GeometryField'
def get_geometry_type(self, table_name, geo_col):
cursor = self.connection.cursor()
try:
# In order to get the specific geometry type of the field,
# we introspect on the table definition using `DESCRIBE`.
cursor.execute('DESCRIBE %s' %
self.connection.ops.quote_name(table_name))
# Increment over description info until we get to the geometry
# column.
for column, typ, null, key, default, extra in cursor.fetchall():
if column == geo_col:
# Using OGRGeomType to convert from OGC name to Django field.
# MySQL does not support 3D or SRIDs, so the field params
# are empty.
field_type = OGRGeomType(typ).django
field_params = {}
break
finally:
cursor.close()
return field_type, field_params
| ajibawa-2023/Python-Code-Large/train/row_98762 | 16 | 32 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98762:ImportFrom_L1_C0", "label": "from MySQLdb.constants import FIELD_TYPE", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0312, 0.0312, 0, 0.66, 0.0, 412, 0, 1, 0, 0, 412, 0, 0], "semantic": {"name": "MySQLdb.constants", "arg_names": [], "import_names": ["FIELD_TYPE"], "rhs_call_name": "", "annotation": ""}, "snippet": "from MySQLdb.constants import FIELD_TYPE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98762:ImportFrom_L3_C0", "label": "from django.contrib.gis.gdal import OGRGeomType", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0938, 0.0312, 0, 0.66, 0.3333, 793, 0, 1, 0, 0, 793, 0, 0], "semantic": {"name": "django.contrib.gis.gdal", "arg_names": [], "import_names": ["OGRGeomType"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal import OGRGeomType"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98762:ImportFrom_L4_C0", "label": "from django.db.backends.mysql.introspection import DatabaseIntrospection", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.0312, 0, 0.66, 0.6667, 292, 0, 1, 0, 0, 292, 0, 0], "semantic": {"name": "django.db.backends.mysql.introspection", "arg_names": [], "import_names": ["DatabaseIntrospection"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.backends.mysql.introspection import DatabaseIntrospection"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98762:ClassDef_L6_C0", "label": "MySQLIntrospection", "type": "class", "loc": [6, 32], "level": 0, "parent": null, "vector": [3, 0, 0.5938, 0.8438, 0, 0.66, 1.0, 63, 0, 1, 0, 0, 77, 0, 7], "semantic": {"name": "MySQLIntrospection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MySQLIntrospection(DatabaseIntrospection):\n # Updating the data_types_reverse dictionary with the appropriate\n # type for Geometry fields.\n data_types_reverse = DatabaseIntrospection.data_types_reverse.copy()\n data_types_reverse[FIELD_TYPE.GEOMETRY] = 'GeometryField'\n\n def get_geometry_type(self, table_name, geo_col):\n cursor = self.connection.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98762:Assign_L9_C4", "label": "data_types_reverse = copy()", "type": "assigned_variable", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98762:ClassDef_L6_C0", "vector": [14, 1, 0.2812, 0.0312, 1, 0.08, 0.0, 403, 3, 0, 0, 0, 739, 10, 1], "semantic": {"name": "data_types_reverse", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " data_types_reverse = DatabaseIntrospection.data_types_reverse.copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98762:Assign_L10_C4", "label": "assign", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98762:ClassDef_L6_C0", "vector": [14, 1, 0.3125, 0.0312, 1, 0.08, 0.5, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data_types_reverse[FIELD_TYPE.GEOMETRY] = 'GeometryField'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98762:FunctionDef_L12_C4", "label": "get_geometry_type", "type": "function", "loc": [12, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98762:ClassDef_L6_C0", "vector": [2, 1, 0.6875, 0.6562, 1, 0.08, 1.0, 844, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "get_geometry_type", "arg_names": ["self", "table_name", "geo_col"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_geometry_type(self, table_name, geo_col):\n cursor = self.connection.cursor()\n try:\n # In order to get the specific geometry type of the field,\n # we introspect on the table definition using `DESCRIBE`.\n cursor.execute('DESCRIBE %s' %\n self.connection.ops.quote_name(table_name))\n # Increment over description info until we get to the geometry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98762:Assign_L13_C8", "label": "cursor = cursor()", "type": "assigned_variable", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98762:FunctionDef_L12_C4", "vector": [14, 2, 0.4062, 0.0312, 2, 0.76, 0.0, 231, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cursor", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cursor = self.connection.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98762:Try_L14_C8", "label": "try", "type": "try", "loc": [14, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98762:FunctionDef_L12_C4", "vector": [7, 2, 0.6875, 0.5312, 2, 0.76, 0.5, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # In order to get the specific geometry type of the field,\n # we introspect on the table definition using `DESCRIBE`.\n cursor.execute('DESCRIBE %s' %\n self.connection.ops.quote_name(table_name))\n # Increment over description info until we get to the geometry\n # column.\n for column, typ, null, key, default, extra in cursor.fetchall():"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98762:Expr_L17_C12", "label": "execute()", "type": "expression", "loc": [17, 18], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98762:Try_L14_C8", "vector": [8, 3, 0.5469, 0.0625, 3, 0.53, 0.0, 569, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cursor.execute('DESCRIBE %s' %\n self.connection.ops.quote_name(table_name))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98762:For_L21_C12", "label": "for column, typ, null, key, default, extra", "type": "for", "loc": [21, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98762:Try_L14_C8", "vector": [6, 3, 0.7656, 0.25, 3, 0.53, 0.5, 334, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "column, typ, null, key, default, extra", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for column, typ, null, key, default, extra in cursor.fetchall():\n if column == geo_col:\n # Using OGRGeomType to convert from OGC name to Django field.\n # MySQL does not support 3D or SRIDs, so the field params\n # are empty.\n field_type = OGRGeomType(typ).django\n field_params = {}\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98762:If_L22_C16", "label": "if", "type": "if", "loc": [22, 28], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98762:For_L21_C12", "vector": [4, 4, 0.7812, 0.2188, 4, 0.92, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if column == geo_col:\n # Using OGRGeomType to convert from OGC name to Django field.\n # MySQL does not support 3D or SRIDs, so the field params\n # are empty.\n field_type = OGRGeomType(typ).django\n field_params = {}\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98762:Assign_L26_C20", "label": "field_type =", "type": "assigned_variable", "loc": [26, 26], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98762:If_L22_C16", "vector": [14, 5, 0.8125, 0.0312, 5, 0.98, 0.0, 954, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "field_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " field_type = OGRGeomType(typ).django"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98762:Assign_L27_C20", "label": "field_params =", "type": "assigned_variable", "loc": [27, 27], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98762:If_L22_C16", "vector": [14, 5, 0.8438, 0.0312, 5, 0.98, 1.0, 388, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "field_params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " field_params = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98762:Expr_L30_C12", "label": "close()", "type": "expression", "loc": [30, 30], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98762:Try_L14_C8", "vector": [8, 3, 0.9375, 0.0312, 3, 0.53, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cursor.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98762:Return_L32_C8", "label": "return", "type": "return", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98762:FunctionDef_L12_C4", "vector": [13, 2, 1.0, 0.0312, 2, 0.76, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return field_type, field_params"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98762:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98762:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98762:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98762:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98762:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98762:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98762:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98762:Assign_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98762:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98762:Try_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98762:Try_L14_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98762:Expr_L17_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98762:Try_L14_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98762:For_L21_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98762:For_L21_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98762:If_L22_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98762:If_L22_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98762:Assign_L26_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98762:If_L22_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98762:Assign_L27_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98762:Try_L14_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98762:Expr_L30_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98762:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98762:Return_L32_C8"}] |
from django.db.backends.mysql.base import DatabaseOperations
from django.contrib.gis.db.backends.adapter import WKTAdapter
from django.contrib.gis.db.backends.base import BaseSpatialOperations
class MySQLOperations(DatabaseOperations, BaseSpatialOperations):
compiler_module = 'django.contrib.gis.db.models.sql.compiler'
mysql = True
name = 'mysql'
select = 'AsText(%s)'
from_wkb = 'GeomFromWKB'
from_text = 'GeomFromText'
Adapter = WKTAdapter
Adaptor = Adapter # Backwards-compatibility alias.
geometry_functions = {
'bbcontains' : 'MBRContains', # For consistency w/PostGIS API
'bboverlaps' : 'MBROverlaps', # .. ..
'contained' : 'MBRWithin', # .. ..
'contains' : 'MBRContains',
'disjoint' : 'MBRDisjoint',
'equals' : 'MBREqual',
'exact' : 'MBREqual',
'intersects' : 'MBRIntersects',
'overlaps' : 'MBROverlaps',
'same_as' : 'MBREqual',
'touches' : 'MBRTouches',
'within' : 'MBRWithin',
}
gis_terms = dict([(term, None) for term in geometry_functions.keys() + ['isnull']])
def geo_db_type(self, f):
return f.geom_type
def get_geom_placeholder(self, value, srid):
"""
The placeholder here has to include MySQL's WKT constructor. Because
MySQL does not support spatial transformations, there is no need to
modify the placeholder based on the contents of the given value.
"""
if hasattr(value, 'expression'):
placeholder = '%s.%s' % tuple(map(self.quote_name, value.cols[value.expression]))
else:
placeholder = '%s(%%s)' % self.from_text
return placeholder
def spatial_lookup_sql(self, lvalue, lookup_type, value, field, qn):
alias, col, db_type = lvalue
geo_col = '%s.%s' % (qn(alias), qn(col))
lookup_info = self.geometry_functions.get(lookup_type, False)
if lookup_info:
return "%s(%s, %s)" % (lookup_info, geo_col,
self.get_geom_placeholder(value, field.srid))
# TODO: Is this really necessary? MySQL can't handle NULL geometries
# in its spatial indexes anyways.
if lookup_type == 'isnull':
return "%s IS %sNULL" % (geo_col, (not value and 'NOT ' or ''))
raise TypeError("Got invalid lookup_type: %s" % repr(lookup_type))
| ajibawa-2023/Python-Code-Large/train/row_98763 | 30 | 65 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98763:ImportFrom_L1_C0", "label": "from django.db.backends.mysql.base import DatabaseOperations", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0154, 0.0154, 0, 0.66, 0.0, 150, 0, 1, 0, 0, 150, 0, 0], "semantic": {"name": "django.db.backends.mysql.base", "arg_names": [], "import_names": ["DatabaseOperations"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.backends.mysql.base import DatabaseOperations"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:ImportFrom_L3_C0", "label": "from django.contrib.gis.db.backends.adapter import WKTAdapter", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0462, 0.0154, 0, 0.66, 0.3333, 423, 0, 1, 0, 0, 423, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.adapter", "arg_names": [], "import_names": ["WKTAdapter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.backends.adapter import WKTAdapter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:ImportFrom_L4_C0", "label": "from django.contrib.gis.db.backends.base import BaseSpatialOperations", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0615, 0.0154, 0, 0.66, 0.6667, 157, 0, 1, 0, 0, 157, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.base", "arg_names": [], "import_names": ["BaseSpatialOperations"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.backends.base import BaseSpatialOperations"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "label": "MySQLOperations", "type": "class", "loc": [6, 65], "level": 0, "parent": null, "vector": [3, 0, 0.5462, 0.9231, 0, 0.66, 1.0, 986, 0, 3, 0, 0, 311, 0, 11], "semantic": {"name": "MySQLOperations", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MySQLOperations(DatabaseOperations, BaseSpatialOperations):\n\n compiler_module = 'django.contrib.gis.db.models.sql.compiler'\n mysql = True\n name = 'mysql'\n select = 'AsText(%s)'\n from_wkb = 'GeomFromWKB'\n from_text = 'GeomFromText'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L8_C4", "label": "compiler_module =", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "vector": [14, 1, 0.1231, 0.0154, 1, 0.26, 0.0, 902, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "compiler_module", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " compiler_module = 'django.contrib.gis.db.models.sql.compiler'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L9_C4", "label": "mysql =", "type": "assigned_variable", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "vector": [14, 1, 0.1385, 0.0154, 1, 0.26, 0.0833, 855, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "mysql", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mysql = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L10_C4", "label": "name =", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "vector": [14, 1, 0.1538, 0.0154, 1, 0.26, 0.1667, 57, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = 'mysql'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L11_C4", "label": "select =", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "vector": [14, 1, 0.1692, 0.0154, 1, 0.26, 0.25, 438, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "select", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " select = 'AsText(%s)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L12_C4", "label": "from_wkb =", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "vector": [14, 1, 0.1846, 0.0154, 1, 0.26, 0.3333, 581, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "from_wkb", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " from_wkb = 'GeomFromWKB'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L13_C4", "label": "from_text =", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "vector": [14, 1, 0.2, 0.0154, 1, 0.26, 0.4167, 694, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "from_text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " from_text = 'GeomFromText'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L15_C4", "label": "Adapter =", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "vector": [14, 1, 0.2308, 0.0154, 1, 0.26, 0.5, 6, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Adapter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " Adapter = WKTAdapter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L16_C4", "label": "Adaptor =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "vector": [14, 1, 0.2462, 0.0154, 1, 0.26, 0.5833, 764, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Adaptor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " Adaptor = Adapter # Backwards-compatibility alias."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L18_C4", "label": "geometry_functions =", "type": "assigned_variable", "loc": [18, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "vector": [14, 1, 0.3769, 0.2154, 1, 0.26, 0.6667, 884, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "geometry_functions", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geometry_functions = {\n 'bbcontains' : 'MBRContains', # For consistency w/PostGIS API\n 'bboverlaps' : 'MBROverlaps', # .. ..\n 'contained' : 'MBRWithin', # .. ..\n 'contains' : 'MBRContains',\n 'disjoint' : 'MBRDisjoint',\n 'equals' : 'MBREqual',\n 'exact' : 'MBREqual',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L33_C4", "label": "gis_terms = dict()", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "vector": [14, 1, 0.5077, 0.0154, 1, 0.26, 0.75, 983, 3, 1, 0, 0, 827, 10, 2], "semantic": {"name": "gis_terms", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " gis_terms = dict([(term, None) for term in geometry_functions.keys() + ['isnull']])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:FunctionDef_L35_C4", "label": "geo_db_type", "type": "function", "loc": [35, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "vector": [2, 1, 0.5462, 0.0308, 1, 0.26, 0.8333, 347, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "geo_db_type", "arg_names": ["self", "f"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geo_db_type(self, f):\n return f.geom_type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:Return_L36_C8", "label": "return", "type": "return", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:FunctionDef_L35_C4", "vector": [13, 2, 0.5538, 0.0154, 2, 0.77, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return f.geom_type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:FunctionDef_L38_C4", "label": "get_geom_placeholder", "type": "function", "loc": [38, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "vector": [2, 1, 0.6615, 0.1692, 1, 0.26, 0.9167, 983, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "get_geom_placeholder", "arg_names": ["self", "value", "srid"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_geom_placeholder(self, value, srid):\n \"\"\"\n The placeholder here has to include MySQL's WKT constructor. Because\n MySQL does not support spatial transformations, there is no need to\n modify the placeholder based on the contents of the given value.\n \"\"\"\n if hasattr(value, 'expression'):\n placeholder = '%s.%s' % tuple(map(self.quote_name, value.cols[value.expression]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:Expr_L39_C8", "label": "expression", "type": "expression", "loc": [39, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:FunctionDef_L38_C4", "vector": [8, 2, 0.6308, 0.0769, 2, 0.96, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n The placeholder here has to include MySQL's WKT constructor. Because\n MySQL does not support spatial transformations, there is no need to\n modify the placeholder based on the contents of the given value.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:If_L44_C8", "label": "if", "type": "if", "loc": [44, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:FunctionDef_L38_C4", "vector": [4, 2, 0.7, 0.0615, 2, 0.96, 0.5, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(value, 'expression'):\n placeholder = '%s.%s' % tuple(map(self.quote_name, value.cols[value.expression]))\n else:\n placeholder = '%s(%%s)' % self.from_text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L45_C12", "label": "placeholder =", "type": "assigned_variable", "loc": [45, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:If_L44_C8", "vector": [14, 3, 0.6923, 0.0154, 3, 0.48, 0.0, 847, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "placeholder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " placeholder = '%s.%s' % tuple(map(self.quote_name, value.cols[value.expression]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L47_C12", "label": "placeholder =", "type": "assigned_variable", "loc": [47, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:If_L44_C8", "vector": [14, 3, 0.7231, 0.0154, 3, 0.48, 1.0, 847, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "placeholder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " placeholder = '%s(%%s)' % self.from_text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:Return_L48_C8", "label": "return", "type": "return", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:FunctionDef_L38_C4", "vector": [13, 2, 0.7385, 0.0154, 2, 0.96, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return placeholder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:FunctionDef_L50_C4", "label": "spatial_lookup_sql", "type": "function", "loc": [50, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "vector": [2, 1, 0.8846, 0.2462, 1, 0.26, 1.0, 975, 0, 6, 1, 0, 0, 0, 6], "semantic": {"name": "spatial_lookup_sql", "arg_names": ["self", "lvalue", "lookup_type", "value", "field", "qn"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def spatial_lookup_sql(self, lvalue, lookup_type, value, field, qn):\n alias, col, db_type = lvalue\n\n geo_col = '%s.%s' % (qn(alias), qn(col))\n\n lookup_info = self.geometry_functions.get(lookup_type, False)\n if lookup_info:\n return \"%s(%s, %s)\" % (lookup_info, geo_col,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L51_C8", "label": "alias, col, db_type =", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:FunctionDef_L50_C4", "vector": [14, 2, 0.7846, 0.0154, 2, 0.8, 0.0, 237, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "alias, col, db_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " alias, col, db_type = lvalue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L53_C8", "label": "geo_col =", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:FunctionDef_L50_C4", "vector": [14, 2, 0.8154, 0.0154, 2, 0.8, 0.25, 139, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "geo_col", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geo_col = '%s.%s' % (qn(alias), qn(col))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L55_C8", "label": "lookup_info = get()", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:FunctionDef_L50_C4", "vector": [14, 2, 0.8462, 0.0154, 2, 0.8, 0.5, 472, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "lookup_info", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " lookup_info = self.geometry_functions.get(lookup_type, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:If_L56_C8", "label": "if", "type": "if", "loc": [56, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:FunctionDef_L50_C4", "vector": [4, 2, 0.8769, 0.0462, 2, 0.8, 0.75, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lookup_info:\n return \"%s(%s, %s)\" % (lookup_info, geo_col,\n self.get_geom_placeholder(value, field.srid))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:Return_L57_C12", "label": "return", "type": "return", "loc": [57, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:If_L56_C8", "vector": [13, 3, 0.8846, 0.0308, 3, 0.07, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"%s(%s, %s)\" % (lookup_info, geo_col,\n self.get_geom_placeholder(value, field.srid))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:If_L62_C8", "label": "if", "type": "if", "loc": [62, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:FunctionDef_L50_C4", "vector": [4, 2, 0.9615, 0.0308, 2, 0.8, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lookup_type == 'isnull':\n return \"%s IS %sNULL\" % (geo_col, (not value and 'NOT ' or ''))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98763:Return_L63_C12", "label": "return", "type": "return", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98763:If_L62_C8", "vector": [13, 3, 0.9692, 0.0154, 3, 0.28, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"%s IS %sNULL\" % (geo_col, (not value and 'NOT ' or ''))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:FunctionDef_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:Return_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:FunctionDef_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:Expr_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:If_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:If_L44_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L45_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:If_L44_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:Return_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:FunctionDef_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:If_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:Return_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:If_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:If_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:Return_L63_C12"}] |
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)
if isinstance(f, GeometryField) and f.spatial_index:
qn = self.connection.ops.quote_name
db_table = model._meta.db_table
idx_name = '%s_%s_id' % (db_table, f.column)
output.append(style.SQL_KEYWORD('CREATE SPATIAL INDEX ') +
style.SQL_TABLE(qn(idx_name)) +
style.SQL_KEYWORD(' ON ') +
style.SQL_TABLE(qn(db_table)) + '(' +
style.SQL_FIELD(qn(f.column)) + ');')
return output
| ajibawa-2023/Python-Code-Large/train/row_98764 | 11 | 18 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98764:ImportFrom_L1_C0", "label": "from django.db.backends.mysql.creation import DatabaseCreation", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0556, 0.0556, 0, 0.66, 0.0, 326, 0, 1, 0, 0, 326, 0, 0], "semantic": {"name": "django.db.backends.mysql.creation", "arg_names": [], "import_names": ["DatabaseCreation"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.backends.mysql.creation import DatabaseCreation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98764:ClassDef_L3_C0", "label": "MySQLCreation", "type": "class", "loc": [3, 18], "level": 0, "parent": null, "vector": [3, 0, 0.5833, 0.8889, 0, 0.66, 1.0, 391, 0, 1, 0, 0, 625, 0, 12], "semantic": {"name": "MySQLCreation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MySQLCreation(DatabaseCreation):\n\n def sql_indexes_for_field(self, model, f, style):\n from django.contrib.gis.db.models.fields import GeometryField\n output = super(MySQLCreation, self).sql_indexes_for_field(model, f, style)\n\n if isinstance(f, GeometryField) and f.spatial_index:\n qn = self.connection.ops.quote_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98764:FunctionDef_L5_C4", "label": "sql_indexes_for_field", "type": "function", "loc": [5, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98764:ClassDef_L3_C0", "vector": [2, 1, 0.6389, 0.7778, 1, 0.37, 0.0, 570, 0, 4, 1, 0, 0, 0, 12], "semantic": {"name": "sql_indexes_for_field", "arg_names": ["self", "model", "f", "style"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def sql_indexes_for_field(self, model, f, style):\n from django.contrib.gis.db.models.fields import GeometryField\n output = super(MySQLCreation, self).sql_indexes_for_field(model, f, style)\n\n if isinstance(f, GeometryField) and f.spatial_index:\n qn = self.connection.ops.quote_name\n db_table = model._meta.db_table\n idx_name = '%s_%s_id' % (db_table, f.column)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98764:ImportFrom_L6_C8", "label": "from django.contrib.gis.db.models.fields import GeometryField", "type": "import", "loc": [6, 6], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98764:FunctionDef_L5_C4", "vector": [1, 2, 0.3333, 0.0556, 2, 0.11, 0.0, 708, 0, 1, 0, 0, 708, 0, 0], "semantic": {"name": "django.contrib.gis.db.models.fields", "arg_names": [], "import_names": ["GeometryField"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.db.models.fields import GeometryField"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98764:Assign_L7_C8", "label": "output = sql_indexes_for_field()", "type": "assigned_variable", "loc": [7, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98764:FunctionDef_L5_C4", "vector": [14, 2, 0.3889, 0.0556, 2, 0.11, 0.3333, 886, 3, 3, 0, 0, 570, 10, 2], "semantic": {"name": "output", "arg_names": [], "import_names": [], "rhs_call_name": "sql_indexes_for_field", "annotation": ""}, "snippet": " output = super(MySQLCreation, self).sql_indexes_for_field(model, f, style)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98764:If_L9_C8", "label": "if", "type": "if", "loc": [9, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98764:FunctionDef_L5_C4", "vector": [4, 2, 0.7222, 0.5, 2, 0.11, 0.6667, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(f, GeometryField) and f.spatial_index:\n qn = self.connection.ops.quote_name\n db_table = model._meta.db_table\n idx_name = '%s_%s_id' % (db_table, f.column)\n output.append(style.SQL_KEYWORD('CREATE SPATIAL INDEX ') +\n style.SQL_TABLE(qn(idx_name)) +\n style.SQL_KEYWORD(' ON ') +\n style.SQL_TABLE(qn(db_table)) + '(' +"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98764:Assign_L10_C12", "label": "qn =", "type": "assigned_variable", "loc": [10, 10], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98764:If_L9_C8", "vector": [14, 3, 0.5556, 0.0556, 3, 0.07, 0.0, 514, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "qn", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " qn = self.connection.ops.quote_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98764:Assign_L11_C12", "label": "db_table =", "type": "assigned_variable", "loc": [11, 11], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98764:If_L9_C8", "vector": [14, 3, 0.6111, 0.0556, 3, 0.07, 0.3333, 111, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "db_table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " db_table = model._meta.db_table"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98764:Assign_L12_C12", "label": "idx_name =", "type": "assigned_variable", "loc": [12, 12], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98764:If_L9_C8", "vector": [14, 3, 0.6667, 0.0556, 3, 0.07, 0.6667, 128, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "idx_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " idx_name = '%s_%s_id' % (db_table, f.column)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98764:Expr_L13_C12", "label": "append()", "type": "expression", "loc": [13, 17], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98764:If_L9_C8", "vector": [8, 3, 0.8333, 0.2778, 3, 0.07, 1.0, 243, 3, 1, 0, 0, 0, 0, 9], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " output.append(style.SQL_KEYWORD('CREATE SPATIAL INDEX ') +\n style.SQL_TABLE(qn(idx_name)) +\n style.SQL_KEYWORD(' ON ') +\n style.SQL_TABLE(qn(db_table)) + '(' +\n style.SQL_FIELD(qn(f.column)) + ');')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98764:Return_L18_C8", "label": "return", "type": "return", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98764:FunctionDef_L5_C4", "vector": [13, 2, 1.0, 0.0556, 2, 0.11, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return output"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98764:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98764:FunctionDef_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98764:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98764:ImportFrom_L6_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98764:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98764:Assign_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98764:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98764:If_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98764:If_L9_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98764:Assign_L10_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98764:If_L9_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98764:Assign_L11_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98764:If_L9_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98764:Assign_L12_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98764:If_L9_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98764:Expr_L13_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98764:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98764:Return_L18_C8"}] |
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.mysql.operations import MySQLOperations
class DatabaseWrapper(MySQLDatabaseWrapper):
def __init__(self, *args, **kwargs):
super(DatabaseWrapper, self).__init__(*args, **kwargs)
self.creation = MySQLCreation(self)
self.ops = MySQLOperations()
self.introspection = MySQLIntrospection(self)
| ajibawa-2023/Python-Code-Large/train/row_98765 | 11 | 13 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98765:ImportFrom_L1_C0", "label": "from django.db.backends.mysql.base import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0769, 0, 0.66, 0.0, 150, 0, 1, 0, 0, 150, 0, 0], "semantic": {"name": "django.db.backends.mysql.base", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.backends.mysql.base import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98765:ImportFrom_L2_C0", "label": "from django.db.backends.mysql.base import MySQLDatabaseWrapper", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1538, 0.0769, 0, 0.66, 0.2, 150, 0, 1, 0, 0, 150, 0, 0], "semantic": {"name": "django.db.backends.mysql.base", "arg_names": [], "import_names": ["MySQLDatabaseWrapper"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.backends.mysql.base import DatabaseWrapper as MySQLDatabaseWrapper"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98765:ImportFrom_L3_C0", "label": "from django.contrib.gis.db.backends.mysql.creation import MySQLCreation", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.2308, 0.0769, 0, 0.66, 0.4, 314, 0, 1, 0, 0, 314, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.mysql.creation", "arg_names": [], "import_names": ["MySQLCreation"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.backends.mysql.creation import MySQLCreation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98765:ImportFrom_L4_C0", "label": "from django.contrib.gis.db.backends.mysql.introspection import MySQLIntrospection", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.3077, 0.0769, 0, 0.66, 0.6, 906, 0, 1, 0, 0, 906, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.mysql.introspection", "arg_names": [], "import_names": ["MySQLIntrospection"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.backends.mysql.introspection import MySQLIntrospection"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98765:ImportFrom_L5_C0", "label": "from django.contrib.gis.db.backends.mysql.operations import MySQLOperations", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.3846, 0.0769, 0, 0.66, 0.8, 200, 0, 1, 0, 0, 200, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.mysql.operations", "arg_names": [], "import_names": ["MySQLOperations"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.backends.mysql.operations import MySQLOperations"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98765:ClassDef_L7_C0", "label": "DatabaseWrapper", "type": "class", "loc": [7, 13], "level": 0, "parent": null, "vector": [3, 0, 0.7692, 0.5385, 0, 0.66, 1.0, 386, 0, 1, 0, 0, 162, 0, 5], "semantic": {"name": "DatabaseWrapper", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DatabaseWrapper(MySQLDatabaseWrapper):\n\n def __init__(self, *args, **kwargs):\n super(DatabaseWrapper, self).__init__(*args, **kwargs)\n self.creation = MySQLCreation(self)\n self.ops = MySQLOperations()\n self.introspection = MySQLIntrospection(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98765:FunctionDef_L9_C4", "label": "__init__", "type": "function", "loc": [9, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98765:ClassDef_L7_C0", "vector": [2, 1, 0.8462, 0.3846, 1, 0.57, 0.0, 555, 0, 3, 0, 0, 0, 0, 5], "semantic": {"name": "__init__", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, *args, **kwargs):\n super(DatabaseWrapper, self).__init__(*args, **kwargs)\n self.creation = MySQLCreation(self)\n self.ops = MySQLOperations()\n self.introspection = MySQLIntrospection(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98765:Expr_L10_C8", "label": "__init__()", "type": "expression", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98765:FunctionDef_L9_C4", "vector": [8, 2, 0.7692, 0.0769, 2, 0.35, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(DatabaseWrapper, self).__init__(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98765:Assign_L11_C8", "label": "self.creation = MySQLCreation()", "type": "assigned_variable", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98765:FunctionDef_L9_C4", "vector": [14, 2, 0.8462, 0.0769, 2, 0.35, 0.3333, 748, 3, 1, 0, 0, 391, 10, 1], "semantic": {"name": "self.creation", "arg_names": [], "import_names": [], "rhs_call_name": "MySQLCreation", "annotation": ""}, "snippet": " self.creation = MySQLCreation(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98765:Assign_L12_C8", "label": "self.ops = MySQLOperations()", "type": "assigned_variable", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98765:FunctionDef_L9_C4", "vector": [14, 2, 0.9231, 0.0769, 2, 0.35, 0.6667, 589, 3, 0, 0, 0, 986, 10, 1], "semantic": {"name": "self.ops", "arg_names": [], "import_names": [], "rhs_call_name": "MySQLOperations", "annotation": ""}, "snippet": " self.ops = MySQLOperations()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98765:Assign_L13_C8", "label": "self.introspection = MySQLIntrospection()", "type": "assigned_variable", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98765:FunctionDef_L9_C4", "vector": [14, 2, 1.0, 0.0769, 2, 0.35, 1.0, 217, 3, 1, 0, 0, 63, 10, 1], "semantic": {"name": "self.introspection", "arg_names": [], "import_names": [], "rhs_call_name": "MySQLIntrospection", "annotation": ""}, "snippet": " self.introspection = MySQLIntrospection(self)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98765:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98765:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98765:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98765:Expr_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98765:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98765:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98765:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98765:Assign_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98765:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98765:Assign_L13_C8"}] |
class WKTAdapter(object):
"""
This provides an adaptor for Geometries sent to the
MySQL and Oracle database backends.
"""
def __init__(self, geom):
self.wkt = geom.wkt
self.srid = geom.srid
def __eq__(self, other):
return self.wkt == other.wkt and self.srid == other.srid
def __str__(self):
return self.wkt
def prepare_database_save(self, unused):
return self
| ajibawa-2023/Python-Code-Large/train/row_98766 | 11 | 17 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98766:ClassDef_L1_C0", "label": "WKTAdapter", "type": "class", "loc": [1, 17], "level": 0, "parent": null, "vector": [3, 0, 0.5294, 1.0, 0, 0.66, 0.0, 868, 0, 4, 0, 0, 186, 0, 0], "semantic": {"name": "WKTAdapter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WKTAdapter(object):\n \"\"\"\n This provides an adaptor for Geometries sent to the\n MySQL and Oracle database backends.\n \"\"\"\n def __init__(self, geom):\n self.wkt = geom.wkt\n self.srid = geom.srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98766:Expr_L2_C4", "label": "expression", "type": "expression", "loc": [2, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98766:ClassDef_L1_C0", "vector": [8, 1, 0.2059, 0.2353, 1, 0.52, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n This provides an adaptor for Geometries sent to the\n MySQL and Oracle database backends.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98766:FunctionDef_L6_C4", "label": "__init__", "type": "function", "loc": [6, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98766:ClassDef_L1_C0", "vector": [2, 1, 0.4118, 0.1765, 1, 0.52, 0.25, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "geom"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, geom):\n self.wkt = geom.wkt\n self.srid = geom.srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98766:Assign_L7_C8", "label": "self.wkt =", "type": "assigned_variable", "loc": [7, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98766:FunctionDef_L6_C4", "vector": [14, 2, 0.4118, 0.0588, 2, 0.88, 0.0, 673, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.wkt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.wkt = geom.wkt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98766:Assign_L8_C8", "label": "self.srid =", "type": "assigned_variable", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98766:FunctionDef_L6_C4", "vector": [14, 2, 0.4706, 0.0588, 2, 0.88, 1.0, 289, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.srid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.srid = geom.srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98766:FunctionDef_L10_C4", "label": "__eq__", "type": "function", "loc": [10, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98766:ClassDef_L1_C0", "vector": [2, 1, 0.6176, 0.1176, 1, 0.52, 0.5, 763, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__eq__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __eq__(self, other):\n return self.wkt == other.wkt and self.srid == other.srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98766:Return_L11_C8", "label": "return", "type": "return", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98766:FunctionDef_L10_C4", "vector": [13, 2, 0.6471, 0.0588, 2, 0.83, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.wkt == other.wkt and self.srid == other.srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98766:FunctionDef_L13_C4", "label": "__str__", "type": "function", "loc": [13, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98766:ClassDef_L1_C0", "vector": [2, 1, 0.7941, 0.1176, 1, 0.52, 0.75, 527, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n return self.wkt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98766:Return_L14_C8", "label": "return", "type": "return", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98766:FunctionDef_L13_C4", "vector": [13, 2, 0.8235, 0.0588, 2, 0.47, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.wkt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98766:FunctionDef_L16_C4", "label": "prepare_database_save", "type": "function", "loc": [16, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98766:ClassDef_L1_C0", "vector": [2, 1, 0.9706, 0.1176, 1, 0.52, 1.0, 536, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "prepare_database_save", "arg_names": ["self", "unused"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def prepare_database_save(self, unused):\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98766:Return_L17_C8", "label": "return", "type": "return", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98766:FunctionDef_L16_C4", "vector": [13, 2, 1.0, 0.0588, 2, 0.15, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98766:ClassDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98766:Expr_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98766:ClassDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98766:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98766:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98766:Assign_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98766:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98766:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98766:ClassDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98766:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98766:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98766:Return_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98766:ClassDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98766:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98766:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98766:Return_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98766:ClassDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98766:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98766:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98766:Return_L17_C8"}] |
from django.contrib.gis.gdal import OGRGeomType
from django.db.backends.sqlite3.introspection import DatabaseIntrospection, FlexibleFieldLookupDict
class GeoFlexibleFieldLookupDict(FlexibleFieldLookupDict):
"""
Sublcass that includes updates the `base_data_types_reverse` dict
for geometry field types.
"""
base_data_types_reverse = FlexibleFieldLookupDict.base_data_types_reverse.copy()
base_data_types_reverse.update(
{'point' : 'GeometryField',
'linestring' : 'GeometryField',
'polygon' : 'GeometryField',
'multipoint' : 'GeometryField',
'multilinestring' : 'GeometryField',
'multipolygon' : 'GeometryField',
'geometrycollection' : 'GeometryField',
})
class SpatiaLiteIntrospection(DatabaseIntrospection):
data_types_reverse = GeoFlexibleFieldLookupDict()
def get_geometry_type(self, table_name, geo_col):
cursor = self.connection.cursor()
try:
# Querying the `geometry_columns` table to get additional metadata.
cursor.execute('SELECT "coord_dimension", "srid", "type" '
'FROM "geometry_columns" '
'WHERE "f_table_name"=%s AND "f_geometry_column"=%s',
(table_name, geo_col))
row = cursor.fetchone()
if not row:
raise Exception('Could not find a geometry column for "%s"."%s"' %
(table_name, geo_col))
# OGRGeomType does not require GDAL and makes it easy to convert
# from OGC geom type name to Django field.
field_type = OGRGeomType(row[2]).django
# Getting any GeometryField keyword arguments that are not the default.
dim = row[0]
srid = row[1]
field_params = {}
if srid != 4326:
field_params['srid'] = srid
if isinstance(dim, basestring) and 'Z' in dim:
field_params['dim'] = 3
finally:
cursor.close()
return field_type, field_params
| ajibawa-2023/Python-Code-Large/train/row_98767 | 24 | 51 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98767:ImportFrom_L1_C0", "label": "from django.contrib.gis.gdal import OGRGeomType", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0196, 0.0196, 0, 0.66, 0.0, 793, 0, 1, 0, 0, 793, 0, 0], "semantic": {"name": "django.contrib.gis.gdal", "arg_names": [], "import_names": ["OGRGeomType"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal import OGRGeomType"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98767:ImportFrom_L2_C0", "label": "from django.db.backends.sqlite3.introspection import DatabaseIntrospection, FlexibleFieldLookupDict", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0392, 0.0196, 0, 0.66, 0.3333, 774, 0, 2, 0, 0, 774, 0, 0], "semantic": {"name": "django.db.backends.sqlite3.introspection", "arg_names": [], "import_names": ["DatabaseIntrospection", "FlexibleFieldLookupDict"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.backends.sqlite3.introspection import DatabaseIntrospection, FlexibleFieldLookupDict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98767:ClassDef_L4_C0", "label": "GeoFlexibleFieldLookupDict", "type": "class", "loc": [4, 18], "level": 0, "parent": null, "vector": [3, 0, 0.2157, 0.2941, 0, 0.66, 0.6667, 483, 0, 0, 0, 0, 319, 0, 2], "semantic": {"name": "GeoFlexibleFieldLookupDict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GeoFlexibleFieldLookupDict(FlexibleFieldLookupDict):\n \"\"\"\n Sublcass that includes updates the `base_data_types_reverse` dict\n for geometry field types.\n \"\"\"\n base_data_types_reverse = FlexibleFieldLookupDict.base_data_types_reverse.copy()\n base_data_types_reverse.update(\n {'point' : 'GeometryField',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98767:Expr_L5_C4", "label": "expression", "type": "expression", "loc": [5, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98767:ClassDef_L4_C0", "vector": [8, 1, 0.1275, 0.0784, 1, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Sublcass that includes updates the `base_data_types_reverse` dict\n for geometry field types.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98767:Assign_L9_C4", "label": "base_data_types_reverse = copy()", "type": "assigned_variable", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98767:ClassDef_L4_C0", "vector": [14, 1, 0.1765, 0.0196, 1, 0.76, 0.5, 509, 3, 0, 0, 0, 739, 10, 1], "semantic": {"name": "base_data_types_reverse", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " base_data_types_reverse = FlexibleFieldLookupDict.base_data_types_reverse.copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98767:Expr_L10_C4", "label": "update()", "type": "expression", "loc": [10, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98767:ClassDef_L4_C0", "vector": [8, 1, 0.2745, 0.1765, 1, 0.76, 1.0, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " base_data_types_reverse.update(\n {'point' : 'GeometryField',\n 'linestring' : 'GeometryField',\n 'polygon' : 'GeometryField',\n 'multipoint' : 'GeometryField',\n 'multilinestring' : 'GeometryField',\n 'multipolygon' : 'GeometryField',\n 'geometrycollection' : 'GeometryField',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98767:ClassDef_L20_C0", "label": "SpatiaLiteIntrospection", "type": "class", "loc": [20, 51], "level": 0, "parent": null, "vector": [3, 0, 0.6961, 0.6275, 0, 0.66, 1.0, 120, 0, 1, 0, 0, 77, 0, 8], "semantic": {"name": "SpatiaLiteIntrospection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SpatiaLiteIntrospection(DatabaseIntrospection):\n data_types_reverse = GeoFlexibleFieldLookupDict()\n\n def get_geometry_type(self, table_name, geo_col):\n cursor = self.connection.cursor()\n try:\n # Querying the `geometry_columns` table to get additional metadata.\n cursor.execute('SELECT \"coord_dimension\", \"srid\", \"type\" '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98767:Assign_L21_C4", "label": "data_types_reverse = GeoFlexibleFieldLookupDict()", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98767:ClassDef_L20_C0", "vector": [14, 1, 0.4118, 0.0196, 1, 0.86, 0.0, 403, 3, 0, 0, 0, 483, 10, 1], "semantic": {"name": "data_types_reverse", "arg_names": [], "import_names": [], "rhs_call_name": "GeoFlexibleFieldLookupDict", "annotation": ""}, "snippet": " data_types_reverse = GeoFlexibleFieldLookupDict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98767:FunctionDef_L23_C4", "label": "get_geometry_type", "type": "function", "loc": [23, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98767:ClassDef_L20_C0", "vector": [2, 1, 0.7255, 0.5686, 1, 0.86, 1.0, 844, 0, 3, 1, 0, 0, 0, 7], "semantic": {"name": "get_geometry_type", "arg_names": ["self", "table_name", "geo_col"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_geometry_type(self, table_name, geo_col):\n cursor = self.connection.cursor()\n try:\n # Querying the `geometry_columns` table to get additional metadata.\n cursor.execute('SELECT \"coord_dimension\", \"srid\", \"type\" '\n 'FROM \"geometry_columns\" '\n 'WHERE \"f_table_name\"=%s AND \"f_geometry_column\"=%s',\n (table_name, geo_col))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98767:Assign_L24_C8", "label": "cursor = cursor()", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98767:FunctionDef_L23_C4", "vector": [14, 2, 0.4706, 0.0196, 2, 0.42, 0.0, 231, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cursor", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cursor = self.connection.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98767:Try_L25_C8", "label": "try", "type": "try", "loc": [25, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98767:FunctionDef_L23_C4", "vector": [7, 2, 0.7255, 0.4902, 2, 0.42, 0.5, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # Querying the `geometry_columns` table to get additional metadata.\n cursor.execute('SELECT \"coord_dimension\", \"srid\", \"type\" '\n 'FROM \"geometry_columns\" '\n 'WHERE \"f_table_name\"=%s AND \"f_geometry_column\"=%s',\n (table_name, geo_col))\n row = cursor.fetchone()\n if not row:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98767:Expr_L27_C12", "label": "execute()", "type": "expression", "loc": [27, 30], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98767:Try_L25_C8", "vector": [8, 3, 0.5588, 0.0784, 3, 0.89, 0.0, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cursor.execute('SELECT \"coord_dimension\", \"srid\", \"type\" '\n 'FROM \"geometry_columns\" '\n 'WHERE \"f_table_name\"=%s AND \"f_geometry_column\"=%s',\n (table_name, geo_col))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98767:Assign_L31_C12", "label": "row = fetchone()", "type": "assigned_variable", "loc": [31, 31], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98767:Try_L25_C8", "vector": [14, 3, 0.6078, 0.0196, 3, 0.89, 0.1111, 767, 3, 0, 0, 0, 561, 10, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "fetchone", "annotation": ""}, "snippet": " row = cursor.fetchone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98767:If_L32_C12", "label": "if", "type": "if", "loc": [32, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98767:Try_L25_C8", "vector": [4, 3, 0.6471, 0.0588, 3, 0.89, 0.2222, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not row:\n raise Exception('Could not find a geometry column for \"%s\".\"%s\"' %\n (table_name, geo_col))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98767:Assign_L38_C12", "label": "field_type =", "type": "assigned_variable", "loc": [38, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98767:Try_L25_C8", "vector": [14, 3, 0.7451, 0.0196, 3, 0.89, 0.3333, 954, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "field_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " field_type = OGRGeomType(row[2]).django"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98767:Assign_L41_C12", "label": "dim =", "type": "assigned_variable", "loc": [41, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98767:Try_L25_C8", "vector": [14, 3, 0.8039, 0.0196, 3, 0.89, 0.4444, 596, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dim", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dim = row[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98767:Assign_L42_C12", "label": "srid =", "type": "assigned_variable", "loc": [42, 42], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98767:Try_L25_C8", "vector": [14, 3, 0.8235, 0.0196, 3, 0.89, 0.5556, 357, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "srid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " srid = row[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98767:Assign_L43_C12", "label": "field_params =", "type": "assigned_variable", "loc": [43, 43], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98767:Try_L25_C8", "vector": [14, 3, 0.8431, 0.0196, 3, 0.89, 0.6667, 388, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "field_params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " field_params = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98767:If_L44_C12", "label": "if", "type": "if", "loc": [44, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98767:Try_L25_C8", "vector": [4, 3, 0.8725, 0.0392, 3, 0.89, 0.7778, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if srid != 4326:\n field_params['srid'] = srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98767:Assign_L45_C16", "label": "assign", "type": "assigned_variable", "loc": [45, 45], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98767:If_L44_C12", "vector": [14, 4, 0.8824, 0.0196, 4, 0.87, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " field_params['srid'] = srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98767:If_L46_C12", "label": "if", "type": "if", "loc": [46, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98767:Try_L25_C8", "vector": [4, 3, 0.9118, 0.0392, 3, 0.89, 0.8889, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(dim, basestring) and 'Z' in dim:\n field_params['dim'] = 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98767:Assign_L47_C16", "label": "assign", "type": "assigned_variable", "loc": [47, 47], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98767:If_L46_C12", "vector": [14, 4, 0.9216, 0.0196, 4, 0.81, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " field_params['dim'] = 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98767:Expr_L49_C12", "label": "close()", "type": "expression", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98767:Try_L25_C8", "vector": [8, 3, 0.9608, 0.0196, 3, 0.89, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cursor.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98767:Return_L51_C8", "label": "return", "type": "return", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98767:FunctionDef_L23_C4", "vector": [13, 2, 1.0, 0.0196, 2, 0.42, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return field_type, field_params"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98767:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98767:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98767:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98767:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98767:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98767:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98767:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98767:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98767:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98767:FunctionDef_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98767:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98767:Assign_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98767:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98767:Try_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98767:Try_L25_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98767:Expr_L27_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98767:Try_L25_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98767:Assign_L31_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98767:Try_L25_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98767:If_L32_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98767:Try_L25_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98767:Assign_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98767:Try_L25_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98767:Assign_L41_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98767:Try_L25_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98767:Assign_L42_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98767:Try_L25_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98767:Assign_L43_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98767:Try_L25_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98767:If_L44_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98767:If_L44_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98767:Assign_L45_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98767:Try_L25_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98767:If_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98767:If_L46_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98767:Assign_L47_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98767:Try_L25_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98767:Expr_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98767:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98767:Return_L51_C8"}] |
from django.db.backends.sqlite3.base import Database
from django.contrib.gis.db.backends.adapter import WKTAdapter
class SpatiaLiteAdapter(WKTAdapter):
"SQLite adaptor for geometry objects."
def __conform__(self, protocol):
if protocol is Database.PrepareProtocol:
return str(self)
| ajibawa-2023/Python-Code-Large/train/row_98768 | 7 | 8 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98768:ImportFrom_L1_C0", "label": "from django.db.backends.sqlite3.base import Database", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.125, 0, 0.66, 0.0, 460, 0, 1, 0, 0, 460, 0, 0], "semantic": {"name": "django.db.backends.sqlite3.base", "arg_names": [], "import_names": ["Database"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.backends.sqlite3.base import Database"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98768:ImportFrom_L2_C0", "label": "from django.contrib.gis.db.backends.adapter import WKTAdapter", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.25, 0.125, 0, 0.66, 0.5, 423, 0, 1, 0, 0, 423, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.adapter", "arg_names": [], "import_names": ["WKTAdapter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.backends.adapter import WKTAdapter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98768:ClassDef_L4_C0", "label": "SpatiaLiteAdapter", "type": "class", "loc": [4, 8], "level": 0, "parent": null, "vector": [3, 0, 0.75, 0.625, 0, 0.66, 1.0, 983, 0, 1, 0, 0, 868, 0, 1], "semantic": {"name": "SpatiaLiteAdapter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SpatiaLiteAdapter(WKTAdapter):\n \"SQLite adaptor for geometry objects.\"\n def __conform__(self, protocol):\n if protocol is Database.PrepareProtocol:\n return str(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98768:Expr_L5_C4", "label": "expression", "type": "expression", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98768:ClassDef_L4_C0", "vector": [8, 1, 0.625, 0.125, 1, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"SQLite adaptor for geometry objects.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98768:FunctionDef_L6_C4", "label": "__conform__", "type": "function", "loc": [6, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98768:ClassDef_L4_C0", "vector": [2, 1, 0.875, 0.375, 1, 0.94, 1.0, 753, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__conform__", "arg_names": ["self", "protocol"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __conform__(self, protocol):\n if protocol is Database.PrepareProtocol:\n return str(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98768:If_L7_C8", "label": "if", "type": "if", "loc": [7, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98768:FunctionDef_L6_C4", "vector": [4, 2, 0.9375, 0.25, 2, 0.56, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if protocol is Database.PrepareProtocol:\n return str(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98768:Return_L8_C12", "label": "return", "type": "return", "loc": [8, 8], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98768:If_L7_C8", "vector": [13, 3, 1.0, 0.125, 3, 0.42, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str(self)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98768:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98768:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98768:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98768:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98768:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98768:If_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98768:If_L7_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98768:Return_L8_C12"}] |
from django.db.backends.sqlite3.client import DatabaseClient
class SpatiaLiteClient(DatabaseClient):
executable_name = 'spatialite'
| ajibawa-2023/Python-Code-Large/train/row_98769 | 3 | 5 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98769:ImportFrom_L1_C0", "label": "from django.db.backends.sqlite3.client import DatabaseClient", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.2, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "django.db.backends.sqlite3.client", "arg_names": [], "import_names": ["DatabaseClient"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.backends.sqlite3.client import DatabaseClient"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98769:ClassDef_L3_C0", "label": "SpatiaLiteClient", "type": "class", "loc": [3, 4], "level": 0, "parent": null, "vector": [3, 0, 0.7, 0.4, 0, 0.66, 1.0, 345, 0, 0, 0, 0, 207, 0, 0], "semantic": {"name": "SpatiaLiteClient", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SpatiaLiteClient(DatabaseClient):\n executable_name = 'spatialite'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98769:Assign_L4_C4", "label": "executable_name =", "type": "assigned_variable", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98769:ClassDef_L3_C0", "vector": [14, 1, 0.8, 0.2, 1, 0.63, 0.0, 723, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "executable_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " executable_name = 'spatialite'"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98769:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98769:Assign_L4_C4"}] |
"""
The GeometryColumns and SpatialRefSys models for the SpatiaLite backend.
"""
from django.db import models
from django.contrib.gis.db.backends.base import SpatialRefSysMixin
class GeometryColumns(models.Model):
"""
The 'geometry_columns' table from SpatiaLite.
"""
f_table_name = models.CharField(max_length=256)
f_geometry_column = models.CharField(max_length=256)
type = models.CharField(max_length=30)
coord_dimension = models.IntegerField()
srid = models.IntegerField(primary_key=True)
spatial_index_enabled = models.IntegerField()
class Meta:
db_table = 'geometry_columns'
managed = False
@classmethod
def table_name_col(cls):
"""
Returns the name of the metadata column used to store the
the feature table name.
"""
return 'f_table_name'
@classmethod
def geom_col_name(cls):
"""
Returns the name of the metadata column used to store the
the feature geometry column.
"""
return 'f_geometry_column'
def __unicode__(self):
return "%s.%s - %dD %s field (SRID: %d)" % \
(self.f_table_name, self.f_geometry_column,
self.coord_dimension, self.type, self.srid)
class SpatialRefSys(models.Model, SpatialRefSysMixin):
"""
The 'spatial_ref_sys' table from SpatiaLite.
"""
srid = models.IntegerField(primary_key=True)
auth_name = models.CharField(max_length=256)
auth_srid = models.IntegerField()
ref_sys_name = models.CharField(max_length=256)
proj4text = models.CharField(max_length=2048)
@property
def wkt(self):
from django.contrib.gis.gdal import SpatialReference
return SpatialReference(self.proj4text).wkt
class Meta:
db_table = 'spatial_ref_sys'
managed = False
| ajibawa-2023/Python-Code-Large/train/row_98770 | 35 | 60 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98770:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0333, 0.05, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n The GeometryColumns and SpatialRefSys models for the SpatiaLite backend.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:ImportFrom_L4_C0", "label": "from django.db import models", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0667, 0.0167, 0, 0.66, 0.25, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["models"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db import models"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:ImportFrom_L5_C0", "label": "from django.contrib.gis.db.backends.base import SpatialRefSysMixin", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0167, 0, 0.66, 0.5, 157, 0, 1, 0, 0, 157, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.base", "arg_names": [], "import_names": ["SpatialRefSysMixin"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.backends.base import SpatialRefSysMixin"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L7_C0", "label": "GeometryColumns", "type": "class", "loc": [7, 41], "level": 0, "parent": null, "vector": [3, 0, 0.4, 0.5833, 0, 0.66, 0.75, 250, 0, 3, 0, 0, 996, 0, 6], "semantic": {"name": "GeometryColumns", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GeometryColumns(models.Model):\n \"\"\"\n The 'geometry_columns' table from SpatiaLite.\n \"\"\"\n f_table_name = models.CharField(max_length=256)\n f_geometry_column = models.CharField(max_length=256)\n type = models.CharField(max_length=30)\n coord_dimension = models.IntegerField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:Expr_L8_C4", "label": "expression", "type": "expression", "loc": [8, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L7_C0", "vector": [8, 1, 0.15, 0.05, 1, 0.2, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n The 'geometry_columns' table from SpatiaLite.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L11_C4", "label": "f_table_name = CharField()", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L7_C0", "vector": [14, 1, 0.1833, 0.0167, 1, 0.2, 0.1, 900, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "f_table_name", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " f_table_name = models.CharField(max_length=256)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L12_C4", "label": "f_geometry_column = CharField()", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L7_C0", "vector": [14, 1, 0.2, 0.0167, 1, 0.2, 0.2, 893, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "f_geometry_column", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " f_geometry_column = models.CharField(max_length=256)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L13_C4", "label": "type = CharField()", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L7_C0", "vector": [14, 1, 0.2167, 0.0167, 1, 0.2, 0.3, 801, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " type = models.CharField(max_length=30)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L14_C4", "label": "coord_dimension = IntegerField()", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L7_C0", "vector": [14, 1, 0.2333, 0.0167, 1, 0.2, 0.4, 2, 3, 0, 0, 0, 877, 10, 1], "semantic": {"name": "coord_dimension", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerField", "annotation": ""}, "snippet": " coord_dimension = models.IntegerField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L15_C4", "label": "srid = IntegerField()", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L7_C0", "vector": [14, 1, 0.25, 0.0167, 1, 0.2, 0.5, 357, 3, 1, 0, 0, 877, 10, 1], "semantic": {"name": "srid", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerField", "annotation": ""}, "snippet": " srid = models.IntegerField(primary_key=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L16_C4", "label": "spatial_index_enabled = IntegerField()", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L7_C0", "vector": [14, 1, 0.2667, 0.0167, 1, 0.2, 0.6, 62, 3, 0, 0, 0, 877, 10, 1], "semantic": {"name": "spatial_index_enabled", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerField", "annotation": ""}, "snippet": " spatial_index_enabled = models.IntegerField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L18_C4", "label": "Meta", "type": "class", "loc": [18, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L7_C0", "vector": [3, 1, 0.3167, 0.05, 1, 0.2, 0.7, 130, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta:\n db_table = 'geometry_columns'\n managed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L19_C8", "label": "db_table =", "type": "assigned_variable", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L18_C4", "vector": [14, 2, 0.3167, 0.0167, 2, 0.9, 0.0, 111, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "db_table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " db_table = 'geometry_columns'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L20_C8", "label": "managed =", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L18_C4", "vector": [14, 2, 0.3333, 0.0167, 2, 0.9, 1.0, 503, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "managed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " managed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:FunctionDef_L23_C4", "label": "table_name_col", "type": "function", "loc": [23, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L7_C0", "vector": [2, 1, 0.425, 0.1, 1, 0.2, 0.8, 702, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "table_name_col", "arg_names": ["cls"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def table_name_col(cls):\n \"\"\"\n Returns the name of the metadata column used to store the\n the feature table name.\n \"\"\"\n return 'f_table_name'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:Expr_L24_C8", "label": "expression", "type": "expression", "loc": [24, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:FunctionDef_L23_C4", "vector": [8, 2, 0.425, 0.0667, 2, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the name of the metadata column used to store the\n the feature table name.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:Return_L28_C8", "label": "return", "type": "return", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:FunctionDef_L23_C4", "vector": [13, 2, 0.4667, 0.0167, 2, 0.15, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'f_table_name'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:FunctionDef_L31_C4", "label": "geom_col_name", "type": "function", "loc": [31, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L7_C0", "vector": [2, 1, 0.5583, 0.1, 1, 0.2, 0.9, 835, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "geom_col_name", "arg_names": ["cls"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geom_col_name(cls):\n \"\"\"\n Returns the name of the metadata column used to store the\n the feature geometry column.\n \"\"\"\n return 'f_geometry_column'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:Expr_L32_C8", "label": "expression", "type": "expression", "loc": [32, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:FunctionDef_L31_C4", "vector": [8, 2, 0.5583, 0.0667, 2, 0.79, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the name of the metadata column used to store the\n the feature geometry column.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:Return_L36_C8", "label": "return", "type": "return", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:FunctionDef_L31_C4", "vector": [13, 2, 0.6, 0.0167, 2, 0.79, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'f_geometry_column'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:FunctionDef_L38_C4", "label": "__unicode__", "type": "function", "loc": [38, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L7_C0", "vector": [2, 1, 0.6583, 0.0667, 1, 0.2, 1.0, 318, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__unicode__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __unicode__(self):\n return \"%s.%s - %dD %s field (SRID: %d)\" % \\\n (self.f_table_name, self.f_geometry_column,\n self.coord_dimension, self.type, self.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:Return_L39_C8", "label": "return", "type": "return", "loc": [39, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:FunctionDef_L38_C4", "vector": [13, 2, 0.6667, 0.05, 2, 0.36, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"%s.%s - %dD %s field (SRID: %d)\" % \\\n (self.f_table_name, self.f_geometry_column,\n self.coord_dimension, self.type, self.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L43_C0", "label": "SpatialRefSys", "type": "class", "loc": [43, 60], "level": 0, "parent": null, "vector": [3, 0, 0.8583, 0.3, 0, 0.66, 1.0, 219, 0, 1, 0, 0, 996, 0, 6], "semantic": {"name": "SpatialRefSys", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SpatialRefSys(models.Model, SpatialRefSysMixin):\n \"\"\"\n The 'spatial_ref_sys' table from SpatiaLite.\n \"\"\"\n srid = models.IntegerField(primary_key=True)\n auth_name = models.CharField(max_length=256)\n auth_srid = models.IntegerField()\n ref_sys_name = models.CharField(max_length=256)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:Expr_L44_C4", "label": "expression", "type": "expression", "loc": [44, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L43_C0", "vector": [8, 1, 0.75, 0.05, 1, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n The 'spatial_ref_sys' table from SpatiaLite.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L47_C4", "label": "srid = IntegerField()", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L43_C0", "vector": [14, 1, 0.7833, 0.0167, 1, 0.05, 0.1429, 357, 3, 1, 0, 0, 877, 10, 1], "semantic": {"name": "srid", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerField", "annotation": ""}, "snippet": " srid = models.IntegerField(primary_key=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L48_C4", "label": "auth_name = CharField()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L43_C0", "vector": [14, 1, 0.8, 0.0167, 1, 0.05, 0.2857, 454, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "auth_name", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " auth_name = models.CharField(max_length=256)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L49_C4", "label": "auth_srid = IntegerField()", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L43_C0", "vector": [14, 1, 0.8167, 0.0167, 1, 0.05, 0.4286, 568, 3, 0, 0, 0, 877, 10, 1], "semantic": {"name": "auth_srid", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerField", "annotation": ""}, "snippet": " auth_srid = models.IntegerField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L50_C4", "label": "ref_sys_name = CharField()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L43_C0", "vector": [14, 1, 0.8333, 0.0167, 1, 0.05, 0.5714, 640, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "ref_sys_name", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " ref_sys_name = models.CharField(max_length=256)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L51_C4", "label": "proj4text = CharField()", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L43_C0", "vector": [14, 1, 0.85, 0.0167, 1, 0.05, 0.7143, 662, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "proj4text", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " proj4text = models.CharField(max_length=2048)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:FunctionDef_L54_C4", "label": "wkt", "type": "function", "loc": [54, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L43_C0", "vector": [2, 1, 0.9167, 0.05, 1, 0.05, 0.8571, 836, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "wkt", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wkt(self):\n from django.contrib.gis.gdal import SpatialReference\n return SpatialReference(self.proj4text).wkt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:ImportFrom_L55_C8", "label": "from django.contrib.gis.gdal import SpatialReference", "type": "import", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:FunctionDef_L54_C4", "vector": [1, 2, 0.9167, 0.0167, 2, 0.69, 0.0, 793, 0, 1, 0, 0, 793, 0, 0], "semantic": {"name": "django.contrib.gis.gdal", "arg_names": [], "import_names": ["SpatialReference"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.gdal import SpatialReference"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:Return_L56_C8", "label": "return", "type": "return", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:FunctionDef_L54_C4", "vector": [13, 2, 0.9333, 0.0167, 2, 0.69, 1.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return SpatialReference(self.proj4text).wkt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L58_C4", "label": "Meta", "type": "class", "loc": [58, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L43_C0", "vector": [3, 1, 0.9833, 0.05, 1, 0.05, 1.0, 130, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta:\n db_table = 'spatial_ref_sys'\n managed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L59_C8", "label": "db_table =", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L58_C4", "vector": [14, 2, 0.9833, 0.0167, 2, 0.91, 0.0, 111, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "db_table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " db_table = 'spatial_ref_sys'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L60_C8", "label": "managed =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L58_C4", "vector": [14, 2, 1.0, 0.0167, 2, 0.91, 1.0, 503, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "managed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " managed = False"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:FunctionDef_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:Expr_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:Return_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:FunctionDef_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:Expr_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:Return_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:FunctionDef_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:Return_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:FunctionDef_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:ImportFrom_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:Return_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L60_C8"}] |
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 Geometry
from django.contrib.gis.measure import Distance
from django.core.exceptions import ImproperlyConfigured
from django.db.backends.sqlite3.base import DatabaseOperations
from django.db.utils import DatabaseError
class SpatiaLiteOperator(SpatialOperation):
"For SpatiaLite operators (e.g. `&&`, `~`)."
def __init__(self, operator):
super(SpatiaLiteOperator, self).__init__(operator=operator)
class SpatiaLiteFunction(SpatialFunction):
"For SpatiaLite function calls."
def __init__(self, function, **kwargs):
super(SpatiaLiteFunction, self).__init__(function, **kwargs)
class SpatiaLiteFunctionParam(SpatiaLiteFunction):
"For SpatiaLite functions that take another parameter."
sql_template = '%(function)s(%(geo_col)s, %(geometry)s, %%s)'
class SpatiaLiteDistance(SpatiaLiteFunction):
"For SpatiaLite distance operations."
dist_func = 'Distance'
sql_template = '%(function)s(%(geo_col)s, %(geometry)s) %(operator)s %%s'
def __init__(self, operator):
super(SpatiaLiteDistance, self).__init__(self.dist_func,
operator=operator)
class SpatiaLiteRelate(SpatiaLiteFunctionParam):
"For SpatiaLite Relate(<geom>, <pattern>) calls."
pattern_regex = re.compile(r'^[012TF\*]{9}$')
def __init__(self, pattern):
if not self.pattern_regex.match(pattern):
raise ValueError('Invalid intersection matrix pattern "%s".' % pattern)
super(SpatiaLiteRelate, self).__init__('Relate')
# Valid distance types and substitutions
dtypes = (Decimal, Distance, float, int, long)
def get_dist_ops(operator):
"Returns operations for regular distances; spherical distances are not currently supported."
return (SpatiaLiteDistance(operator),)
class SpatiaLiteOperations(DatabaseOperations, BaseSpatialOperations):
compiler_module = 'django.contrib.gis.db.models.sql.compiler'
name = 'spatialite'
spatialite = True
version_regex = re.compile(r'^(?P<major>\d)\.(?P<minor1>\d)\.(?P<minor2>\d+)')
valid_aggregates = dict([(k, None) for k in ('Extent', 'Union')])
Adapter = SpatiaLiteAdapter
Adaptor = Adapter # Backwards-compatibility alias.
area = 'Area'
centroid = 'Centroid'
contained = 'MbrWithin'
difference = 'Difference'
distance = 'Distance'
envelope = 'Envelope'
intersection = 'Intersection'
length = 'GLength' # OpenGis defines Length, but this conflicts with an SQLite reserved keyword
num_geom = 'NumGeometries'
num_points = 'NumPoints'
point_on_surface = 'PointOnSurface'
scale = 'ScaleCoords'
svg = 'AsSVG'
sym_difference = 'SymDifference'
transform = 'Transform'
translate = 'ShiftCoords'
union = 'GUnion' # OpenGis defines Union, but this conflicts with an SQLite reserved keyword
unionagg = 'GUnion'
from_text = 'GeomFromText'
from_wkb = 'GeomFromWKB'
select = 'AsText(%s)'
geometry_functions = {
'equals' : SpatiaLiteFunction('Equals'),
'disjoint' : SpatiaLiteFunction('Disjoint'),
'touches' : SpatiaLiteFunction('Touches'),
'crosses' : SpatiaLiteFunction('Crosses'),
'within' : SpatiaLiteFunction('Within'),
'overlaps' : SpatiaLiteFunction('Overlaps'),
'contains' : SpatiaLiteFunction('Contains'),
'intersects' : SpatiaLiteFunction('Intersects'),
'relate' : (SpatiaLiteRelate, basestring),
# Retruns true if B's bounding box completely contains A's bounding box.
'contained' : SpatiaLiteFunction('MbrWithin'),
# Returns true if A's bounding box completely contains B's bounding box.
'bbcontains' : SpatiaLiteFunction('MbrContains'),
# Returns true if A's bounding box overlaps B's bounding box.
'bboverlaps' : SpatiaLiteFunction('MbrOverlaps'),
# These are implemented here as synonyms for Equals
'same_as' : SpatiaLiteFunction('Equals'),
'exact' : SpatiaLiteFunction('Equals'),
}
distance_functions = {
'distance_gt' : (get_dist_ops('>'), dtypes),
'distance_gte' : (get_dist_ops('>='), dtypes),
'distance_lt' : (get_dist_ops('<'), dtypes),
'distance_lte' : (get_dist_ops('<='), dtypes),
}
geometry_functions.update(distance_functions)
def __init__(self, connection):
super(DatabaseOperations, self).__init__()
self.connection = connection
# Determine the version of the SpatiaLite library.
try:
vtup = self.spatialite_version_tuple()
version = vtup[1:]
if version < (2, 3, 0):
raise ImproperlyConfigured('GeoDjango only supports SpatiaLite versions '
'2.3.0 and above')
self.spatial_version = version
except ImproperlyConfigured:
raise
except Exception, msg:
raise ImproperlyConfigured('Cannot determine the SpatiaLite version for the "%s" '
'database (error was "%s"). Was the SpatiaLite initialization '
'SQL loaded on this database?' %
(self.connection.settings_dict['NAME'], msg))
# Creating the GIS terms dictionary.
gis_terms = ['isnull']
gis_terms += self.geometry_functions.keys()
self.gis_terms = dict([(term, None) for term in gis_terms])
def check_aggregate_support(self, aggregate):
"""
Checks if the given aggregate name is supported (that is, if it's
in `self.valid_aggregates`).
"""
agg_name = aggregate.__class__.__name__
return agg_name in self.valid_aggregates
def convert_geom(self, wkt, geo_field):
"""
Converts geometry WKT returned from a SpatiaLite aggregate.
"""
if wkt:
return Geometry(wkt, geo_field.srid)
else:
return None
def geo_db_type(self, f):
"""
Returns None because geometry columnas are added via the
`AddGeometryColumn` stored procedure on SpatiaLite.
"""
return None
def get_distance(self, f, value, lookup_type):
"""
Returns the distance parameters for the given geometry field,
lookup value, and lookup type. SpatiaLite only supports regular
cartesian-based queries (no spheroid/sphere calculations for point
geometries like PostGIS).
"""
if not value:
return []
value = value[0]
if isinstance(value, Distance):
if f.geodetic(self.connection):
raise ValueError('SpatiaLite does not support distance queries on '
'geometry fields with a geodetic coordinate system. '
'Distance objects; use a numeric value of your '
'distance in degrees instead.')
else:
dist_param = getattr(value, Distance.unit_attname(f.units_name(self.connection)))
else:
dist_param = value
return [dist_param]
def get_geom_placeholder(self, f, value):
"""
Provides a proper substitution value for Geometries that are not in the
SRID of the field. Specifically, this routine will substitute in the
Transform() and GeomFromText() function call(s).
"""
def transform_value(value, srid):
return not (value is None or value.srid == srid)
if hasattr(value, 'expression'):
if transform_value(value, f.srid):
placeholder = '%s(%%s, %s)' % (self.transform, f.srid)
else:
placeholder = '%s'
# No geometry value used for F expression, substitue in
# the column name instead.
return placeholder % '%s.%s' % tuple(map(self.quote_name, value.cols[value.expression]))
else:
if transform_value(value, f.srid):
# Adding Transform() to the SQL placeholder.
return '%s(%s(%%s,%s), %s)' % (self.transform, self.from_text, value.srid, f.srid)
else:
return '%s(%%s,%s)' % (self.from_text, f.srid)
def _get_spatialite_func(self, func):
"""
Helper routine for calling SpatiaLite functions and returning
their result.
"""
cursor = self.connection._cursor()
try:
try:
cursor.execute('SELECT %s' % func)
row = cursor.fetchone()
except:
# Responsibility of caller to perform error handling.
raise
finally:
cursor.close()
return row[0]
def geos_version(self):
"Returns the version of GEOS used by SpatiaLite as a string."
return self._get_spatialite_func('geos_version()')
def proj4_version(self):
"Returns the version of the PROJ.4 library used by SpatiaLite."
return self._get_spatialite_func('proj4_version()')
def spatialite_version(self):
"Returns the SpatiaLite library version as a string."
return self._get_spatialite_func('spatialite_version()')
def spatialite_version_tuple(self):
"""
Returns the SpatiaLite version as a tuple (version string, major,
minor, subminor).
"""
# Getting the SpatiaLite version.
try:
version = self.spatialite_version()
except DatabaseError:
# The `spatialite_version` function first appeared in version 2.3.1
# of SpatiaLite, so doing a fallback test for 2.3.0 (which is
# used by popular Debian/Ubuntu packages).
version = None
try:
tmp = self._get_spatialite_func("X(GeomFromText('POINT(1 1)'))")
if tmp == 1.0: version = '2.3.0'
except DatabaseError:
pass
# If no version string defined, then just re-raise the original
# exception.
if version is None: raise
m = self.version_regex.match(version)
if m:
major = int(m.group('major'))
minor1 = int(m.group('minor1'))
minor2 = int(m.group('minor2'))
else:
raise Exception('Could not parse SpatiaLite version string: %s' % version)
return (version, major, minor1, minor2)
def spatial_aggregate_sql(self, agg):
"""
Returns the spatial aggregate SQL template and function for the
given Aggregate instance.
"""
agg_name = agg.__class__.__name__
if not self.check_aggregate_support(agg):
raise NotImplementedError('%s spatial aggregate is not implmented for this backend.' % agg_name)
agg_name = agg_name.lower()
if agg_name == 'union': agg_name += 'agg'
sql_template = self.select % '%(function)s(%(field)s)'
sql_function = getattr(self, agg_name)
return sql_template, sql_function
def spatial_lookup_sql(self, lvalue, lookup_type, value, field, qn):
"""
Returns the SpatiaLite-specific SQL for the given lookup value
[a tuple of (alias, column, db_type)], lookup type, lookup
value, the model field, and the quoting function.
"""
alias, col, db_type = lvalue
# Getting the quoted field as `geo_col`.
geo_col = '%s.%s' % (qn(alias), qn(col))
if lookup_type in self.geometry_functions:
# See if a SpatiaLite geometry function matches the lookup type.
tmp = self.geometry_functions[lookup_type]
# Lookup types that are tuples take tuple arguments, e.g., 'relate' and
# distance lookups.
if isinstance(tmp, tuple):
# First element of tuple is the SpatiaLiteOperation instance, and the
# second element is either the type or a tuple of acceptable types
# that may passed in as further parameters for the lookup type.
op, arg_type = tmp
# Ensuring that a tuple _value_ was passed in from the user
if not isinstance(value, (tuple, list)):
raise ValueError('Tuple required for `%s` lookup type.' % lookup_type)
# Geometry is first element of lookup tuple.
geom = value[0]
# Number of valid tuple parameters depends on the lookup type.
if len(value) != 2:
raise ValueError('Incorrect number of parameters given for `%s` lookup type.' % lookup_type)
# Ensuring the argument type matches what we expect.
if not isinstance(value[1], arg_type):
raise ValueError('Argument type should be %s, got %s instead.' % (arg_type, type(value[1])))
# For lookup type `relate`, the op instance is not yet created (has
# to be instantiated here to check the pattern parameter).
if lookup_type == 'relate':
op = op(value[1])
elif lookup_type in self.distance_functions:
op = op[0]
else:
op = tmp
geom = value
# Calling the `as_sql` function on the operation instance.
return op.as_sql(geo_col, self.get_geom_placeholder(field, geom))
elif lookup_type == 'isnull':
# Handling 'isnull' lookup type
return "%s IS %sNULL" % (geo_col, (not value and 'NOT ' or ''))
raise TypeError("Got invalid lookup_type: %s" % repr(lookup_type))
# Routines for getting the OGC-compliant models.
def geometry_columns(self):
from django.contrib.gis.db.backends.spatialite.models import GeometryColumns
return GeometryColumns
def spatial_ref_sys(self):
from django.contrib.gis.db.backends.spatialite.models import SpatialRefSys
return SpatialRefSys
| ajibawa-2023/Python-Code-Large/train/row_98771 | 183 | 342 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0029, 0.0029, 0, 0.66, 0.0, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:ImportFrom_L2_C0", "label": "from decimal import Decimal", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0058, 0.0029, 0, 0.66, 0.0588, 349, 0, 1, 0, 0, 349, 0, 0], "semantic": {"name": "decimal", "arg_names": [], "import_names": ["Decimal"], "rhs_call_name": "", "annotation": ""}, "snippet": "from decimal import Decimal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:ImportFrom_L4_C0", "label": "from django.contrib.gis.db.backends.base import BaseSpatialOperations", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0117, 0.0029, 0, 0.66, 0.1176, 157, 0, 1, 0, 0, 157, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.base", "arg_names": [], "import_names": ["BaseSpatialOperations"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.backends.base import BaseSpatialOperations"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:ImportFrom_L5_C0", "label": "from django.contrib.gis.db.backends.util import SpatialOperation, SpatialFunction", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0146, 0.0029, 0, 0.66, 0.1765, 674, 0, 2, 0, 0, 674, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.util", "arg_names": [], "import_names": ["SpatialOperation", "SpatialFunction"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.backends.util import SpatialOperation, SpatialFunction"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:ImportFrom_L6_C0", "label": "from django.contrib.gis.db.backends.spatialite.adapter import SpatiaLiteAdapter", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0175, 0.0029, 0, 0.66, 0.2353, 495, 0, 1, 0, 0, 495, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.spatialite.adapter", "arg_names": [], "import_names": ["SpatiaLiteAdapter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.backends.spatialite.adapter import SpatiaLiteAdapter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:ImportFrom_L7_C0", "label": "from django.contrib.gis.geometry.backend import Geometry", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0205, 0.0029, 0, 0.66, 0.2941, 299, 0, 1, 0, 0, 299, 0, 0], "semantic": {"name": "django.contrib.gis.geometry.backend", "arg_names": [], "import_names": ["Geometry"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geometry.backend import Geometry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:ImportFrom_L8_C0", "label": "from django.contrib.gis.measure import Distance", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0234, 0.0029, 0, 0.66, 0.3529, 844, 0, 1, 0, 0, 844, 0, 0], "semantic": {"name": "django.contrib.gis.measure", "arg_names": [], "import_names": ["Distance"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.measure import Distance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:ImportFrom_L9_C0", "label": "from django.core.exceptions import ImproperlyConfigured", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0263, 0.0029, 0, 0.66, 0.4118, 160, 0, 1, 0, 0, 160, 0, 0], "semantic": {"name": "django.core.exceptions", "arg_names": [], "import_names": ["ImproperlyConfigured"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.exceptions import ImproperlyConfigured"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:ImportFrom_L10_C0", "label": "from django.db.backends.sqlite3.base import DatabaseOperations", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0292, 0.0029, 0, 0.66, 0.4706, 460, 0, 1, 0, 0, 460, 0, 0], "semantic": {"name": "django.db.backends.sqlite3.base", "arg_names": [], "import_names": ["DatabaseOperations"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.backends.sqlite3.base import DatabaseOperations"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:ImportFrom_L11_C0", "label": "from django.db.utils import DatabaseError", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0322, 0.0029, 0, 0.66, 0.5294, 495, 0, 1, 0, 0, 495, 0, 0], "semantic": {"name": "django.db.utils", "arg_names": [], "import_names": ["DatabaseError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.utils import DatabaseError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L13_C0", "label": "SpatiaLiteOperator", "type": "class", "loc": [13, 16], "level": 0, "parent": null, "vector": [3, 0, 0.0424, 0.0117, 0, 0.66, 0.5882, 219, 0, 1, 0, 0, 191, 0, 2], "semantic": {"name": "SpatiaLiteOperator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SpatiaLiteOperator(SpatialOperation):\n \"For SpatiaLite operators (e.g. `&&`, `~`).\"\n def __init__(self, operator):\n super(SpatiaLiteOperator, self).__init__(operator=operator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L14_C4", "label": "expression", "type": "expression", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L13_C0", "vector": [8, 1, 0.0409, 0.0029, 1, 0.61, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"For SpatiaLite operators (e.g. `&&`, `~`).\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L15_C4", "label": "__init__", "type": "function", "loc": [15, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L13_C0", "vector": [2, 1, 0.0453, 0.0058, 1, 0.61, 1.0, 555, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "operator"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, operator):\n super(SpatiaLiteOperator, self).__init__(operator=operator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L16_C8", "label": "__init__()", "type": "expression", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L15_C4", "vector": [8, 2, 0.0468, 0.0029, 2, 0.63, 0.0, 555, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(SpatiaLiteOperator, self).__init__(operator=operator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L18_C0", "label": "SpatiaLiteFunction", "type": "class", "loc": [18, 21], "level": 0, "parent": null, "vector": [3, 0, 0.057, 0.0117, 0, 0.66, 0.6471, 228, 0, 1, 0, 0, 763, 0, 2], "semantic": {"name": "SpatiaLiteFunction", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SpatiaLiteFunction(SpatialFunction):\n \"For SpatiaLite function calls.\"\n def __init__(self, function, **kwargs):\n super(SpatiaLiteFunction, self).__init__(function, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L19_C4", "label": "expression", "type": "expression", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L18_C0", "vector": [8, 1, 0.0556, 0.0029, 1, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"For SpatiaLite function calls.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L20_C4", "label": "__init__", "type": "function", "loc": [20, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L18_C0", "vector": [2, 1, 0.0599, 0.0058, 1, 0.13, 1.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "function", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, function, **kwargs):\n super(SpatiaLiteFunction, self).__init__(function, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L21_C8", "label": "__init__()", "type": "expression", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L20_C4", "vector": [8, 2, 0.0614, 0.0029, 2, 0.78, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(SpatiaLiteFunction, self).__init__(function, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L23_C0", "label": "SpatiaLiteFunctionParam", "type": "class", "loc": [23, 25], "level": 0, "parent": null, "vector": [3, 0, 0.0702, 0.0088, 0, 0.66, 0.7059, 566, 0, 0, 0, 0, 228, 0, 0], "semantic": {"name": "SpatiaLiteFunctionParam", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SpatiaLiteFunctionParam(SpatiaLiteFunction):\n \"For SpatiaLite functions that take another parameter.\"\n sql_template = '%(function)s(%(geo_col)s, %(geometry)s, %%s)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L24_C4", "label": "expression", "type": "expression", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L23_C0", "vector": [8, 1, 0.0702, 0.0029, 1, 0.32, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"For SpatiaLite functions that take another parameter.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L25_C4", "label": "sql_template =", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L23_C0", "vector": [14, 1, 0.0731, 0.0029, 1, 0.32, 1.0, 765, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sql_template", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sql_template = '%(function)s(%(geo_col)s, %(geometry)s, %%s)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L27_C0", "label": "SpatiaLiteDistance", "type": "class", "loc": [27, 34], "level": 0, "parent": null, "vector": [3, 0, 0.0892, 0.0234, 0, 0.66, 0.7647, 69, 0, 1, 0, 0, 228, 0, 2], "semantic": {"name": "SpatiaLiteDistance", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SpatiaLiteDistance(SpatiaLiteFunction):\n \"For SpatiaLite distance operations.\"\n dist_func = 'Distance'\n sql_template = '%(function)s(%(geo_col)s, %(geometry)s) %(operator)s %%s'\n\n def __init__(self, operator):\n super(SpatiaLiteDistance, self).__init__(self.dist_func,\n operator=operator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L28_C4", "label": "expression", "type": "expression", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L27_C0", "vector": [8, 1, 0.0819, 0.0029, 1, 0.32, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"For SpatiaLite distance operations.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L29_C4", "label": "dist_func =", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L27_C0", "vector": [14, 1, 0.0848, 0.0029, 1, 0.32, 0.3333, 591, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "dist_func", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dist_func = 'Distance'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L30_C4", "label": "sql_template =", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L27_C0", "vector": [14, 1, 0.0877, 0.0029, 1, 0.32, 0.6667, 765, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sql_template", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sql_template = '%(function)s(%(geo_col)s, %(geometry)s) %(operator)s %%s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L32_C4", "label": "__init__", "type": "function", "loc": [32, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L27_C0", "vector": [2, 1, 0.0965, 0.0088, 1, 0.32, 1.0, 555, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "operator"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, operator):\n super(SpatiaLiteDistance, self).__init__(self.dist_func,\n operator=operator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L33_C8", "label": "__init__()", "type": "expression", "loc": [33, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L32_C4", "vector": [8, 2, 0.098, 0.0058, 2, 0.02, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(SpatiaLiteDistance, self).__init__(self.dist_func,\n operator=operator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L36_C0", "label": "SpatiaLiteRelate", "type": "class", "loc": [36, 42], "level": 0, "parent": null, "vector": [3, 0, 0.114, 0.0205, 0, 0.66, 0.8235, 199, 0, 1, 0, 0, 566, 0, 5], "semantic": {"name": "SpatiaLiteRelate", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SpatiaLiteRelate(SpatiaLiteFunctionParam):\n \"For SpatiaLite Relate(<geom>, <pattern>) calls.\"\n pattern_regex = re.compile(r'^[012TF\\*]{9}$')\n def __init__(self, pattern):\n if not self.pattern_regex.match(pattern):\n raise ValueError('Invalid intersection matrix pattern \"%s\".' % pattern)\n super(SpatiaLiteRelate, self).__init__('Relate')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L37_C4", "label": "expression", "type": "expression", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L36_C0", "vector": [8, 1, 0.1082, 0.0029, 1, 0.6, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"For SpatiaLite Relate(<geom>, <pattern>) calls.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L38_C4", "label": "pattern_regex = compile()", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L36_C0", "vector": [14, 1, 0.1111, 0.0029, 1, 0.6, 0.5, 700, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "pattern_regex", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " pattern_regex = re.compile(r'^[012TF\\*]{9}$')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L39_C4", "label": "__init__", "type": "function", "loc": [39, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L36_C0", "vector": [2, 1, 0.1184, 0.0117, 1, 0.6, 1.0, 555, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "__init__", "arg_names": ["self", "pattern"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, pattern):\n if not self.pattern_regex.match(pattern):\n raise ValueError('Invalid intersection matrix pattern \"%s\".' % pattern)\n super(SpatiaLiteRelate, self).__init__('Relate')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L40_C8", "label": "if", "type": "if", "loc": [40, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L39_C4", "vector": [4, 2, 0.1184, 0.0058, 2, 0.45, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.pattern_regex.match(pattern):\n raise ValueError('Invalid intersection matrix pattern \"%s\".' % pattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L42_C8", "label": "__init__()", "type": "expression", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L39_C4", "vector": [8, 2, 0.1228, 0.0029, 2, 0.45, 1.0, 555, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(SpatiaLiteRelate, self).__init__('Relate')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L45_C0", "label": "dtypes =", "type": "assigned_variable", "loc": [45, 45], "level": 0, "parent": null, "vector": [14, 0, 0.1316, 0.0029, 0, 0.66, 0.8824, 87, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "dtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "dtypes = (Decimal, Distance, float, int, long)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L46_C0", "label": "get_dist_ops", "type": "function", "loc": [46, 48], "level": 0, "parent": null, "vector": [2, 0, 0.1374, 0.0088, 0, 0.66, 0.9412, 215, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_dist_ops", "arg_names": ["operator"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_dist_ops(operator):\n \"Returns operations for regular distances; spherical distances are not currently supported.\"\n return (SpatiaLiteDistance(operator),)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L47_C4", "label": "expression", "type": "expression", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L46_C0", "vector": [8, 1, 0.1374, 0.0029, 1, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns operations for regular distances; spherical distances are not currently supported.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L48_C4", "label": "return", "type": "return", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L46_C0", "vector": [13, 1, 0.1404, 0.0029, 1, 0.07, 1.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (SpatiaLiteDistance(operator),)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "label": "SpatiaLiteOperations", "type": "class", "loc": [50, 342], "level": 0, "parent": null, "vector": [3, 0, 0.5731, 0.8567, 0, 0.66, 1.0, 37, 0, 16, 0, 0, 311, 0, 75], "semantic": {"name": "SpatiaLiteOperations", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SpatiaLiteOperations(DatabaseOperations, BaseSpatialOperations):\n compiler_module = 'django.contrib.gis.db.models.sql.compiler'\n name = 'spatialite'\n spatialite = True\n version_regex = re.compile(r'^(?P<major>\\d)\\.(?P<minor1>\\d)\\.(?P<minor2>\\d+)')\n valid_aggregates = dict([(k, None) for k in ('Extent', 'Union')])\n\n Adapter = SpatiaLiteAdapter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L51_C4", "label": "compiler_module =", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.1491, 0.0029, 1, 0.56, 0.0, 902, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "compiler_module", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " compiler_module = 'django.contrib.gis.db.models.sql.compiler'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L52_C4", "label": "name =", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.152, 0.0029, 1, 0.56, 0.0222, 57, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = 'spatialite'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L53_C4", "label": "spatialite =", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.155, 0.0029, 1, 0.56, 0.0444, 932, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "spatialite", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " spatialite = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L54_C4", "label": "version_regex = compile()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.1579, 0.0029, 1, 0.56, 0.0667, 866, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "version_regex", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " version_regex = re.compile(r'^(?P<major>\\d)\\.(?P<minor1>\\d)\\.(?P<minor2>\\d+)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L55_C4", "label": "valid_aggregates = dict()", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.1608, 0.0029, 1, 0.56, 0.0889, 414, 3, 1, 0, 0, 827, 10, 1], "semantic": {"name": "valid_aggregates", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " valid_aggregates = dict([(k, None) for k in ('Extent', 'Union')])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L57_C4", "label": "Adapter =", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.1667, 0.0029, 1, 0.56, 0.1111, 6, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Adapter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " Adapter = SpatiaLiteAdapter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L58_C4", "label": "Adaptor =", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.1696, 0.0029, 1, 0.56, 0.1333, 764, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Adaptor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " Adaptor = Adapter # Backwards-compatibility alias."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L60_C4", "label": "area =", "type": "assigned_variable", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.1754, 0.0029, 1, 0.56, 0.1556, 715, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "area", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " area = 'Area'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L61_C4", "label": "centroid =", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.1784, 0.0029, 1, 0.56, 0.1778, 439, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "centroid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " centroid = 'Centroid'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L62_C4", "label": "contained =", "type": "assigned_variable", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.1813, 0.0029, 1, 0.56, 0.2, 952, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "contained", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " contained = 'MbrWithin'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L63_C4", "label": "difference =", "type": "assigned_variable", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.1842, 0.0029, 1, 0.56, 0.2222, 498, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "difference", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " difference = 'Difference'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L64_C4", "label": "distance =", "type": "assigned_variable", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.1871, 0.0029, 1, 0.56, 0.2444, 145, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "distance", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " distance = 'Distance'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L65_C4", "label": "envelope =", "type": "assigned_variable", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.1901, 0.0029, 1, 0.56, 0.2667, 48, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "envelope", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " envelope = 'Envelope'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L66_C4", "label": "intersection =", "type": "assigned_variable", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.193, 0.0029, 1, 0.56, 0.2889, 568, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "intersection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " intersection = 'Intersection'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L67_C4", "label": "length =", "type": "assigned_variable", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.1959, 0.0029, 1, 0.56, 0.3111, 221, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "length", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " length = 'GLength' # OpenGis defines Length, but this conflicts with an SQLite reserved keyword"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L68_C4", "label": "num_geom =", "type": "assigned_variable", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.1988, 0.0029, 1, 0.56, 0.3333, 574, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "num_geom", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " num_geom = 'NumGeometries'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L69_C4", "label": "num_points =", "type": "assigned_variable", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.2018, 0.0029, 1, 0.56, 0.3556, 754, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "num_points", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " num_points = 'NumPoints'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L70_C4", "label": "point_on_surface =", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.2047, 0.0029, 1, 0.56, 0.3778, 858, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "point_on_surface", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " point_on_surface = 'PointOnSurface'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L71_C4", "label": "scale =", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.2076, 0.0029, 1, 0.56, 0.4, 18, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "scale", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " scale = 'ScaleCoords'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L72_C4", "label": "svg =", "type": "assigned_variable", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.2105, 0.0029, 1, 0.56, 0.4222, 873, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "svg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " svg = 'AsSVG'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L73_C4", "label": "sym_difference =", "type": "assigned_variable", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.2135, 0.0029, 1, 0.56, 0.4444, 37, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sym_difference", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sym_difference = 'SymDifference'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L74_C4", "label": "transform =", "type": "assigned_variable", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.2164, 0.0029, 1, 0.56, 0.4667, 48, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "transform", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " transform = 'Transform'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L75_C4", "label": "translate =", "type": "assigned_variable", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.2193, 0.0029, 1, 0.56, 0.4889, 384, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "translate", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " translate = 'ShiftCoords'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L76_C4", "label": "union =", "type": "assigned_variable", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.2222, 0.0029, 1, 0.56, 0.5111, 140, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "union", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " union = 'GUnion' # OpenGis defines Union, but this conflicts with an SQLite reserved keyword"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L77_C4", "label": "unionagg =", "type": "assigned_variable", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.2251, 0.0029, 1, 0.56, 0.5333, 886, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "unionagg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " unionagg = 'GUnion'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L79_C4", "label": "from_text =", "type": "assigned_variable", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.231, 0.0029, 1, 0.56, 0.5556, 694, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "from_text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " from_text = 'GeomFromText'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L80_C4", "label": "from_wkb =", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.2339, 0.0029, 1, 0.56, 0.5778, 581, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "from_wkb", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " from_wkb = 'GeomFromWKB'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L81_C4", "label": "select =", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.2368, 0.0029, 1, 0.56, 0.6, 438, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "select", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " select = 'AsText(%s)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L83_C4", "label": "geometry_functions =", "type": "assigned_variable", "loc": [83, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.2705, 0.0585, 1, 0.56, 0.6222, 884, 0, 0, 0, 0, 0, 6, 13], "semantic": {"name": "geometry_functions", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geometry_functions = {\n 'equals' : SpatiaLiteFunction('Equals'),\n 'disjoint' : SpatiaLiteFunction('Disjoint'),\n 'touches' : SpatiaLiteFunction('Touches'),\n 'crosses' : SpatiaLiteFunction('Crosses'),\n 'within' : SpatiaLiteFunction('Within'),\n 'overlaps' : SpatiaLiteFunction('Overlaps'),\n 'contains' : SpatiaLiteFunction('Contains'),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L104_C4", "label": "distance_functions =", "type": "assigned_variable", "loc": [104, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [14, 1, 0.3114, 0.0175, 1, 0.56, 0.6444, 23, 0, 0, 0, 0, 0, 6, 4], "semantic": {"name": "distance_functions", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " distance_functions = {\n 'distance_gt' : (get_dist_ops('>'), dtypes),\n 'distance_gte' : (get_dist_ops('>='), dtypes),\n 'distance_lt' : (get_dist_ops('<'), dtypes),\n 'distance_lte' : (get_dist_ops('<='), dtypes),\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L110_C4", "label": "update()", "type": "expression", "loc": [110, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [8, 1, 0.3216, 0.0029, 1, 0.56, 0.6667, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " geometry_functions.update(distance_functions)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L112_C4", "label": "__init__", "type": "function", "loc": [112, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [2, 1, 0.3596, 0.0673, 1, 0.56, 0.6889, 555, 0, 2, 0, 0, 0, 0, 7], "semantic": {"name": "__init__", "arg_names": ["self", "connection"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, connection):\n super(DatabaseOperations, self).__init__()\n self.connection = connection\n\n # Determine the version of the SpatiaLite library.\n try:\n vtup = self.spatialite_version_tuple()\n version = vtup[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L113_C8", "label": "__init__()", "type": "expression", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L112_C4", "vector": [8, 2, 0.3304, 0.0029, 2, 0.62, 0.0, 555, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(DatabaseOperations, self).__init__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L114_C8", "label": "self.connection =", "type": "assigned_variable", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L112_C4", "vector": [14, 2, 0.3333, 0.0029, 2, 0.62, 0.25, 685, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.connection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.connection = connection"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L117_C8", "label": "try", "type": "try", "loc": [117, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L112_C4", "vector": [7, 2, 0.3596, 0.038, 2, 0.62, 0.5, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n vtup = self.spatialite_version_tuple()\n version = vtup[1:]\n if version < (2, 3, 0):\n raise ImproperlyConfigured('GeoDjango only supports SpatiaLite versions '\n '2.3.0 and above')\n self.spatial_version = version\n except ImproperlyConfigured:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L118_C12", "label": "vtup = spatialite_version_tuple()", "type": "assigned_variable", "loc": [118, 118], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L117_C8", "vector": [14, 3, 0.345, 0.0029, 3, 0.62, 0.0, 630, 3, 0, 0, 0, 626, 10, 1], "semantic": {"name": "vtup", "arg_names": [], "import_names": [], "rhs_call_name": "spatialite_version_tuple", "annotation": ""}, "snippet": " vtup = self.spatialite_version_tuple()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L119_C12", "label": "version =", "type": "assigned_variable", "loc": [119, 119], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L117_C8", "vector": [14, 3, 0.348, 0.0029, 3, 0.62, 0.3333, 623, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = vtup[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L120_C12", "label": "if", "type": "if", "loc": [120, 122], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L117_C8", "vector": [4, 3, 0.3538, 0.0088, 3, 0.62, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if version < (2, 3, 0):\n raise ImproperlyConfigured('GeoDjango only supports SpatiaLite versions '\n '2.3.0 and above')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L123_C12", "label": "self.spatial_version =", "type": "assigned_variable", "loc": [123, 123], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L117_C8", "vector": [14, 3, 0.3596, 0.0029, 3, 0.62, 1.0, 501, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.spatial_version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.spatial_version = version"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L132_C8", "label": "gis_terms =", "type": "assigned_variable", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L112_C4", "vector": [14, 2, 0.386, 0.0029, 2, 0.62, 0.75, 983, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "gis_terms", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " gis_terms = ['isnull']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L134_C8", "label": "self.gis_terms = dict()", "type": "assigned_variable", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L112_C4", "vector": [14, 2, 0.3918, 0.0029, 2, 0.62, 1.0, 479, 3, 1, 0, 0, 827, 10, 1], "semantic": {"name": "self.gis_terms", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " self.gis_terms = dict([(term, None) for term in gis_terms])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L136_C4", "label": "check_aggregate_support", "type": "function", "loc": [136, 142], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [2, 1, 0.4064, 0.0205, 1, 0.56, 0.7111, 517, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "check_aggregate_support", "arg_names": ["self", "aggregate"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def check_aggregate_support(self, aggregate):\n \"\"\"\n Checks if the given aggregate name is supported (that is, if it's\n in `self.valid_aggregates`).\n \"\"\"\n agg_name = aggregate.__class__.__name__\n return agg_name in self.valid_aggregates"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L137_C8", "label": "expression", "type": "expression", "loc": [137, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L136_C4", "vector": [8, 2, 0.405, 0.0117, 2, 0.68, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Checks if the given aggregate name is supported (that is, if it's\n in `self.valid_aggregates`).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L141_C8", "label": "agg_name =", "type": "assigned_variable", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L136_C4", "vector": [14, 2, 0.4123, 0.0029, 2, 0.68, 0.5, 817, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "agg_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " agg_name = aggregate.__class__.__name__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L142_C8", "label": "return", "type": "return", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L136_C4", "vector": [13, 2, 0.4152, 0.0029, 2, 0.68, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return agg_name in self.valid_aggregates"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L144_C4", "label": "convert_geom", "type": "function", "loc": [144, 151], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [2, 1, 0.4313, 0.0234, 1, 0.56, 0.7333, 452, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "convert_geom", "arg_names": ["self", "wkt", "geo_field"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def convert_geom(self, wkt, geo_field):\n \"\"\"\n Converts geometry WKT returned from a SpatiaLite aggregate.\n \"\"\"\n if wkt:\n return Geometry(wkt, geo_field.srid)\n else:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L145_C8", "label": "expression", "type": "expression", "loc": [145, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L144_C4", "vector": [8, 2, 0.4269, 0.0088, 2, 0.19, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Converts geometry WKT returned from a SpatiaLite aggregate.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L148_C8", "label": "if", "type": "if", "loc": [148, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L144_C4", "vector": [4, 2, 0.4371, 0.0117, 2, 0.19, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if wkt:\n return Geometry(wkt, geo_field.srid)\n else:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L149_C12", "label": "return", "type": "return", "loc": [149, 149], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L148_C8", "vector": [13, 3, 0.4357, 0.0029, 3, 0.89, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Geometry(wkt, geo_field.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L151_C12", "label": "return", "type": "return", "loc": [151, 151], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L148_C8", "vector": [13, 3, 0.4415, 0.0029, 3, 0.89, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L153_C4", "label": "geo_db_type", "type": "function", "loc": [153, 158], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [2, 1, 0.4547, 0.0175, 1, 0.56, 0.7556, 347, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "geo_db_type", "arg_names": ["self", "f"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geo_db_type(self, f):\n \"\"\"\n Returns None because geometry columnas are added via the\n `AddGeometryColumn` stored procedure on SpatiaLite.\n \"\"\"\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L154_C8", "label": "expression", "type": "expression", "loc": [154, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L153_C4", "vector": [8, 2, 0.4547, 0.0117, 2, 0.12, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns None because geometry columnas are added via the\n `AddGeometryColumn` stored procedure on SpatiaLite.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L158_C8", "label": "return", "type": "return", "loc": [158, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L153_C4", "vector": [13, 2, 0.462, 0.0029, 2, 0.12, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L160_C4", "label": "get_distance", "type": "function", "loc": [160, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [2, 1, 0.4971, 0.0614, 1, 0.56, 0.7778, 243, 0, 4, 1, 0, 0, 0, 6], "semantic": {"name": "get_distance", "arg_names": ["self", "f", "value", "lookup_type"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_distance(self, f, value, lookup_type):\n \"\"\"\n Returns the distance parameters for the given geometry field,\n lookup value, and lookup type. SpatiaLite only supports regular\n cartesian-based queries (no spheroid/sphere calculations for point\n geometries like PostGIS).\n \"\"\"\n if not value:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L161_C8", "label": "expression", "type": "expression", "loc": [161, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L160_C4", "vector": [8, 2, 0.4781, 0.0175, 2, 0.92, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the distance parameters for the given geometry field,\n lookup value, and lookup type. SpatiaLite only supports regular\n cartesian-based queries (no spheroid/sphere calculations for point\n geometries like PostGIS).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L167_C8", "label": "if", "type": "if", "loc": [167, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L160_C4", "vector": [4, 2, 0.4898, 0.0058, 2, 0.92, 0.25, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not value:\n return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L168_C12", "label": "return", "type": "return", "loc": [168, 168], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L167_C8", "vector": [13, 3, 0.4912, 0.0029, 3, 0.22, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L169_C8", "label": "value =", "type": "assigned_variable", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L160_C4", "vector": [14, 2, 0.4942, 0.0029, 2, 0.92, 0.5, 441, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = value[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L170_C8", "label": "if", "type": "if", "loc": [170, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L160_C4", "vector": [4, 2, 0.5102, 0.0292, 2, 0.92, 0.75, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, Distance):\n if f.geodetic(self.connection):\n raise ValueError('SpatiaLite does not support distance queries on '\n 'geometry fields with a geodetic coordinate system. '\n 'Distance objects; use a numeric value of your '\n 'distance in degrees instead.')\n else:\n dist_param = getattr(value, Distance.unit_attname(f.units_name(self.connection)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L171_C12", "label": "if", "type": "if", "loc": [171, 177], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L170_C8", "vector": [4, 3, 0.5088, 0.0205, 3, 0.85, 0.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if f.geodetic(self.connection):\n raise ValueError('SpatiaLite does not support distance queries on '\n 'geometry fields with a geodetic coordinate system. '\n 'Distance objects; use a numeric value of your '\n 'distance in degrees instead.')\n else:\n dist_param = getattr(value, Distance.unit_attname(f.units_name(self.connection)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L177_C16", "label": "dist_param = getattr()", "type": "assigned_variable", "loc": [177, 177], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L171_C12", "vector": [14, 4, 0.5175, 0.0029, 4, 0.16, 0.0, 841, 3, 2, 0, 0, 121, 10, 3], "semantic": {"name": "dist_param", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " dist_param = getattr(value, Distance.unit_attname(f.units_name(self.connection)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L179_C12", "label": "dist_param =", "type": "assigned_variable", "loc": [179, 179], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L170_C8", "vector": [14, 3, 0.5234, 0.0029, 3, 0.85, 1.0, 841, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dist_param", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dist_param = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L180_C8", "label": "return", "type": "return", "loc": [180, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L160_C4", "vector": [13, 2, 0.5263, 0.0029, 2, 0.92, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [dist_param]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L182_C4", "label": "get_geom_placeholder", "type": "function", "loc": [182, 203], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [2, 1, 0.5629, 0.0643, 1, 0.56, 0.8, 983, 0, 3, 1, 0, 0, 0, 5], "semantic": {"name": "get_geom_placeholder", "arg_names": ["self", "f", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_geom_placeholder(self, f, value):\n \"\"\"\n Provides a proper substitution value for Geometries that are not in the\n SRID of the field. Specifically, this routine will substitute in the\n Transform() and GeomFromText() function call(s).\n \"\"\"\n def transform_value(value, srid):\n return not (value is None or value.srid == srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L183_C8", "label": "expression", "type": "expression", "loc": [183, 187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L182_C4", "vector": [8, 2, 0.5409, 0.0146, 2, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Provides a proper substitution value for Geometries that are not in the\n SRID of the field. Specifically, this routine will substitute in the\n Transform() and GeomFromText() function call(s).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L188_C8", "label": "transform_value", "type": "function", "loc": [188, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L182_C4", "vector": [2, 2, 0.5512, 0.0058, 2, 0.85, 0.5, 280, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "transform_value", "arg_names": ["value", "srid"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def transform_value(value, srid):\n return not (value is None or value.srid == srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L189_C12", "label": "return", "type": "return", "loc": [189, 189], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L188_C8", "vector": [13, 3, 0.5526, 0.0029, 3, 0.46, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return not (value is None or value.srid == srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L190_C8", "label": "if", "type": "if", "loc": [190, 203], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L182_C4", "vector": [4, 2, 0.5746, 0.0409, 2, 0.85, 1.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(value, 'expression'):\n if transform_value(value, f.srid):\n placeholder = '%s(%%s, %s)' % (self.transform, f.srid)\n else:\n placeholder = '%s'\n # No geometry value used for F expression, substitue in\n # the column name instead.\n return placeholder % '%s.%s' % tuple(map(self.quote_name, value.cols[value.expression]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L191_C12", "label": "if", "type": "if", "loc": [191, 194], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L190_C8", "vector": [4, 3, 0.5629, 0.0117, 3, 0.46, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if transform_value(value, f.srid):\n placeholder = '%s(%%s, %s)' % (self.transform, f.srid)\n else:\n placeholder = '%s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L192_C16", "label": "placeholder =", "type": "assigned_variable", "loc": [192, 192], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L191_C12", "vector": [14, 4, 0.5614, 0.0029, 4, 0.66, 0.0, 847, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "placeholder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " placeholder = '%s(%%s, %s)' % (self.transform, f.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L194_C16", "label": "placeholder =", "type": "assigned_variable", "loc": [194, 194], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L191_C12", "vector": [14, 4, 0.5673, 0.0029, 4, 0.66, 1.0, 847, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "placeholder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " placeholder = '%s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L197_C12", "label": "return", "type": "return", "loc": [197, 197], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L190_C8", "vector": [13, 3, 0.576, 0.0029, 3, 0.46, 0.5, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return placeholder % '%s.%s' % tuple(map(self.quote_name, value.cols[value.expression]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L199_C12", "label": "if", "type": "if", "loc": [199, 203], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L190_C8", "vector": [4, 3, 0.5877, 0.0146, 3, 0.46, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if transform_value(value, f.srid):\n # Adding Transform() to the SQL placeholder.\n return '%s(%s(%%s,%s), %s)' % (self.transform, self.from_text, value.srid, f.srid)\n else:\n return '%s(%%s,%s)' % (self.from_text, f.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L201_C16", "label": "return", "type": "return", "loc": [201, 201], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L199_C12", "vector": [13, 4, 0.5877, 0.0029, 4, 0.82, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s(%s(%%s,%s), %s)' % (self.transform, self.from_text, value.srid, f.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L203_C16", "label": "return", "type": "return", "loc": [203, 203], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L199_C12", "vector": [13, 4, 0.5936, 0.0029, 4, 0.82, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s(%%s,%s)' % (self.from_text, f.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L205_C4", "label": "_get_spatialite_func", "type": "function", "loc": [205, 220], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [2, 1, 0.6213, 0.0468, 1, 0.56, 0.8222, 2, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "_get_spatialite_func", "arg_names": ["self", "func"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_spatialite_func(self, func):\n \"\"\"\n Helper routine for calling SpatiaLite functions and returning\n their result.\n \"\"\"\n cursor = self.connection._cursor()\n try:\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L206_C8", "label": "expression", "type": "expression", "loc": [206, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L205_C4", "vector": [8, 2, 0.6067, 0.0117, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Helper routine for calling SpatiaLite functions and returning\n their result.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L210_C8", "label": "cursor = _cursor()", "type": "assigned_variable", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L205_C4", "vector": [14, 2, 0.614, 0.0029, 2, 0.98, 0.3333, 231, 3, 0, 0, 0, 670, 10, 1], "semantic": {"name": "cursor", "arg_names": [], "import_names": [], "rhs_call_name": "_cursor", "annotation": ""}, "snippet": " cursor = self.connection._cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L211_C8", "label": "try", "type": "try", "loc": [211, 219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L205_C4", "vector": [7, 2, 0.6287, 0.0263, 2, 0.98, 0.6667, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n try:\n cursor.execute('SELECT %s' % func)\n row = cursor.fetchone()\n except:\n # Responsibility of caller to perform error handling.\n raise\n finally:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L212_C12", "label": "try", "type": "try", "loc": [212, 217], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L211_C8", "vector": [7, 3, 0.6272, 0.0175, 3, 0.66, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n cursor.execute('SELECT %s' % func)\n row = cursor.fetchone()\n except:\n # Responsibility of caller to perform error handling.\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L213_C16", "label": "execute()", "type": "expression", "loc": [213, 213], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L212_C12", "vector": [8, 4, 0.6228, 0.0029, 4, 0.66, 0.0, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cursor.execute('SELECT %s' % func)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L214_C16", "label": "row = fetchone()", "type": "assigned_variable", "loc": [214, 214], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L212_C12", "vector": [14, 4, 0.6257, 0.0029, 4, 0.66, 1.0, 767, 3, 0, 0, 0, 561, 10, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "fetchone", "annotation": ""}, "snippet": " row = cursor.fetchone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L219_C12", "label": "close()", "type": "expression", "loc": [219, 219], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L211_C8", "vector": [8, 3, 0.6404, 0.0029, 3, 0.66, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cursor.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L220_C8", "label": "return", "type": "return", "loc": [220, 220], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L205_C4", "vector": [13, 2, 0.6433, 0.0029, 2, 0.98, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return row[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L222_C4", "label": "geos_version", "type": "function", "loc": [222, 224], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [2, 1, 0.652, 0.0088, 1, 0.56, 0.8444, 74, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "geos_version", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geos_version(self):\n \"Returns the version of GEOS used by SpatiaLite as a string.\"\n return self._get_spatialite_func('geos_version()')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L223_C8", "label": "expression", "type": "expression", "loc": [223, 223], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L222_C4", "vector": [8, 2, 0.652, 0.0029, 2, 0.56, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the version of GEOS used by SpatiaLite as a string.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L224_C8", "label": "return", "type": "return", "loc": [224, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L222_C4", "vector": [13, 2, 0.655, 0.0029, 2, 0.56, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._get_spatialite_func('geos_version()')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L226_C4", "label": "proj4_version", "type": "function", "loc": [226, 228], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [2, 1, 0.6637, 0.0088, 1, 0.56, 0.8667, 333, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "proj4_version", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def proj4_version(self):\n \"Returns the version of the PROJ.4 library used by SpatiaLite.\"\n return self._get_spatialite_func('proj4_version()')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L227_C8", "label": "expression", "type": "expression", "loc": [227, 227], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L226_C4", "vector": [8, 2, 0.6637, 0.0029, 2, 0.1, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the version of the PROJ.4 library used by SpatiaLite.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L228_C8", "label": "return", "type": "return", "loc": [228, 228], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L226_C4", "vector": [13, 2, 0.6667, 0.0029, 2, 0.1, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._get_spatialite_func('proj4_version()')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L230_C4", "label": "spatialite_version", "type": "function", "loc": [230, 232], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [2, 1, 0.6754, 0.0088, 1, 0.56, 0.8889, 658, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "spatialite_version", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def spatialite_version(self):\n \"Returns the SpatiaLite library version as a string.\"\n return self._get_spatialite_func('spatialite_version()')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L231_C8", "label": "expression", "type": "expression", "loc": [231, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L230_C4", "vector": [8, 2, 0.6754, 0.0029, 2, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the SpatiaLite library version as a string.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L232_C8", "label": "return", "type": "return", "loc": [232, 232], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L230_C4", "vector": [13, 2, 0.6784, 0.0029, 2, 0.66, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._get_spatialite_func('spatialite_version()')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L234_C4", "label": "spatialite_version_tuple", "type": "function", "loc": [234, 264], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [2, 1, 0.7281, 0.0906, 1, 0.56, 0.9111, 626, 0, 1, 1, 0, 0, 0, 10], "semantic": {"name": "spatialite_version_tuple", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def spatialite_version_tuple(self):\n \"\"\"\n Returns the SpatiaLite version as a tuple (version string, major,\n minor, subminor).\n \"\"\"\n # Getting the SpatiaLite version.\n try:\n version = self.spatialite_version()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L235_C8", "label": "expression", "type": "expression", "loc": [235, 238], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L234_C4", "vector": [8, 2, 0.6915, 0.0117, 2, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the SpatiaLite version as a tuple (version string, major,\n minor, subminor).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L240_C8", "label": "try", "type": "try", "loc": [240, 254], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L234_C4", "vector": [7, 2, 0.7222, 0.0439, 2, 0.85, 0.25, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n version = self.spatialite_version()\n except DatabaseError:\n # The `spatialite_version` function first appeared in version 2.3.1\n # of SpatiaLite, so doing a fallback test for 2.3.0 (which is\n # used by popular Debian/Ubuntu packages).\n version = None\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L241_C12", "label": "version = spatialite_version()", "type": "assigned_variable", "loc": [241, 241], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L240_C8", "vector": [14, 3, 0.7047, 0.0029, 3, 0.95, 0.0, 623, 3, 0, 0, 0, 658, 10, 1], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "spatialite_version", "annotation": ""}, "snippet": " version = self.spatialite_version()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L246_C12", "label": "version =", "type": "assigned_variable", "loc": [246, 246], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L240_C8", "vector": [14, 3, 0.7193, 0.0029, 3, 0.95, 0.0, 623, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L247_C12", "label": "try", "type": "try", "loc": [247, 251], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L240_C8", "vector": [7, 3, 0.7281, 0.0146, 3, 0.95, 0.5, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n tmp = self._get_spatialite_func(\"X(GeomFromText('POINT(1 1)'))\")\n if tmp == 1.0: version = '2.3.0'\n except DatabaseError:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L248_C16", "label": "tmp = _get_spatialite_func()", "type": "assigned_variable", "loc": [248, 248], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L247_C12", "vector": [14, 4, 0.7251, 0.0029, 4, 0.24, 0.0, 517, 3, 1, 0, 0, 2, 10, 1], "semantic": {"name": "tmp", "arg_names": [], "import_names": [], "rhs_call_name": "_get_spatialite_func", "annotation": ""}, "snippet": " tmp = self._get_spatialite_func(\"X(GeomFromText('POINT(1 1)'))\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L249_C16", "label": "if", "type": "if", "loc": [249, 249], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L247_C12", "vector": [4, 4, 0.7281, 0.0029, 4, 0.24, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tmp == 1.0: version = '2.3.0'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L249_C31", "label": "version =", "type": "assigned_variable", "loc": [249, 249], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L249_C16", "vector": [14, 5, 0.7281, 0.0029, 5, 0.46, 0.0, 623, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tmp == 1.0: version = '2.3.0'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L254_C12", "label": "if", "type": "if", "loc": [254, 254], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L240_C8", "vector": [4, 3, 0.7427, 0.0029, 3, 0.95, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if version is None: raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L256_C8", "label": "m = match()", "type": "assigned_variable", "loc": [256, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L234_C4", "vector": [14, 2, 0.7485, 0.0029, 2, 0.85, 0.5, 711, 3, 1, 0, 0, 36, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " m = self.version_regex.match(version)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L257_C8", "label": "if", "type": "if", "loc": [257, 262], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L234_C4", "vector": [4, 2, 0.7588, 0.0175, 2, 0.85, 0.75, 0, 2, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if m:\n major = int(m.group('major'))\n minor1 = int(m.group('minor1'))\n minor2 = int(m.group('minor2'))\n else:\n raise Exception('Could not parse SpatiaLite version string: %s' % version)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L258_C12", "label": "major = int()", "type": "assigned_variable", "loc": [258, 258], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L257_C8", "vector": [14, 3, 0.7544, 0.0029, 3, 0.71, 0.0, 681, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "major", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " major = int(m.group('major'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L259_C12", "label": "minor1 = int()", "type": "assigned_variable", "loc": [259, 259], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L257_C8", "vector": [14, 3, 0.7573, 0.0029, 3, 0.71, 0.5, 282, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "minor1", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " minor1 = int(m.group('minor1'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L260_C12", "label": "minor2 = int()", "type": "assigned_variable", "loc": [260, 260], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L257_C8", "vector": [14, 3, 0.7602, 0.0029, 3, 0.71, 1.0, 453, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "minor2", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " minor2 = int(m.group('minor2'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L264_C8", "label": "return", "type": "return", "loc": [264, 264], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L234_C4", "vector": [13, 2, 0.7719, 0.0029, 2, 0.85, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (version, major, minor1, minor2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L266_C4", "label": "spatial_aggregate_sql", "type": "function", "loc": [266, 278], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [2, 1, 0.7953, 0.038, 1, 0.56, 0.9333, 835, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "spatial_aggregate_sql", "arg_names": ["self", "agg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def spatial_aggregate_sql(self, agg):\n \"\"\"\n Returns the spatial aggregate SQL template and function for the\n given Aggregate instance.\n \"\"\"\n agg_name = agg.__class__.__name__\n if not self.check_aggregate_support(agg):\n raise NotImplementedError('%s spatial aggregate is not implmented for this backend.' % agg_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L267_C8", "label": "expression", "type": "expression", "loc": [267, 270], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L266_C4", "vector": [8, 2, 0.7851, 0.0117, 2, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the spatial aggregate SQL template and function for the\n given Aggregate instance.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L271_C8", "label": "agg_name =", "type": "assigned_variable", "loc": [271, 271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L266_C4", "vector": [14, 2, 0.7924, 0.0029, 2, 0.74, 0.1429, 817, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "agg_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " agg_name = agg.__class__.__name__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L272_C8", "label": "if", "type": "if", "loc": [272, 273], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L266_C4", "vector": [4, 2, 0.7968, 0.0058, 2, 0.74, 0.2857, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.check_aggregate_support(agg):\n raise NotImplementedError('%s spatial aggregate is not implmented for this backend.' % agg_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L274_C8", "label": "agg_name = lower()", "type": "assigned_variable", "loc": [274, 274], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L266_C4", "vector": [14, 2, 0.8012, 0.0029, 2, 0.74, 0.4286, 817, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "agg_name", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " agg_name = agg_name.lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L275_C8", "label": "if", "type": "if", "loc": [275, 275], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L266_C4", "vector": [4, 2, 0.8041, 0.0029, 2, 0.74, 0.5714, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if agg_name == 'union': agg_name += 'agg'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L276_C8", "label": "sql_template =", "type": "assigned_variable", "loc": [276, 276], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L266_C4", "vector": [14, 2, 0.807, 0.0029, 2, 0.74, 0.7143, 765, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sql_template", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sql_template = self.select % '%(function)s(%(field)s)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L277_C8", "label": "sql_function = getattr()", "type": "assigned_variable", "loc": [277, 277], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L266_C4", "vector": [14, 2, 0.8099, 0.0029, 2, 0.74, 0.8571, 586, 3, 2, 0, 0, 121, 10, 1], "semantic": {"name": "sql_function", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " sql_function = getattr(self, agg_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L278_C8", "label": "return", "type": "return", "loc": [278, 278], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L266_C4", "vector": [13, 2, 0.8129, 0.0029, 2, 0.74, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sql_template, sql_function"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L280_C4", "label": "spatial_lookup_sql", "type": "function", "loc": [280, 333], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [2, 1, 0.8962, 0.1579, 1, 0.56, 0.9556, 975, 0, 6, 1, 0, 0, 0, 15], "semantic": {"name": "spatial_lookup_sql", "arg_names": ["self", "lvalue", "lookup_type", "value", "field", "qn"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def spatial_lookup_sql(self, lvalue, lookup_type, value, field, qn):\n \"\"\"\n Returns the SpatiaLite-specific SQL for the given lookup value\n [a tuple of (alias, column, db_type)], lookup type, lookup\n value, the model field, and the quoting function.\n \"\"\"\n alias, col, db_type = lvalue\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L281_C8", "label": "expression", "type": "expression", "loc": [281, 285], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L280_C4", "vector": [8, 2, 0.8275, 0.0146, 2, 0.14, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the SpatiaLite-specific SQL for the given lookup value\n [a tuple of (alias, column, db_type)], lookup type, lookup\n value, the model field, and the quoting function.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L286_C8", "label": "alias, col, db_type =", "type": "assigned_variable", "loc": [286, 286], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L280_C4", "vector": [14, 2, 0.8363, 0.0029, 2, 0.14, 0.3333, 237, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "alias, col, db_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " alias, col, db_type = lvalue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L289_C8", "label": "geo_col =", "type": "assigned_variable", "loc": [289, 289], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L280_C4", "vector": [14, 2, 0.845, 0.0029, 2, 0.14, 0.6667, 139, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "geo_col", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geo_col = '%s.%s' % (qn(alias), qn(col))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L291_C8", "label": "if", "type": "if", "loc": [291, 331], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L280_C4", "vector": [4, 2, 0.9094, 0.1199, 2, 0.14, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lookup_type in self.geometry_functions:\n # See if a SpatiaLite geometry function matches the lookup type.\n tmp = self.geometry_functions[lookup_type]\n\n # Lookup types that are tuples take tuple arguments, e.g., 'relate' and\n # distance lookups.\n if isinstance(tmp, tuple):\n # First element of tuple is the SpatiaLiteOperation instance, and the"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L293_C12", "label": "tmp =", "type": "assigned_variable", "loc": [293, 293], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L291_C8", "vector": [14, 3, 0.8567, 0.0029, 3, 0.17, 0.0, 517, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tmp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tmp = self.geometry_functions[lookup_type]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L297_C12", "label": "if", "type": "if", "loc": [297, 326], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L291_C8", "vector": [4, 3, 0.9108, 0.0877, 3, 0.17, 0.3333, 0, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(tmp, tuple):\n # First element of tuple is the SpatiaLiteOperation instance, and the\n # second element is either the type or a tuple of acceptable types\n # that may passed in as further parameters for the lookup type.\n op, arg_type = tmp\n\n # Ensuring that a tuple _value_ was passed in from the user\n if not isinstance(value, (tuple, list)):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L301_C16", "label": "op, arg_type =", "type": "assigned_variable", "loc": [301, 301], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L297_C12", "vector": [14, 4, 0.8801, 0.0029, 4, 0.03, 0.0, 709, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "op, arg_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " op, arg_type = tmp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L304_C16", "label": "if", "type": "if", "loc": [304, 305], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L297_C12", "vector": [4, 4, 0.8904, 0.0058, 4, 0.03, 0.1429, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(value, (tuple, list)):\n raise ValueError('Tuple required for `%s` lookup type.' % lookup_type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L308_C16", "label": "geom =", "type": "assigned_variable", "loc": [308, 308], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L297_C12", "vector": [14, 4, 0.9006, 0.0029, 4, 0.03, 0.2857, 5, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geom", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geom = value[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L311_C16", "label": "if", "type": "if", "loc": [311, 312], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L297_C12", "vector": [4, 4, 0.9108, 0.0058, 4, 0.03, 0.4286, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(value) != 2:\n raise ValueError('Incorrect number of parameters given for `%s` lookup type.' % lookup_type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L315_C16", "label": "if", "type": "if", "loc": [315, 316], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L297_C12", "vector": [4, 4, 0.9225, 0.0058, 4, 0.03, 0.5714, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(value[1], arg_type):\n raise ValueError('Argument type should be %s, got %s instead.' % (arg_type, type(value[1])))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L320_C16", "label": "if", "type": "if", "loc": [320, 323], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L297_C12", "vector": [4, 4, 0.9401, 0.0117, 4, 0.03, 0.7143, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lookup_type == 'relate':\n op = op(value[1])\n elif lookup_type in self.distance_functions:\n op = op[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L321_C20", "label": "op = op()", "type": "assigned_variable", "loc": [321, 321], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L320_C16", "vector": [14, 5, 0.9386, 0.0029, 5, 0.65, 0.0, 316, 3, 1, 0, 0, 316, 10, 1], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "op", "annotation": ""}, "snippet": " op = op(value[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L322_C16", "label": "if", "type": "if", "loc": [322, 323], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L320_C16", "vector": [4, 5, 0.943, 0.0058, 5, 0.65, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif lookup_type in self.distance_functions:\n op = op[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L323_C20", "label": "op =", "type": "assigned_variable", "loc": [323, 323], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L322_C16", "vector": [14, 6, 0.9444, 0.0029, 6, 0.32, 0.0, 316, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " op = op[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L325_C16", "label": "op =", "type": "assigned_variable", "loc": [325, 325], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L297_C12", "vector": [14, 4, 0.9503, 0.0029, 4, 0.03, 0.8571, 316, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " op = tmp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L326_C16", "label": "geom =", "type": "assigned_variable", "loc": [326, 326], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L297_C12", "vector": [14, 4, 0.9532, 0.0029, 4, 0.03, 1.0, 5, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geom", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geom = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L328_C12", "label": "return", "type": "return", "loc": [328, 328], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L291_C8", "vector": [13, 3, 0.9591, 0.0029, 3, 0.17, 0.6667, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return op.as_sql(geo_col, self.get_geom_placeholder(field, geom))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L329_C8", "label": "if", "type": "if", "loc": [329, 331], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L291_C8", "vector": [4, 3, 0.9649, 0.0088, 3, 0.17, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif lookup_type == 'isnull':\n # Handling 'isnull' lookup type\n return \"%s IS %sNULL\" % (geo_col, (not value and 'NOT ' or ''))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L331_C12", "label": "return", "type": "return", "loc": [331, 331], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L329_C8", "vector": [13, 4, 0.9678, 0.0029, 4, 0.97, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"%s IS %sNULL\" % (geo_col, (not value and 'NOT ' or ''))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L336_C4", "label": "geometry_columns", "type": "function", "loc": [336, 338], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [2, 1, 0.9854, 0.0088, 1, 0.56, 0.9778, 291, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "geometry_columns", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geometry_columns(self):\n from django.contrib.gis.db.backends.spatialite.models import GeometryColumns\n return GeometryColumns"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:ImportFrom_L337_C8", "label": "from django.contrib.gis.db.backends.spatialite.models import GeometryColumns", "type": "import", "loc": [337, 337], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L336_C4", "vector": [1, 2, 0.9854, 0.0029, 2, 0.97, 0.0, 735, 0, 1, 0, 0, 735, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.spatialite.models", "arg_names": [], "import_names": ["GeometryColumns"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.db.backends.spatialite.models import GeometryColumns"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L338_C8", "label": "return", "type": "return", "loc": [338, 338], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L336_C4", "vector": [13, 2, 0.9883, 0.0029, 2, 0.97, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return GeometryColumns"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L340_C4", "label": "spatial_ref_sys", "type": "function", "loc": [340, 342], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "vector": [2, 1, 0.9971, 0.0088, 1, 0.56, 1.0, 318, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "spatial_ref_sys", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def spatial_ref_sys(self):\n from django.contrib.gis.db.backends.spatialite.models import SpatialRefSys\n return SpatialRefSys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:ImportFrom_L341_C8", "label": "from django.contrib.gis.db.backends.spatialite.models import SpatialRefSys", "type": "import", "loc": [341, 341], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L340_C4", "vector": [1, 2, 0.9971, 0.0029, 2, 0.32, 0.0, 735, 0, 1, 0, 0, 735, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.spatialite.models", "arg_names": [], "import_names": ["SpatialRefSys"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.db.backends.spatialite.models import SpatialRefSys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L342_C8", "label": "return", "type": "return", "loc": [342, 342], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L340_C4", "vector": [13, 2, 1.0, 0.0029, 2, 0.32, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return SpatialRefSys"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L39_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L39_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L117_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L118_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L117_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L119_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L117_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L120_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L117_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L123_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L148_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L149_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L148_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L151_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L167_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L168_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L170_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L171_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L171_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L177_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L170_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L179_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L180_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L188_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L188_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L189_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L190_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L191_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L191_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L192_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L191_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L194_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L190_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L197_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L190_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L199_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L199_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L201_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L199_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L203_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L205_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L205_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L206_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L205_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L210_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L205_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L211_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L211_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L212_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L212_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L213_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L212_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L214_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L211_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L219_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L205_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L220_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L222_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L223_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L224_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L226_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L226_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L227_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L226_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L230_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L230_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L231_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L230_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L232_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L234_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L235_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L240_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L241_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L240_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L246_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L240_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L247_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L247_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L248_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L247_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L249_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L249_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L249_C31"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:Try_L240_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L254_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L256_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L257_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L257_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L258_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L257_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L259_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L257_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L260_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L264_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L266_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L266_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L267_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L266_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L271_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L266_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L272_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L266_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L274_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L266_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L275_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L266_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L276_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L266_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L266_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L278_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L280_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L280_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L281_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L280_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L286_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L280_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L289_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L280_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L291_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L291_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L293_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L291_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L297_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L297_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L301_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L297_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L304_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L297_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L308_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L297_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L311_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L297_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L315_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L297_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L320_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L320_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L321_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L320_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L322_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L322_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L323_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L297_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L325_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L297_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Assign_L326_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L291_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L328_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L291_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L329_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:If_L329_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L331_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L336_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L336_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:ImportFrom_L337_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L336_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L338_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L340_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L340_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:ImportFrom_L341_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L340_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Return_L342_C8"}] |
import os
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.management import call_command
from django.db.backends.sqlite3.creation import DatabaseCreation
class SpatiaLiteCreation(DatabaseCreation):
def create_test_db(self, verbosity=1, autoclobber=False):
"""
Creates a test database, prompting the user for confirmation if the
database already exists. Returns the name of the test database created.
This method is overloaded to load up the SpatiaLite initialization
SQL prior to calling the `syncdb` command.
"""
if verbosity >= 1:
print "Creating test database '%s'..." % self.connection.alias
test_database_name = self._create_test_db(verbosity, autoclobber)
self.connection.close()
self.connection.settings_dict["NAME"] = test_database_name
# Confirm the feature set of the test database
self.connection.features.confirm()
# Need to load the SpatiaLite initialization SQL before running `syncdb`.
self.load_spatialite_sql()
call_command('syncdb', verbosity=verbosity, interactive=False, database=self.connection.alias)
if settings.CACHE_BACKEND.startswith('db://'):
from django.core.cache import parse_backend_uri
_, cache_name, _ = parse_backend_uri(settings.CACHE_BACKEND)
call_command('createcachetable', cache_name)
# Get a cursor (even though we don't need one yet). This has
# the side effect of initializing the test database.
cursor = self.connection.cursor()
return test_database_name
def sql_indexes_for_field(self, model, f, style):
"Return any spatial index creation SQL for the field."
from django.contrib.gis.db.models.fields import GeometryField
output = super(SpatiaLiteCreation, self).sql_indexes_for_field(model, f, style)
if isinstance(f, GeometryField):
gqn = self.connection.ops.geo_quote_name
qn = self.connection.ops.quote_name
db_table = model._meta.db_table
output.append(style.SQL_KEYWORD('SELECT ') +
style.SQL_TABLE('AddGeometryColumn') + '(' +
style.SQL_TABLE(gqn(db_table)) + ', ' +
style.SQL_FIELD(gqn(f.column)) + ', ' +
style.SQL_FIELD(str(f.srid)) + ', ' +
style.SQL_COLTYPE(gqn(f.geom_type)) + ', ' +
style.SQL_KEYWORD(str(f.dim)) + ', ' +
style.SQL_KEYWORD(str(int(not f.null))) +
');')
if f.spatial_index:
output.append(style.SQL_KEYWORD('SELECT ') +
style.SQL_TABLE('CreateSpatialIndex') + '(' +
style.SQL_TABLE(gqn(db_table)) + ', ' +
style.SQL_FIELD(gqn(f.column)) + ');')
return output
def load_spatialite_sql(self):
"""
This routine loads up the SpatiaLite SQL file.
"""
# Getting the location of the SpatiaLite SQL file, and confirming
# it exists.
spatialite_sql = self.spatialite_init_file()
if not os.path.isfile(spatialite_sql):
raise ImproperlyConfigured('Could not find the required SpatiaLite initialization '
'SQL file (necessary for testing): %s' % spatialite_sql)
# Opening up the SpatiaLite SQL initialization file and executing
# as a script.
sql_fh = open(spatialite_sql, 'r')
try:
cur = self.connection._cursor()
cur.executescript(sql_fh.read())
finally:
sql_fh.close()
def spatialite_init_file(self):
# SPATIALITE_SQL may be placed in settings to tell GeoDjango
# to use a specific path to the SpatiaLite initilization SQL.
return getattr(settings, 'SPATIALITE_SQL',
'init_spatialite-%s.%s.sql' %
self.connection.ops.spatial_version[:2])
| ajibawa-2023/Python-Code-Large/train/row_98772 | 45 | 96 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0104, 0.0104, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:ImportFrom_L2_C0", "label": "from django.conf import settings", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0208, 0.0104, 0, 0.66, 0.2, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:ImportFrom_L3_C0", "label": "from django.core.exceptions import ImproperlyConfigured", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0312, 0.0104, 0, 0.66, 0.4, 160, 0, 1, 0, 0, 160, 0, 0], "semantic": {"name": "django.core.exceptions", "arg_names": [], "import_names": ["ImproperlyConfigured"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.exceptions import ImproperlyConfigured"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:ImportFrom_L4_C0", "label": "from django.core.management import call_command", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0417, 0.0104, 0, 0.66, 0.6, 879, 0, 1, 0, 0, 879, 0, 0], "semantic": {"name": "django.core.management", "arg_names": [], "import_names": ["call_command"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.management import call_command"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:ImportFrom_L5_C0", "label": "from django.db.backends.sqlite3.creation import DatabaseCreation", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0521, 0.0104, 0, 0.66, 0.8, 864, 0, 1, 0, 0, 864, 0, 0], "semantic": {"name": "django.db.backends.sqlite3.creation", "arg_names": [], "import_names": ["DatabaseCreation"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.backends.sqlite3.creation import DatabaseCreation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:ClassDef_L7_C0", "label": "SpatiaLiteCreation", "type": "class", "loc": [7, 96], "level": 0, "parent": null, "vector": [3, 0, 0.5365, 0.9375, 0, 0.66, 1.0, 404, 0, 4, 0, 0, 625, 0, 45], "semantic": {"name": "SpatiaLiteCreation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SpatiaLiteCreation(DatabaseCreation):\n\n def create_test_db(self, verbosity=1, autoclobber=False):\n \"\"\"\n Creates a test database, prompting the user for confirmation if the\n database already exists. Returns the name of the test database created.\n\n This method is overloaded to load up the SpatiaLite initialization"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4", "label": "create_test_db", "type": "function", "loc": [9, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:ClassDef_L7_C0", "vector": [2, 1, 0.2552, 0.3333, 1, 0.1, 0.0, 217, 0, 3, 1, 0, 0, 0, 10], "semantic": {"name": "create_test_db", "arg_names": ["self", "verbosity", "autoclobber"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def create_test_db(self, verbosity=1, autoclobber=False):\n \"\"\"\n Creates a test database, prompting the user for confirmation if the\n database already exists. Returns the name of the test database created.\n\n This method is overloaded to load up the SpatiaLite initialization\n SQL prior to calling the `syncdb` command.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L10_C8", "label": "expression", "type": "expression", "loc": [10, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4", "vector": [8, 2, 0.1354, 0.0729, 2, 0.01, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Creates a test database, prompting the user for confirmation if the\n database already exists. Returns the name of the test database created.\n\n This method is overloaded to load up the SpatiaLite initialization\n SQL prior to calling the `syncdb` command.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L17_C8", "label": "if", "type": "if", "loc": [17, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4", "vector": [4, 2, 0.1823, 0.0208, 2, 0.01, 0.1, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if verbosity >= 1:\n print(\"Creating test database '%s'...\" % self.connection.alias)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L18_C12", "label": "print()", "type": "expression", "loc": [18, 18], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L17_C8", "vector": [8, 3, 0.1875, 0.0104, 3, 0.7, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Creating test database '%s'...\" % self.connection.alias)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Assign_L20_C8", "label": "test_database_name = _create_test_db()", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4", "vector": [14, 2, 0.2083, 0.0104, 2, 0.01, 0.2, 295, 3, 2, 0, 0, 883, 10, 1], "semantic": {"name": "test_database_name", "arg_names": [], "import_names": [], "rhs_call_name": "_create_test_db", "annotation": ""}, "snippet": " test_database_name = self._create_test_db(verbosity, autoclobber)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L22_C8", "label": "close()", "type": "expression", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4", "vector": [8, 2, 0.2292, 0.0104, 2, 0.01, 0.3, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " self.connection.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Assign_L24_C8", "label": "assign", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4", "vector": [14, 2, 0.25, 0.0104, 2, 0.01, 0.4, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.connection.settings_dict[\"NAME\"] = test_database_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L26_C8", "label": "confirm()", "type": "expression", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4", "vector": [8, 2, 0.2708, 0.0104, 2, 0.01, 0.5, 488, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "confirm", "arg_names": [], "import_names": [], "rhs_call_name": "confirm", "annotation": ""}, "snippet": " self.connection.features.confirm()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L28_C8", "label": "load_spatialite_sql()", "type": "expression", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4", "vector": [8, 2, 0.2917, 0.0104, 2, 0.01, 0.6, 158, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "load_spatialite_sql", "arg_names": [], "import_names": [], "rhs_call_name": "load_spatialite_sql", "annotation": ""}, "snippet": " self.load_spatialite_sql()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L29_C8", "label": "call_command()", "type": "expression", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4", "vector": [8, 2, 0.3021, 0.0104, 2, 0.01, 0.7, 587, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "call_command", "arg_names": [], "import_names": [], "rhs_call_name": "call_command", "annotation": ""}, "snippet": " call_command('syncdb', verbosity=verbosity, interactive=False, database=self.connection.alias)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L31_C8", "label": "if", "type": "if", "loc": [31, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4", "vector": [4, 2, 0.3385, 0.0417, 2, 0.01, 0.8, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if settings.CACHE_BACKEND.startswith('db://'):\n from django.core.cache import parse_backend_uri\n _, cache_name, _ = parse_backend_uri(settings.CACHE_BACKEND)\n call_command('createcachetable', cache_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:ImportFrom_L32_C12", "label": "from django.core.cache import parse_backend_uri", "type": "import", "loc": [32, 32], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L31_C8", "vector": [1, 3, 0.3333, 0.0104, 3, 0.18, 0.0, 734, 0, 1, 0, 0, 734, 0, 0], "semantic": {"name": "django.core.cache", "arg_names": [], "import_names": ["parse_backend_uri"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.core.cache import parse_backend_uri"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Assign_L33_C12", "label": "_, cache_name, _ = parse_backend_uri()", "type": "assigned_variable", "loc": [33, 33], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L31_C8", "vector": [14, 3, 0.3438, 0.0104, 3, 0.18, 0.5, 339, 3, 1, 0, 0, 566, 10, 1], "semantic": {"name": "_, cache_name, _", "arg_names": [], "import_names": [], "rhs_call_name": "parse_backend_uri", "annotation": ""}, "snippet": " _, cache_name, _ = parse_backend_uri(settings.CACHE_BACKEND)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L34_C12", "label": "call_command()", "type": "expression", "loc": [34, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L31_C8", "vector": [8, 3, 0.3542, 0.0104, 3, 0.18, 1.0, 587, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "call_command", "arg_names": [], "import_names": [], "rhs_call_name": "call_command", "annotation": ""}, "snippet": " call_command('createcachetable', cache_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Assign_L38_C8", "label": "cursor = cursor()", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4", "vector": [14, 2, 0.3958, 0.0104, 2, 0.01, 0.9, 231, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cursor", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cursor = self.connection.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Return_L40_C8", "label": "return", "type": "return", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4", "vector": [13, 2, 0.4167, 0.0104, 2, 0.01, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return test_database_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L42_C4", "label": "sql_indexes_for_field", "type": "function", "loc": [42, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:ClassDef_L7_C0", "vector": [2, 1, 0.5781, 0.2917, 1, 0.1, 0.3333, 570, 0, 4, 1, 0, 0, 0, 26], "semantic": {"name": "sql_indexes_for_field", "arg_names": ["self", "model", "f", "style"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def sql_indexes_for_field(self, model, f, style):\n \"Return any spatial index creation SQL for the field.\"\n from django.contrib.gis.db.models.fields import GeometryField\n\n output = super(SpatiaLiteCreation, self).sql_indexes_for_field(model, f, style)\n\n if isinstance(f, GeometryField):\n gqn = self.connection.ops.geo_quote_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L43_C8", "label": "expression", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L42_C4", "vector": [8, 2, 0.4479, 0.0104, 2, 0.87, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Return any spatial index creation SQL for the field.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:ImportFrom_L44_C8", "label": "from django.contrib.gis.db.models.fields import GeometryField", "type": "import", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L42_C4", "vector": [1, 2, 0.4583, 0.0104, 2, 0.87, 0.25, 708, 0, 1, 0, 0, 708, 0, 0], "semantic": {"name": "django.contrib.gis.db.models.fields", "arg_names": [], "import_names": ["GeometryField"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.db.models.fields import GeometryField"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Assign_L46_C8", "label": "output = sql_indexes_for_field()", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L42_C4", "vector": [14, 2, 0.4792, 0.0104, 2, 0.87, 0.5, 886, 3, 3, 0, 0, 570, 10, 2], "semantic": {"name": "output", "arg_names": [], "import_names": [], "rhs_call_name": "sql_indexes_for_field", "annotation": ""}, "snippet": " output = super(SpatiaLiteCreation, self).sql_indexes_for_field(model, f, style)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L48_C8", "label": "if", "type": "if", "loc": [48, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L42_C4", "vector": [4, 2, 0.599, 0.2083, 2, 0.87, 0.75, 0, 3, 0, 0, 0, 0, 0, 24], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(f, GeometryField):\n gqn = self.connection.ops.geo_quote_name\n qn = self.connection.ops.quote_name\n db_table = model._meta.db_table\n\n output.append(style.SQL_KEYWORD('SELECT ') +\n style.SQL_TABLE('AddGeometryColumn') + '(' +\n style.SQL_TABLE(gqn(db_table)) + ', ' +"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Assign_L49_C12", "label": "gqn =", "type": "assigned_variable", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L48_C8", "vector": [14, 3, 0.5104, 0.0104, 3, 0.1, 0.0, 613, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "gqn", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " gqn = self.connection.ops.geo_quote_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Assign_L50_C12", "label": "qn =", "type": "assigned_variable", "loc": [50, 50], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L48_C8", "vector": [14, 3, 0.5208, 0.0104, 3, 0.1, 0.25, 514, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "qn", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " qn = self.connection.ops.quote_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Assign_L51_C12", "label": "db_table =", "type": "assigned_variable", "loc": [51, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L48_C8", "vector": [14, 3, 0.5312, 0.0104, 3, 0.1, 0.5, 111, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "db_table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " db_table = model._meta.db_table"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L53_C12", "label": "append()", "type": "expression", "loc": [53, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L48_C8", "vector": [8, 3, 0.5938, 0.0938, 3, 0.1, 0.75, 243, 3, 1, 0, 0, 0, 0, 16], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " output.append(style.SQL_KEYWORD('SELECT ') +\n style.SQL_TABLE('AddGeometryColumn') + '(' +\n style.SQL_TABLE(gqn(db_table)) + ', ' +\n style.SQL_FIELD(gqn(f.column)) + ', ' +\n style.SQL_FIELD(str(f.srid)) + ', ' +\n style.SQL_COLTYPE(gqn(f.geom_type)) + ', ' +\n style.SQL_KEYWORD(str(f.dim)) + ', ' +\n style.SQL_KEYWORD(str(int(not f.null))) +"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L63_C12", "label": "if", "type": "if", "loc": [63, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L48_C8", "vector": [4, 3, 0.6771, 0.0521, 3, 0.1, 1.0, 0, 7, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if f.spatial_index:\n output.append(style.SQL_KEYWORD('SELECT ') +\n style.SQL_TABLE('CreateSpatialIndex') + '(' +\n style.SQL_TABLE(gqn(db_table)) + ', ' +\n style.SQL_FIELD(gqn(f.column)) + ');')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L64_C16", "label": "append()", "type": "expression", "loc": [64, 67], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L63_C12", "vector": [8, 4, 0.6823, 0.0417, 4, 0.77, 0.0, 243, 3, 1, 0, 0, 0, 0, 7], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " output.append(style.SQL_KEYWORD('SELECT ') +\n style.SQL_TABLE('CreateSpatialIndex') + '(' +\n style.SQL_TABLE(gqn(db_table)) + ', ' +\n style.SQL_FIELD(gqn(f.column)) + ');')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Return_L69_C8", "label": "return", "type": "return", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L42_C4", "vector": [13, 2, 0.7188, 0.0104, 2, 0.87, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return output"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L71_C4", "label": "load_spatialite_sql", "type": "function", "loc": [71, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:ClassDef_L7_C0", "vector": [2, 1, 0.8333, 0.1979, 1, 0.1, 0.6667, 158, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "load_spatialite_sql", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def load_spatialite_sql(self):\n \"\"\"\n This routine loads up the SpatiaLite SQL file.\n \"\"\"\n # Getting the location of the SpatiaLite SQL file, and confirming\n # it exists.\n spatialite_sql = self.spatialite_init_file()\n if not os.path.isfile(spatialite_sql):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L72_C8", "label": "expression", "type": "expression", "loc": [72, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L71_C4", "vector": [8, 2, 0.7604, 0.0312, 2, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n This routine loads up the SpatiaLite SQL file.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Assign_L77_C8", "label": "spatialite_sql = spatialite_init_file()", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L71_C4", "vector": [14, 2, 0.8021, 0.0104, 2, 0.75, 0.25, 300, 3, 0, 0, 0, 422, 10, 1], "semantic": {"name": "spatialite_sql", "arg_names": [], "import_names": [], "rhs_call_name": "spatialite_init_file", "annotation": ""}, "snippet": " spatialite_sql = self.spatialite_init_file()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L78_C8", "label": "if", "type": "if", "loc": [78, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L71_C4", "vector": [4, 2, 0.8229, 0.0312, 2, 0.75, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not os.path.isfile(spatialite_sql):\n raise ImproperlyConfigured('Could not find the required SpatiaLite initialization '\n 'SQL file (necessary for testing): %s' % spatialite_sql)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Assign_L84_C8", "label": "sql_fh = open()", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L71_C4", "vector": [14, 2, 0.875, 0.0104, 2, 0.75, 0.75, 948, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "sql_fh", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " sql_fh = open(spatialite_sql, 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Try_L85_C8", "label": "try", "type": "try", "loc": [85, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L71_C4", "vector": [7, 2, 0.9062, 0.0521, 2, 0.75, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n cur = self.connection._cursor()\n cur.executescript(sql_fh.read())\n finally:\n sql_fh.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Assign_L86_C12", "label": "cur = _cursor()", "type": "assigned_variable", "loc": [86, 86], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:Try_L85_C8", "vector": [14, 3, 0.8958, 0.0104, 3, 0.73, 0.0, 834, 3, 0, 0, 0, 670, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "_cursor", "annotation": ""}, "snippet": " cur = self.connection._cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L87_C12", "label": "executescript()", "type": "expression", "loc": [87, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:Try_L85_C8", "vector": [8, 3, 0.9062, 0.0104, 3, 0.73, 0.5, 675, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "executescript", "arg_names": [], "import_names": [], "rhs_call_name": "executescript", "annotation": ""}, "snippet": " cur.executescript(sql_fh.read())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L89_C12", "label": "close()", "type": "expression", "loc": [89, 89], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:Try_L85_C8", "vector": [8, 3, 0.9271, 0.0104, 3, 0.73, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " sql_fh.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L91_C4", "label": "spatialite_init_file", "type": "function", "loc": [91, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:ClassDef_L7_C0", "vector": [2, 1, 0.974, 0.0625, 1, 0.1, 1.0, 422, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "spatialite_init_file", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def spatialite_init_file(self):\n # SPATIALITE_SQL may be placed in settings to tell GeoDjango\n # to use a specific path to the SpatiaLite initilization SQL.\n return getattr(settings, 'SPATIALITE_SQL',\n 'init_spatialite-%s.%s.sql' %\n self.connection.ops.spatial_version[:2])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98772:Return_L94_C8", "label": "return", "type": "return", "loc": [94, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L91_C4", "vector": [13, 2, 0.9896, 0.0312, 2, 0.79, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return getattr(settings, 'SPATIALITE_SQL',\n 'init_spatialite-%s.%s.sql' %\n self.connection.ops.spatial_version[:2])"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98772:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L17_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L18_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Assign_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L31_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:ImportFrom_L32_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L31_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Assign_L33_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L31_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L34_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Return_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:ImportFrom_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L48_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Assign_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L48_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Assign_L50_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L48_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Assign_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L48_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L48_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L63_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L63_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L64_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Return_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Assign_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:If_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Try_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:Try_L85_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Assign_L86_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:Try_L85_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L87_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:Try_L85_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L89_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Return_L94_C8"}] |
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
# introspection is actually performed.
postgis_types_reverse = {}
def get_postgis_types(self):
"""
Returns a dictionary with keys that are the PostgreSQL object
identification integers for the PostGIS geometry and/or
geography types (if supported).
"""
cursor = self.connection.cursor()
# The OID integers associated with the geometry type may
# be different across versions; hence, this is why we have
# to query the PostgreSQL pg_type table corresponding to the
# PostGIS custom data types.
oid_sql = 'SELECT "oid" FROM "pg_type" WHERE "typname" = %s'
try:
cursor.execute(oid_sql, ('geometry',))
GEOM_TYPE = cursor.fetchone()[0]
postgis_types = { GEOM_TYPE : 'GeometryField' }
if self.connection.ops.geography:
cursor.execute(oid_sql, ('geography',))
GEOG_TYPE = cursor.fetchone()[0]
# The value for the geography type is actually a tuple
# to pass in the `geography=True` keyword to the field
# definition.
postgis_types[GEOG_TYPE] = ('GeometryField', {'geography' : True})
finally:
cursor.close()
return postgis_types
def get_field_type(self, data_type, description):
if not self.postgis_types_reverse:
# If the PostGIS types reverse dictionary is not populated, do so
# now. In order to prevent unnecessary requests upon connection
# intialization, the `data_types_reverse` dictionary is not updated
# with the PostGIS custom types until introspection is actually
# performed -- in other words, when this function is called.
self.postgis_types_reverse = self.get_postgis_types()
self.data_types_reverse.update(self.postgis_types_reverse)
return super(PostGISIntrospection, self).get_field_type(data_type, description)
def get_geometry_type(self, table_name, geo_col):
"""
The geometry type OID used by PostGIS does not indicate the particular
type of field that a geometry column is (e.g., whether it's a
PointField or a PolygonField). Thus, this routine queries the PostGIS
metadata tables to determine the geometry type,
"""
cursor = self.connection.cursor()
try:
try:
# First seeing if this geometry column is in the `geometry_columns`
cursor.execute('SELECT "coord_dimension", "srid", "type" '
'FROM "geometry_columns" '
'WHERE "f_table_name"=%s AND "f_geometry_column"=%s',
(table_name, geo_col))
row = cursor.fetchone()
if not row: raise GeoIntrospectionError
except GeoIntrospectionError:
if self.connection.ops.geography:
cursor.execute('SELECT "coord_dimension", "srid", "type" '
'FROM "geography_columns" '
'WHERE "f_table_name"=%s AND "f_geography_column"=%s',
(table_name, geo_col))
row = cursor.fetchone()
if not row:
raise Exception('Could not find a geometry or geography column for "%s"."%s"' %
(table_name, geo_col))
# OGRGeomType does not require GDAL and makes it easy to convert
# from OGC geom type name to Django field.
field_type = OGRGeomType(row[2]).django
# Getting any GeometryField keyword arguments that are not the default.
dim = row[0]
srid = row[1]
field_params = {}
if srid != 4326:
field_params['srid'] = srid
if dim != 2:
field_params['dim'] = dim
finally:
cursor.close()
return field_type, field_params
| ajibawa-2023/Python-Code-Large/train/row_98774 | 46 | 95 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98774:ImportFrom_L1_C0", "label": "from django.db.backends.postgresql_psycopg2.introspection import DatabaseIntrospection", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0105, 0.0105, 0, 0.66, 0.0, 862, 0, 1, 0, 0, 862, 0, 0], "semantic": {"name": "django.db.backends.postgresql_psycopg2.introspection", "arg_names": [], "import_names": ["DatabaseIntrospection"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.backends.postgresql_psycopg2.introspection import DatabaseIntrospection"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:ImportFrom_L2_C0", "label": "from django.contrib.gis.gdal import OGRGeomType", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0211, 0.0105, 0, 0.66, 0.3333, 793, 0, 1, 0, 0, 793, 0, 0], "semantic": {"name": "django.contrib.gis.gdal", "arg_names": [], "import_names": ["OGRGeomType"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.gdal import OGRGeomType"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:ClassDef_L4_C0", "label": "GeoIntrospectionError", "type": "class", "loc": [4, 5], "level": 0, "parent": null, "vector": [3, 0, 0.0474, 0.0211, 0, 0.66, 0.6667, 498, 0, 0, 0, 0, 645, 0, 0], "semantic": {"name": "GeoIntrospectionError", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GeoIntrospectionError(Exception):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:ClassDef_L7_C0", "label": "PostGISIntrospection", "type": "class", "loc": [7, 95], "level": 0, "parent": null, "vector": [3, 0, 0.5368, 0.9368, 0, 0.66, 1.0, 970, 0, 3, 0, 0, 77, 0, 18], "semantic": {"name": "PostGISIntrospection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PostGISIntrospection(DatabaseIntrospection):\n # Reverse dictionary for PostGIS geometry types not populated until\n # introspection is actually performed.\n postgis_types_reverse = {}\n\n def get_postgis_types(self):\n \"\"\"\n Returns a dictionary with keys that are the PostgreSQL object"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L10_C4", "label": "postgis_types_reverse =", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:ClassDef_L7_C0", "vector": [14, 1, 0.1053, 0.0105, 1, 0.13, 0.0, 209, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "postgis_types_reverse", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " postgis_types_reverse = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L12_C4", "label": "get_postgis_types", "type": "function", "loc": [12, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:ClassDef_L7_C0", "vector": [2, 1, 0.2632, 0.2842, 1, 0.13, 0.3333, 135, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "get_postgis_types", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_postgis_types(self):\n \"\"\"\n Returns a dictionary with keys that are the PostgreSQL object\n identification integers for the PostGIS geometry and/or\n geography types (if supported).\n \"\"\"\n cursor = self.connection.cursor()\n # The OID integers associated with the geometry type may"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Expr_L13_C8", "label": "expression", "type": "expression", "loc": [13, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L12_C4", "vector": [8, 2, 0.1579, 0.0526, 2, 0.34, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a dictionary with keys that are the PostgreSQL object\n identification integers for the PostGIS geometry and/or\n geography types (if supported).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L18_C8", "label": "cursor = cursor()", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L12_C4", "vector": [14, 2, 0.1895, 0.0105, 2, 0.34, 0.25, 231, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cursor", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cursor = self.connection.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L23_C8", "label": "oid_sql =", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L12_C4", "vector": [14, 2, 0.2421, 0.0105, 2, 0.34, 0.5, 794, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "oid_sql", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " oid_sql = 'SELECT \"oid\" FROM \"pg_type\" WHERE \"typname\" = %s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L24_C8", "label": "try", "type": "try", "loc": [24, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L12_C4", "vector": [7, 2, 0.3158, 0.1368, 2, 0.34, 0.75, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n cursor.execute(oid_sql, ('geometry',))\n GEOM_TYPE = cursor.fetchone()[0]\n postgis_types = { GEOM_TYPE : 'GeometryField' }\n if self.connection.ops.geography:\n cursor.execute(oid_sql, ('geography',))\n GEOG_TYPE = cursor.fetchone()[0]\n # The value for the geography type is actually a tuple"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Expr_L25_C12", "label": "execute()", "type": "expression", "loc": [25, 25], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L24_C8", "vector": [8, 3, 0.2632, 0.0105, 3, 0.45, 0.0, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cursor.execute(oid_sql, ('geometry',))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L26_C12", "label": "GEOM_TYPE =", "type": "assigned_variable", "loc": [26, 26], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L24_C8", "vector": [14, 3, 0.2737, 0.0105, 3, 0.45, 0.25, 986, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "GEOM_TYPE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " GEOM_TYPE = cursor.fetchone()[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L27_C12", "label": "postgis_types =", "type": "assigned_variable", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L24_C8", "vector": [14, 3, 0.2842, 0.0105, 3, 0.45, 0.5, 655, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "postgis_types", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " postgis_types = { GEOM_TYPE : 'GeometryField' }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L28_C12", "label": "if", "type": "if", "loc": [28, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L24_C8", "vector": [4, 3, 0.3263, 0.0737, 3, 0.45, 0.75, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.connection.ops.geography:\n cursor.execute(oid_sql, ('geography',))\n GEOG_TYPE = cursor.fetchone()[0]\n # The value for the geography type is actually a tuple\n # to pass in the `geography=True` keyword to the field\n # definition.\n postgis_types[GEOG_TYPE] = ('GeometryField', {'geography' : True})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Expr_L29_C16", "label": "execute()", "type": "expression", "loc": [29, 29], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L28_C12", "vector": [8, 4, 0.3053, 0.0105, 4, 0.75, 0.0, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cursor.execute(oid_sql, ('geography',))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L30_C16", "label": "GEOG_TYPE =", "type": "assigned_variable", "loc": [30, 30], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L28_C12", "vector": [14, 4, 0.3158, 0.0105, 4, 0.75, 0.5, 229, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "GEOG_TYPE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " GEOG_TYPE = cursor.fetchone()[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L34_C16", "label": "assign", "type": "assigned_variable", "loc": [34, 34], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L28_C12", "vector": [14, 4, 0.3579, 0.0105, 4, 0.75, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " postgis_types[GEOG_TYPE] = ('GeometryField', {'geography' : True})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Expr_L36_C12", "label": "close()", "type": "expression", "loc": [36, 36], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L24_C8", "vector": [8, 3, 0.3789, 0.0105, 3, 0.45, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cursor.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Return_L38_C8", "label": "return", "type": "return", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L12_C4", "vector": [13, 2, 0.4, 0.0105, 2, 0.34, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return postgis_types"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L40_C4", "label": "get_field_type", "type": "function", "loc": [40, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:ClassDef_L7_C0", "vector": [2, 1, 0.4684, 0.1053, 1, 0.13, 0.6667, 691, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "get_field_type", "arg_names": ["self", "data_type", "description"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_field_type(self, data_type, description):\n if not self.postgis_types_reverse:\n # If the PostGIS types reverse dictionary is not populated, do so\n # now. In order to prevent unnecessary requests upon connection\n # intialization, the `data_types_reverse` dictionary is not updated\n # with the PostGIS custom types until introspection is actually\n # performed -- in other words, when this function is called.\n self.postgis_types_reverse = self.get_postgis_types()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L41_C8", "label": "if", "type": "if", "loc": [41, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L40_C4", "vector": [4, 2, 0.4684, 0.0842, 2, 0.68, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.postgis_types_reverse:\n # If the PostGIS types reverse dictionary is not populated, do so\n # now. In order to prevent unnecessary requests upon connection\n # intialization, the `data_types_reverse` dictionary is not updated\n # with the PostGIS custom types until introspection is actually\n # performed -- in other words, when this function is called.\n self.postgis_types_reverse = self.get_postgis_types()\n self.data_types_reverse.update(self.postgis_types_reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L47_C12", "label": "self.postgis_types_reverse = get_postgis_types()", "type": "assigned_variable", "loc": [47, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L41_C8", "vector": [14, 3, 0.4947, 0.0105, 3, 0.81, 0.0, 62, 3, 0, 0, 0, 135, 10, 1], "semantic": {"name": "self.postgis_types_reverse", "arg_names": [], "import_names": [], "rhs_call_name": "get_postgis_types", "annotation": ""}, "snippet": " self.postgis_types_reverse = self.get_postgis_types()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Expr_L48_C12", "label": "update()", "type": "expression", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L41_C8", "vector": [8, 3, 0.5053, 0.0105, 3, 0.81, 1.0, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self.data_types_reverse.update(self.postgis_types_reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Return_L49_C8", "label": "return", "type": "return", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L40_C4", "vector": [13, 2, 0.5158, 0.0105, 2, 0.68, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return super(PostGISIntrospection, self).get_field_type(data_type, description)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L51_C4", "label": "get_geometry_type", "type": "function", "loc": [51, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:ClassDef_L7_C0", "vector": [2, 1, 0.7684, 0.4737, 1, 0.13, 1.0, 844, 0, 3, 1, 0, 0, 0, 8], "semantic": {"name": "get_geometry_type", "arg_names": ["self", "table_name", "geo_col"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_geometry_type(self, table_name, geo_col):\n \"\"\"\n The geometry type OID used by PostGIS does not indicate the particular\n type of field that a geometry column is (e.g., whether it's a\n PointField or a PolygonField). Thus, this routine queries the PostGIS\n metadata tables to determine the geometry type,\n \"\"\"\n cursor = self.connection.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Expr_L52_C8", "label": "expression", "type": "expression", "loc": [52, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L51_C4", "vector": [8, 2, 0.5737, 0.0632, 2, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n The geometry type OID used by PostGIS does not indicate the particular\n type of field that a geometry column is (e.g., whether it's a\n PointField or a PolygonField). Thus, this routine queries the PostGIS\n metadata tables to determine the geometry type,\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L58_C8", "label": "cursor = cursor()", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L51_C4", "vector": [14, 2, 0.6105, 0.0105, 2, 0.73, 0.3333, 231, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cursor", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cursor = self.connection.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L59_C8", "label": "try", "type": "try", "loc": [59, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L51_C4", "vector": [7, 2, 0.8, 0.3684, 2, 0.73, 0.6667, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n try:\n # First seeing if this geometry column is in the `geometry_columns`\n cursor.execute('SELECT \"coord_dimension\", \"srid\", \"type\" '\n 'FROM \"geometry_columns\" '\n 'WHERE \"f_table_name\"=%s AND \"f_geometry_column\"=%s',\n (table_name, geo_col))\n row = cursor.fetchone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L60_C12", "label": "try", "type": "try", "loc": [60, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L59_C8", "vector": [7, 3, 0.7053, 0.1579, 3, 0.42, 0.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # First seeing if this geometry column is in the `geometry_columns`\n cursor.execute('SELECT \"coord_dimension\", \"srid\", \"type\" '\n 'FROM \"geometry_columns\" '\n 'WHERE \"f_table_name\"=%s AND \"f_geometry_column\"=%s',\n (table_name, geo_col))\n row = cursor.fetchone()\n if not row: raise GeoIntrospectionError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Expr_L62_C16", "label": "execute()", "type": "expression", "loc": [62, 65], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L60_C12", "vector": [8, 4, 0.6684, 0.0421, 4, 0.25, 0.0, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cursor.execute('SELECT \"coord_dimension\", \"srid\", \"type\" '\n 'FROM \"geometry_columns\" '\n 'WHERE \"f_table_name\"=%s AND \"f_geometry_column\"=%s',\n (table_name, geo_col))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L66_C16", "label": "row = fetchone()", "type": "assigned_variable", "loc": [66, 66], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L60_C12", "vector": [14, 4, 0.6947, 0.0105, 4, 0.25, 0.5, 767, 3, 0, 0, 0, 561, 10, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "fetchone", "annotation": ""}, "snippet": " row = cursor.fetchone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L67_C16", "label": "if", "type": "if", "loc": [67, 67], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L60_C12", "vector": [4, 4, 0.7053, 0.0105, 4, 0.25, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not row: raise GeoIntrospectionError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L69_C16", "label": "if", "type": "if", "loc": [69, 74], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L60_C12", "vector": [4, 4, 0.7526, 0.0632, 4, 0.25, 0.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.connection.ops.geography:\n cursor.execute('SELECT \"coord_dimension\", \"srid\", \"type\" '\n 'FROM \"geography_columns\" '\n 'WHERE \"f_table_name\"=%s AND \"f_geography_column\"=%s',\n (table_name, geo_col))\n row = cursor.fetchone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Expr_L70_C20", "label": "execute()", "type": "expression", "loc": [70, 73], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L69_C16", "vector": [8, 5, 0.7526, 0.0421, 5, 0.89, 0.0, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cursor.execute('SELECT \"coord_dimension\", \"srid\", \"type\" '\n 'FROM \"geography_columns\" '\n 'WHERE \"f_table_name\"=%s AND \"f_geography_column\"=%s',\n (table_name, geo_col))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L74_C20", "label": "row = fetchone()", "type": "assigned_variable", "loc": [74, 74], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L69_C16", "vector": [14, 5, 0.7789, 0.0105, 5, 0.89, 1.0, 767, 3, 0, 0, 0, 561, 10, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "fetchone", "annotation": ""}, "snippet": " row = cursor.fetchone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L76_C12", "label": "if", "type": "if", "loc": [76, 78], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L59_C8", "vector": [4, 3, 0.8105, 0.0316, 3, 0.42, 0.125, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not row:\n raise Exception('Could not find a geometry or geography column for \"%s\".\"%s\"' %\n (table_name, geo_col))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L82_C12", "label": "field_type =", "type": "assigned_variable", "loc": [82, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L59_C8", "vector": [14, 3, 0.8632, 0.0105, 3, 0.42, 0.25, 954, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "field_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " field_type = OGRGeomType(row[2]).django"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L85_C12", "label": "dim =", "type": "assigned_variable", "loc": [85, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L59_C8", "vector": [14, 3, 0.8947, 0.0105, 3, 0.42, 0.375, 596, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dim", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dim = row[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L86_C12", "label": "srid =", "type": "assigned_variable", "loc": [86, 86], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L59_C8", "vector": [14, 3, 0.9053, 0.0105, 3, 0.42, 0.5, 357, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "srid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " srid = row[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L87_C12", "label": "field_params =", "type": "assigned_variable", "loc": [87, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L59_C8", "vector": [14, 3, 0.9158, 0.0105, 3, 0.42, 0.625, 388, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "field_params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " field_params = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L88_C12", "label": "if", "type": "if", "loc": [88, 89], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L59_C8", "vector": [4, 3, 0.9316, 0.0211, 3, 0.42, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if srid != 4326:\n field_params['srid'] = srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L89_C16", "label": "assign", "type": "assigned_variable", "loc": [89, 89], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L88_C12", "vector": [14, 4, 0.9368, 0.0105, 4, 0.44, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " field_params['srid'] = srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L90_C12", "label": "if", "type": "if", "loc": [90, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L59_C8", "vector": [4, 3, 0.9526, 0.0211, 3, 0.42, 0.875, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if dim != 2:\n field_params['dim'] = dim"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L91_C16", "label": "assign", "type": "assigned_variable", "loc": [91, 91], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L90_C12", "vector": [14, 4, 0.9579, 0.0105, 4, 0.77, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " field_params['dim'] = dim"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Expr_L93_C12", "label": "close()", "type": "expression", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L59_C8", "vector": [8, 3, 0.9789, 0.0105, 3, 0.42, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cursor.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98774:Return_L95_C8", "label": "return", "type": "return", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L51_C4", "vector": [13, 2, 1.0, 0.0105, 2, 0.73, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return field_type, field_params"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98774:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Expr_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L24_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Expr_L25_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L24_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L26_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L24_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L27_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L24_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L28_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L28_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Expr_L29_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L28_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L30_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L28_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L34_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L24_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Expr_L36_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Return_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Expr_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Return_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Expr_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L60_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L60_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Expr_L62_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L60_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L66_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L60_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L67_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L60_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L69_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L69_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Expr_L70_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L69_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L74_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L76_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L82_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L85_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L86_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L87_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L88_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L88_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L89_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L90_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:If_L90_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L91_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:Try_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Expr_L93_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Return_L95_C8"}] |
"""
This object provides quoting for GEOS geometries into PostgreSQL/PostGIS.
"""
from psycopg2 import Binary
from psycopg2.extensions import ISQLQuote
class PostGISAdapter(object):
def __init__(self, geom):
"Initializes on the geometry."
# Getting the WKB (in string form, to allow easy pickling of
# the adaptor) and the SRID from the geometry.
self.ewkb = str(geom.ewkb)
self.srid = geom.srid
def __conform__(self, proto):
# Does the given protocol conform to what Psycopg2 expects?
if proto == ISQLQuote:
return self
else:
raise Exception('Error implementing psycopg2 protocol. Is psycopg2 installed?')
def __eq__(self, other):
return (self.ewkb == other.ewkb) and (self.srid == other.srid)
def __str__(self):
return self.getquoted()
def getquoted(self):
"Returns a properly quoted string for use in PostgreSQL/PostGIS."
# Want to use WKB, so wrap with psycopg2 Binary() to quote properly.
return 'ST_GeomFromEWKB(E%s)' % Binary(self.ewkb)
def prepare_database_save(self, unused):
return self
| ajibawa-2023/Python-Code-Large/train/row_98775 | 20 | 35 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98775:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0571, 0.0857, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n This object provides quoting for GEOS geometries into PostgreSQL/PostGIS.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98775:ImportFrom_L5_C0", "label": "from psycopg2 import Binary", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0286, 0, 0.66, 0.3333, 202, 0, 1, 0, 0, 202, 0, 0], "semantic": {"name": "psycopg2", "arg_names": [], "import_names": ["Binary"], "rhs_call_name": "", "annotation": ""}, "snippet": "from psycopg2 import Binary"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98775:ImportFrom_L6_C0", "label": "from psycopg2.extensions import ISQLQuote", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1714, 0.0286, 0, 0.66, 0.6667, 928, 0, 1, 0, 0, 928, 0, 0], "semantic": {"name": "psycopg2.extensions", "arg_names": [], "import_names": ["ISQLQuote"], "rhs_call_name": "", "annotation": ""}, "snippet": "from psycopg2.extensions import ISQLQuote"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98775:ClassDef_L8_C0", "label": "PostGISAdapter", "type": "class", "loc": [8, 35], "level": 0, "parent": null, "vector": [3, 0, 0.6143, 0.8, 0, 0.66, 1.0, 876, 0, 6, 0, 0, 186, 0, 4], "semantic": {"name": "PostGISAdapter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PostGISAdapter(object):\n def __init__(self, geom):\n \"Initializes on the geometry.\"\n # Getting the WKB (in string form, to allow easy pickling of\n # the adaptor) and the SRID from the geometry.\n self.ewkb = str(geom.ewkb)\n self.srid = geom.srid\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L9_C4", "label": "__init__", "type": "function", "loc": [9, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98775:ClassDef_L8_C0", "vector": [2, 1, 0.3286, 0.1714, 1, 0.98, 0.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "geom"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, geom):\n \"Initializes on the geometry.\"\n # Getting the WKB (in string form, to allow easy pickling of\n # the adaptor) and the SRID from the geometry.\n self.ewkb = str(geom.ewkb)\n self.srid = geom.srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98775:Expr_L10_C8", "label": "expression", "type": "expression", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L9_C4", "vector": [8, 2, 0.2857, 0.0286, 2, 0.03, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Initializes on the geometry.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98775:Assign_L13_C8", "label": "self.ewkb = str()", "type": "assigned_variable", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L9_C4", "vector": [14, 2, 0.3714, 0.0286, 2, 0.03, 0.5, 384, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "self.ewkb", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " self.ewkb = str(geom.ewkb)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98775:Assign_L14_C8", "label": "self.srid =", "type": "assigned_variable", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L9_C4", "vector": [14, 2, 0.4, 0.0286, 2, 0.03, 1.0, 289, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.srid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.srid = geom.srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L16_C4", "label": "__conform__", "type": "function", "loc": [16, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98775:ClassDef_L8_C0", "vector": [2, 1, 0.5286, 0.1714, 1, 0.98, 0.2, 753, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__conform__", "arg_names": ["self", "proto"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __conform__(self, proto):\n # Does the given protocol conform to what Psycopg2 expects?\n if proto == ISQLQuote:\n return self\n else:\n raise Exception('Error implementing psycopg2 protocol. Is psycopg2 installed?')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98775:If_L18_C8", "label": "if", "type": "if", "loc": [18, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L16_C4", "vector": [4, 2, 0.5571, 0.1143, 2, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if proto == ISQLQuote:\n return self\n else:\n raise Exception('Error implementing psycopg2 protocol. Is psycopg2 installed?')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98775:Return_L19_C12", "label": "return", "type": "return", "loc": [19, 19], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98775:If_L18_C8", "vector": [13, 3, 0.5429, 0.0286, 3, 0.44, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L23_C4", "label": "__eq__", "type": "function", "loc": [23, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98775:ClassDef_L8_C0", "vector": [2, 1, 0.6714, 0.0571, 1, 0.98, 0.4, 763, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__eq__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __eq__(self, other):\n return (self.ewkb == other.ewkb) and (self.srid == other.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98775:Return_L24_C8", "label": "return", "type": "return", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L23_C4", "vector": [13, 2, 0.6857, 0.0286, 2, 0.35, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (self.ewkb == other.ewkb) and (self.srid == other.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L26_C4", "label": "__str__", "type": "function", "loc": [26, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98775:ClassDef_L8_C0", "vector": [2, 1, 0.7571, 0.0571, 1, 0.98, 0.6, 527, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n return self.getquoted()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98775:Return_L27_C8", "label": "return", "type": "return", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L26_C4", "vector": [13, 2, 0.7714, 0.0286, 2, 0.82, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.getquoted()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L29_C4", "label": "getquoted", "type": "function", "loc": [29, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98775:ClassDef_L8_C0", "vector": [2, 1, 0.8714, 0.1143, 1, 0.98, 0.8, 94, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "getquoted", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def getquoted(self):\n \"Returns a properly quoted string for use in PostgreSQL/PostGIS.\"\n # Want to use WKB, so wrap with psycopg2 Binary() to quote properly.\n return 'ST_GeomFromEWKB(E%s)' % Binary(self.ewkb)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98775:Expr_L30_C8", "label": "expression", "type": "expression", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L29_C4", "vector": [8, 2, 0.8571, 0.0286, 2, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns a properly quoted string for use in PostgreSQL/PostGIS.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98775:Return_L32_C8", "label": "return", "type": "return", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L29_C4", "vector": [13, 2, 0.9143, 0.0286, 2, 0.76, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'ST_GeomFromEWKB(E%s)' % Binary(self.ewkb)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L34_C4", "label": "prepare_database_save", "type": "function", "loc": [34, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98775:ClassDef_L8_C0", "vector": [2, 1, 0.9857, 0.0571, 1, 0.98, 1.0, 536, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "prepare_database_save", "arg_names": ["self", "unused"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def prepare_database_save(self, unused):\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98775:Return_L35_C8", "label": "return", "type": "return", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L34_C4", "vector": [13, 2, 1.0, 0.0286, 2, 0.29, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98775:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98775:Expr_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98775:Assign_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98775:Assign_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98775:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98775:If_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98775:If_L18_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98775:Return_L19_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98775:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98775:Return_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98775:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98775:Return_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98775:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98775:Expr_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98775:Return_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98775:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98775:Return_L35_C8"}] |
"""
The GeometryColumns and SpatialRefSys models for the PostGIS backend.
"""
from django.db import models
from django.contrib.gis.db.backends.base import SpatialRefSysMixin
class GeometryColumns(models.Model):
"""
The 'geometry_columns' table from the PostGIS. See the PostGIS
documentation at Ch. 4.2.2.
"""
f_table_catalog = models.CharField(max_length=256)
f_table_schema = models.CharField(max_length=256)
f_table_name = models.CharField(max_length=256)
f_geometry_column = models.CharField(max_length=256)
coord_dimension = models.IntegerField()
srid = models.IntegerField(primary_key=True)
type = models.CharField(max_length=30)
class Meta:
db_table = 'geometry_columns'
managed = False
@classmethod
def table_name_col(cls):
"""
Returns the name of the metadata column used to store the
the feature table name.
"""
return 'f_table_name'
@classmethod
def geom_col_name(cls):
"""
Returns the name of the metadata column used to store the
the feature geometry column.
"""
return 'f_geometry_column'
def __unicode__(self):
return "%s.%s - %dD %s field (SRID: %d)" % \
(self.f_table_name, self.f_geometry_column,
self.coord_dimension, self.type, self.srid)
class SpatialRefSys(models.Model, SpatialRefSysMixin):
"""
The 'spatial_ref_sys' table from PostGIS. See the PostGIS
documentaiton at Ch. 4.2.1.
"""
srid = models.IntegerField(primary_key=True)
auth_name = models.CharField(max_length=256)
auth_srid = models.IntegerField()
srtext = models.CharField(max_length=2048)
proj4text = models.CharField(max_length=2048)
class Meta:
db_table = 'spatial_ref_sys'
managed = False
@property
def wkt(self):
return self.srtext
@classmethod
def wkt_col(cls):
return 'srtext'
| ajibawa-2023/Python-Code-Large/train/row_98776 | 37 | 66 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0303, 0.0455, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n The GeometryColumns and SpatialRefSys models for the PostGIS backend.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:ImportFrom_L4_C0", "label": "from django.db import models", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0606, 0.0152, 0, 0.66, 0.25, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["models"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db import models"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:ImportFrom_L5_C0", "label": "from django.contrib.gis.db.backends.base import SpatialRefSysMixin", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0758, 0.0152, 0, 0.66, 0.5, 157, 0, 1, 0, 0, 157, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.base", "arg_names": [], "import_names": ["SpatialRefSysMixin"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.backends.base import SpatialRefSysMixin"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "label": "GeometryColumns", "type": "class", "loc": [7, 43], "level": 0, "parent": null, "vector": [3, 0, 0.3788, 0.5606, 0, 0.66, 0.75, 250, 0, 3, 0, 0, 996, 0, 7], "semantic": {"name": "GeometryColumns", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GeometryColumns(models.Model):\n \"\"\"\n The 'geometry_columns' table from the PostGIS. See the PostGIS\n documentation at Ch. 4.2.2.\n \"\"\"\n f_table_catalog = models.CharField(max_length=256)\n f_table_schema = models.CharField(max_length=256)\n f_table_name = models.CharField(max_length=256)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Expr_L8_C4", "label": "expression", "type": "expression", "loc": [8, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "vector": [8, 1, 0.1439, 0.0606, 1, 0.82, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n The 'geometry_columns' table from the PostGIS. See the PostGIS\n documentation at Ch. 4.2.2.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L12_C4", "label": "f_table_catalog = CharField()", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "vector": [14, 1, 0.1818, 0.0152, 1, 0.82, 0.0909, 490, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "f_table_catalog", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " f_table_catalog = models.CharField(max_length=256)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L13_C4", "label": "f_table_schema = CharField()", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "vector": [14, 1, 0.197, 0.0152, 1, 0.82, 0.1818, 492, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "f_table_schema", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " f_table_schema = models.CharField(max_length=256)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L14_C4", "label": "f_table_name = CharField()", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "vector": [14, 1, 0.2121, 0.0152, 1, 0.82, 0.2727, 900, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "f_table_name", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " f_table_name = models.CharField(max_length=256)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L15_C4", "label": "f_geometry_column = CharField()", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "vector": [14, 1, 0.2273, 0.0152, 1, 0.82, 0.3636, 893, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "f_geometry_column", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " f_geometry_column = models.CharField(max_length=256)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L16_C4", "label": "coord_dimension = IntegerField()", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "vector": [14, 1, 0.2424, 0.0152, 1, 0.82, 0.4545, 2, 3, 0, 0, 0, 877, 10, 1], "semantic": {"name": "coord_dimension", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerField", "annotation": ""}, "snippet": " coord_dimension = models.IntegerField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L17_C4", "label": "srid = IntegerField()", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "vector": [14, 1, 0.2576, 0.0152, 1, 0.82, 0.5455, 357, 3, 1, 0, 0, 877, 10, 1], "semantic": {"name": "srid", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerField", "annotation": ""}, "snippet": " srid = models.IntegerField(primary_key=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L18_C4", "label": "type = CharField()", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "vector": [14, 1, 0.2727, 0.0152, 1, 0.82, 0.6364, 801, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " type = models.CharField(max_length=30)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L20_C4", "label": "Meta", "type": "class", "loc": [20, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "vector": [3, 1, 0.3182, 0.0455, 1, 0.82, 0.7273, 130, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta:\n db_table = 'geometry_columns'\n managed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L21_C8", "label": "db_table =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L20_C4", "vector": [14, 2, 0.3182, 0.0152, 2, 0.81, 0.0, 111, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "db_table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " db_table = 'geometry_columns'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L22_C8", "label": "managed =", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L20_C4", "vector": [14, 2, 0.3333, 0.0152, 2, 0.81, 1.0, 503, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "managed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " managed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:FunctionDef_L25_C4", "label": "table_name_col", "type": "function", "loc": [25, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "vector": [2, 1, 0.4167, 0.0909, 1, 0.82, 0.8182, 702, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "table_name_col", "arg_names": ["cls"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def table_name_col(cls):\n \"\"\"\n Returns the name of the metadata column used to store the\n the feature table name.\n \"\"\"\n return 'f_table_name'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Expr_L26_C8", "label": "expression", "type": "expression", "loc": [26, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:FunctionDef_L25_C4", "vector": [8, 2, 0.4167, 0.0606, 2, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the name of the metadata column used to store the\n the feature table name.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Return_L30_C8", "label": "return", "type": "return", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:FunctionDef_L25_C4", "vector": [13, 2, 0.4545, 0.0152, 2, 0.13, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'f_table_name'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:FunctionDef_L33_C4", "label": "geom_col_name", "type": "function", "loc": [33, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "vector": [2, 1, 0.5379, 0.0909, 1, 0.82, 0.9091, 835, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "geom_col_name", "arg_names": ["cls"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geom_col_name(cls):\n \"\"\"\n Returns the name of the metadata column used to store the\n the feature geometry column.\n \"\"\"\n return 'f_geometry_column'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Expr_L34_C8", "label": "expression", "type": "expression", "loc": [34, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:FunctionDef_L33_C4", "vector": [8, 2, 0.5379, 0.0606, 2, 0.24, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the name of the metadata column used to store the\n the feature geometry column.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Return_L38_C8", "label": "return", "type": "return", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:FunctionDef_L33_C4", "vector": [13, 2, 0.5758, 0.0152, 2, 0.24, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'f_geometry_column'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:FunctionDef_L40_C4", "label": "__unicode__", "type": "function", "loc": [40, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "vector": [2, 1, 0.6288, 0.0606, 1, 0.82, 1.0, 318, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__unicode__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __unicode__(self):\n return \"%s.%s - %dD %s field (SRID: %d)\" % \\\n (self.f_table_name, self.f_geometry_column,\n self.coord_dimension, self.type, self.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Return_L41_C8", "label": "return", "type": "return", "loc": [41, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:FunctionDef_L40_C4", "vector": [13, 2, 0.6364, 0.0455, 2, 0.12, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"%s.%s - %dD %s field (SRID: %d)\" % \\\n (self.f_table_name, self.f_geometry_column,\n self.coord_dimension, self.type, self.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L45_C0", "label": "SpatialRefSys", "type": "class", "loc": [45, 66], "level": 0, "parent": null, "vector": [3, 0, 0.8409, 0.3333, 0, 0.66, 1.0, 219, 0, 2, 0, 0, 996, 0, 5], "semantic": {"name": "SpatialRefSys", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SpatialRefSys(models.Model, SpatialRefSysMixin):\n \"\"\"\n The 'spatial_ref_sys' table from PostGIS. See the PostGIS\n documentaiton at Ch. 4.2.1.\n \"\"\"\n srid = models.IntegerField(primary_key=True)\n auth_name = models.CharField(max_length=256)\n auth_srid = models.IntegerField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Expr_L46_C4", "label": "expression", "type": "expression", "loc": [46, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L45_C0", "vector": [8, 1, 0.7197, 0.0606, 1, 0.0, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n The 'spatial_ref_sys' table from PostGIS. See the PostGIS\n documentaiton at Ch. 4.2.1.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L50_C4", "label": "srid = IntegerField()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L45_C0", "vector": [14, 1, 0.7576, 0.0152, 1, 0.0, 0.125, 357, 3, 1, 0, 0, 877, 10, 1], "semantic": {"name": "srid", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerField", "annotation": ""}, "snippet": " srid = models.IntegerField(primary_key=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L51_C4", "label": "auth_name = CharField()", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L45_C0", "vector": [14, 1, 0.7727, 0.0152, 1, 0.0, 0.25, 454, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "auth_name", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " auth_name = models.CharField(max_length=256)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L52_C4", "label": "auth_srid = IntegerField()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L45_C0", "vector": [14, 1, 0.7879, 0.0152, 1, 0.0, 0.375, 568, 3, 0, 0, 0, 877, 10, 1], "semantic": {"name": "auth_srid", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerField", "annotation": ""}, "snippet": " auth_srid = models.IntegerField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L53_C4", "label": "srtext = CharField()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L45_C0", "vector": [14, 1, 0.803, 0.0152, 1, 0.0, 0.5, 603, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "srtext", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " srtext = models.CharField(max_length=2048)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L54_C4", "label": "proj4text = CharField()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L45_C0", "vector": [14, 1, 0.8182, 0.0152, 1, 0.0, 0.625, 662, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "proj4text", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " proj4text = models.CharField(max_length=2048)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L56_C4", "label": "Meta", "type": "class", "loc": [56, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L45_C0", "vector": [3, 1, 0.8636, 0.0455, 1, 0.0, 0.75, 130, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta:\n db_table = 'spatial_ref_sys'\n managed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L57_C8", "label": "db_table =", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L56_C4", "vector": [14, 2, 0.8636, 0.0152, 2, 0.11, 0.0, 111, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "db_table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " db_table = 'spatial_ref_sys'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L58_C8", "label": "managed =", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L56_C4", "vector": [14, 2, 0.8788, 0.0152, 2, 0.11, 1.0, 503, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "managed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " managed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:FunctionDef_L61_C4", "label": "wkt", "type": "function", "loc": [61, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L45_C0", "vector": [2, 1, 0.9318, 0.0303, 1, 0.0, 0.875, 836, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "wkt", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wkt(self):\n return self.srtext"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Return_L62_C8", "label": "return", "type": "return", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:FunctionDef_L61_C4", "vector": [13, 2, 0.9394, 0.0152, 2, 0.03, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.srtext"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:FunctionDef_L65_C4", "label": "wkt_col", "type": "function", "loc": [65, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L45_C0", "vector": [2, 1, 0.9924, 0.0303, 1, 0.0, 1.0, 556, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "wkt_col", "arg_names": ["cls"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wkt_col(cls):\n return 'srtext'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98776:Return_L66_C8", "label": "return", "type": "return", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98776:FunctionDef_L65_C4", "vector": [13, 2, 1.0, 0.0152, 2, 0.96, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'srtext'"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Return_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:FunctionDef_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Expr_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Return_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:FunctionDef_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Return_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:FunctionDef_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Return_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:FunctionDef_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:FunctionDef_L65_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Return_L66_C8"}] |
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.gis.geometry.backend import Geometry
from django.contrib.gis.measure import Distance
from django.core.exceptions import ImproperlyConfigured
from django.db.backends.postgresql_psycopg2.base import DatabaseOperations
from django.db.utils import DatabaseError
#### Classes used in constructing PostGIS spatial SQL ####
class PostGISOperator(SpatialOperation):
"For PostGIS operators (e.g. `&&`, `~`)."
def __init__(self, operator):
super(PostGISOperator, self).__init__(operator=operator)
class PostGISFunction(SpatialFunction):
"For PostGIS function calls (e.g., `ST_Contains(table, geom)`)."
def __init__(self, prefix, function, **kwargs):
super(PostGISFunction, self).__init__(prefix + function, **kwargs)
class PostGISFunctionParam(PostGISFunction):
"For PostGIS functions that take another parameter (e.g. DWithin, Relate)."
sql_template = '%(function)s(%(geo_col)s, %(geometry)s, %%s)'
class PostGISDistance(PostGISFunction):
"For PostGIS distance operations."
dist_func = 'Distance'
sql_template = '%(function)s(%(geo_col)s, %(geometry)s) %(operator)s %%s'
def __init__(self, prefix, operator):
super(PostGISDistance, self).__init__(prefix, self.dist_func,
operator=operator)
class PostGISSpheroidDistance(PostGISFunction):
"For PostGIS spherical distance operations (using the spheroid)."
dist_func = 'distance_spheroid'
sql_template = '%(function)s(%(geo_col)s, %(geometry)s, %%s) %(operator)s %%s'
def __init__(self, prefix, operator):
# An extra parameter in `end_subst` is needed for the spheroid string.
super(PostGISSpheroidDistance, self).__init__(prefix, self.dist_func,
operator=operator)
class PostGISSphereDistance(PostGISDistance):
"For PostGIS spherical distance operations."
dist_func = 'distance_sphere'
class PostGISRelate(PostGISFunctionParam):
"For PostGIS Relate(<geom>, <pattern>) calls."
pattern_regex = re.compile(r'^[012TF\*]{9}$')
def __init__(self, prefix, pattern):
if not self.pattern_regex.match(pattern):
raise ValueError('Invalid intersection matrix pattern "%s".' % pattern)
super(PostGISRelate, self).__init__(prefix, 'Relate')
class PostGISOperations(DatabaseOperations, BaseSpatialOperations):
compiler_module = 'django.contrib.gis.db.models.sql.compiler'
name = 'postgis'
postgis = True
version_regex = re.compile(r'^(?P<major>\d)\.(?P<minor1>\d)\.(?P<minor2>\d+)')
valid_aggregates = dict([(k, None) for k in
('Collect', 'Extent', 'Extent3D', 'MakeLine', 'Union')])
Adapter = PostGISAdapter
Adaptor = Adapter # Backwards-compatibility alias.
def __init__(self, connection):
super(PostGISOperations, self).__init__(connection)
# Trying to get the PostGIS version because the function
# signatures will depend on the version used. The cost
# here is a database query to determine the version, which
# can be mitigated by setting `POSTGIS_VERSION` with a 3-tuple
# comprising user-supplied values for the major, minor, and
# subminor revision of PostGIS.
try:
if hasattr(settings, 'POSTGIS_VERSION'):
vtup = settings.POSTGIS_VERSION
if len(vtup) == 3:
# The user-supplied PostGIS version.
version = vtup
else:
# This was the old documented way, but it's stupid to
# include the string.
version = vtup[1:4]
else:
vtup = self.postgis_version_tuple()
version = vtup[1:]
# Getting the prefix -- even though we don't officially support
# PostGIS 1.2 anymore, keeping it anyway in case a prefix change
# for something else is necessary.
if version >= (1, 2, 2):
prefix = 'ST_'
else:
prefix = ''
self.geom_func_prefix = prefix
self.spatial_version = version
except DatabaseError:
raise ImproperlyConfigured('Cannot determine PostGIS version for database "%s". '
'GeoDjango requires at least PostGIS version 1.3. '
'Was the database created from a spatial database '
'template?' % self.connection.settings_dict['NAME']
)
except Exception, e:
# TODO: Raise helpful exceptions as they become known.
raise
# PostGIS-specific operators. The commented descriptions of these
# operators come from Section 7.6 of the PostGIS 1.4 documentation.
self.geometry_operators = {
# The "&<" operator returns true if A's bounding box overlaps or
# is to the left of B's bounding box.
'overlaps_left' : PostGISOperator('&<'),
# The "&>" operator returns true if A's bounding box overlaps or
# is to the right of B's bounding box.
'overlaps_right' : PostGISOperator('&>'),
# The "<<" operator returns true if A's bounding box is strictly
# to the left of B's bounding box.
'left' : PostGISOperator('<<'),
# The ">>" operator returns true if A's bounding box is strictly
# to the right of B's bounding box.
'right' : PostGISOperator('>>'),
# The "&<|" operator returns true if A's bounding box overlaps or
# is below B's bounding box.
'overlaps_below' : PostGISOperator('&<|'),
# The "|&>" operator returns true if A's bounding box overlaps or
# is above B's bounding box.
'overlaps_above' : PostGISOperator('|&>'),
# The "<<|" operator returns true if A's bounding box is strictly
# below B's bounding box.
'strictly_below' : PostGISOperator('<<|'),
# The "|>>" operator returns true if A's bounding box is strictly
# above B's bounding box.
'strictly_above' : PostGISOperator('|>>'),
# The "~=" operator is the "same as" operator. It tests actual
# geometric equality of two features. So if A and B are the same feature,
# vertex-by-vertex, the operator returns true.
'same_as' : PostGISOperator('~='),
'exact' : PostGISOperator('~='),
# The "@" operator returns true if A's bounding box is completely contained
# by B's bounding box.
'contained' : PostGISOperator('@'),
# The "~" operator returns true if A's bounding box completely contains
# by B's bounding box.
'bbcontains' : PostGISOperator('~'),
# The "&&" operator returns true if A's bounding box overlaps
# B's bounding box.
'bboverlaps' : PostGISOperator('&&'),
}
self.geometry_functions = {
'equals' : PostGISFunction(prefix, 'Equals'),
'disjoint' : PostGISFunction(prefix, 'Disjoint'),
'touches' : PostGISFunction(prefix, 'Touches'),
'crosses' : PostGISFunction(prefix, 'Crosses'),
'within' : PostGISFunction(prefix, 'Within'),
'overlaps' : PostGISFunction(prefix, 'Overlaps'),
'contains' : PostGISFunction(prefix, 'Contains'),
'intersects' : PostGISFunction(prefix, 'Intersects'),
'relate' : (PostGISRelate, basestring),
}
# Valid distance types and substitutions
dtypes = (Decimal, Distance, float, int, long)
def get_dist_ops(operator):
"Returns operations for both regular and spherical distances."
return {'cartesian' : PostGISDistance(prefix, operator),
'sphere' : PostGISSphereDistance(prefix, operator),
'spheroid' : PostGISSpheroidDistance(prefix, operator),
}
self.distance_functions = {
'distance_gt' : (get_dist_ops('>'), dtypes),
'distance_gte' : (get_dist_ops('>='), dtypes),
'distance_lt' : (get_dist_ops('<'), dtypes),
'distance_lte' : (get_dist_ops('<='), dtypes),
}
# Versions 1.2.2+ have KML serialization support.
if version < (1, 2, 2):
ASKML = False
else:
ASKML = 'ST_AsKML'
self.geometry_functions.update(
{'coveredby' : PostGISFunction(prefix, 'CoveredBy'),
'covers' : PostGISFunction(prefix, 'Covers'),
})
self.distance_functions['dwithin'] = (PostGISFunctionParam(prefix, 'DWithin'), dtypes)
# Adding the distance functions to the geometries lookup.
self.geometry_functions.update(self.distance_functions)
# The union aggregate and topology operation use the same signature
# in versions 1.3+.
if version < (1, 3, 0):
UNIONAGG = 'GeomUnion'
UNION = 'Union'
MAKELINE = False
else:
UNIONAGG = 'ST_Union'
UNION = 'ST_Union'
MAKELINE = 'ST_MakeLine'
# Only PostGIS versions 1.3.4+ have GeoJSON serialization support.
if version < (1, 3, 4):
GEOJSON = False
else:
GEOJSON = prefix + 'AsGeoJson'
# ST_ContainsProperly ST_MakeLine, and ST_GeoHash added in 1.4.
if version >= (1, 4, 0):
GEOHASH = 'ST_GeoHash'
BOUNDINGCIRCLE = 'ST_MinimumBoundingCircle'
self.geometry_functions['contains_properly'] = PostGISFunction(prefix, 'ContainsProperly')
else:
GEOHASH, BOUNDINGCIRCLE = False, False
# Geography type support added in 1.5.
if version >= (1, 5, 0):
self.geography = True
# Only a subset of the operators and functions are available
# for the geography type.
self.geography_functions = self.distance_functions.copy()
self.geography_functions.update({
'coveredby' : self.geometry_functions['coveredby'],
'covers' : self.geometry_functions['covers'],
'intersects' : self.geometry_functions['intersects'],
})
self.geography_operators = {
'bboverlaps' : PostGISOperator('&&'),
}
# Creating a dictionary lookup of all GIS terms for PostGIS.
gis_terms = ['isnull']
gis_terms += self.geometry_operators.keys()
gis_terms += self.geometry_functions.keys()
self.gis_terms = dict([(term, None) for term in gis_terms])
self.area = prefix + 'Area'
self.bounding_circle = BOUNDINGCIRCLE
self.centroid = prefix + 'Centroid'
self.collect = prefix + 'Collect'
self.difference = prefix + 'Difference'
self.distance = prefix + 'Distance'
self.distance_sphere = prefix + 'distance_sphere'
self.distance_spheroid = prefix + 'distance_spheroid'
self.envelope = prefix + 'Envelope'
self.extent = prefix + 'Extent'
self.extent3d = prefix + 'Extent3D'
self.force_rhr = prefix + 'ForceRHR'
self.geohash = GEOHASH
self.geojson = GEOJSON
self.gml = prefix + 'AsGML'
self.intersection = prefix + 'Intersection'
self.kml = ASKML
self.length = prefix + 'Length'
self.length3d = prefix + 'Length3D'
self.length_spheroid = prefix + 'length_spheroid'
self.makeline = MAKELINE
self.mem_size = prefix + 'mem_size'
self.num_geom = prefix + 'NumGeometries'
self.num_points =prefix + 'npoints'
self.perimeter = prefix + 'Perimeter'
self.perimeter3d = prefix + 'Perimeter3D'
self.point_on_surface = prefix + 'PointOnSurface'
self.polygonize = prefix + 'Polygonize'
self.reverse = prefix + 'Reverse'
self.scale = prefix + 'Scale'
self.snap_to_grid = prefix + 'SnapToGrid'
self.svg = prefix + 'AsSVG'
self.sym_difference = prefix + 'SymDifference'
self.transform = prefix + 'Transform'
self.translate = prefix + 'Translate'
self.union = UNION
self.unionagg = UNIONAGG
def check_aggregate_support(self, aggregate):
"""
Checks if the given aggregate name is supported (that is, if it's
in `self.valid_aggregates`).
"""
agg_name = aggregate.__class__.__name__
return agg_name in self.valid_aggregates
def convert_extent(self, box):
"""
Returns a 4-tuple extent for the `Extent` aggregate by converting
the bounding box text returned by PostGIS (`box` argument), for
example: "BOX(-90.0 30.0, -85.0 40.0)".
"""
ll, ur = box[4:-1].split(',')
xmin, ymin = map(float, ll.split())
xmax, ymax = map(float, ur.split())
return (xmin, ymin, xmax, ymax)
def convert_extent3d(self, box3d):
"""
Returns a 6-tuple extent for the `Extent3D` aggregate by converting
the 3d bounding-box text returnded by PostGIS (`box3d` argument), for
example: "BOX3D(-90.0 30.0 1, -85.0 40.0 2)".
"""
ll, ur = box3d[6:-1].split(',')
xmin, ymin, zmin = map(float, ll.split())
xmax, ymax, zmax = map(float, ur.split())
return (xmin, ymin, zmin, xmax, ymax, zmax)
def convert_geom(self, hex, geo_field):
"""
Converts the geometry returned from PostGIS aggretates.
"""
if hex:
return Geometry(hex)
else:
return None
def geo_db_type(self, f):
"""
Return the database field type for the given geometry field.
Typically this is `None` because geometry columns are added via
the `AddGeometryColumn` stored procedure, unless the field
has been specified to be of geography type instead.
"""
if f.geography:
if not self.geography:
raise NotImplementedError('PostGIS 1.5 required for geography column support.')
if f.srid != 4326:
raise NotImplementedError('PostGIS 1.5 supports geography columns '
'only with an SRID of 4326.')
return 'geography(%s,%d)'% (f.geom_type, f.srid)
else:
return None
def get_distance(self, f, dist_val, lookup_type):
"""
Retrieve the distance parameters for the given geometry field,
distance lookup value, and the distance lookup type.
This is the most complex implementation of the spatial backends due to
what is supported on geodetic geometry columns vs. what's available on
projected geometry columns. In addition, it has to take into account
the newly introduced geography column type introudced in PostGIS 1.5.
"""
# Getting the distance parameter and any options.
if len(dist_val) == 1:
value, option = dist_val[0], None
else:
value, option = dist_val
# Shorthand boolean flags.
geodetic = f.geodetic(self.connection)
geography = f.geography and self.geography
if isinstance(value, Distance):
if geography:
dist_param = value.m
elif geodetic:
if lookup_type == 'dwithin':
raise ValueError('Only numeric values of degree units are '
'allowed on geographic DWithin queries.')
dist_param = value.m
else:
dist_param = getattr(value, Distance.unit_attname(f.units_name(self.connection)))
else:
# Assuming the distance is in the units of the field.
dist_param = value
if (not geography and geodetic and lookup_type != 'dwithin'
and option == 'spheroid'):
# using distance_spheroid requires the spheroid of the field as
# a parameter.
return [f._spheroid, dist_param]
else:
return [dist_param]
def get_geom_placeholder(self, f, value):
"""
Provides a proper substitution value for Geometries that are not in the
SRID of the field. Specifically, this routine will substitute in the
ST_Transform() function call.
"""
if value is None or value.srid == f.srid:
placeholder = '%s'
else:
# Adding Transform() to the SQL placeholder.
placeholder = '%s(%%s, %s)' % (self.transform, f.srid)
if hasattr(value, 'expression'):
# If this is an F expression, then we don't really want
# a placeholder and instead substitute in the column
# of the expression.
placeholder = placeholder % '%s.%s' % tuple(map(self.quote_name, value.cols[value.expression]))
return placeholder
def _get_postgis_func(self, func):
"""
Helper routine for calling PostGIS functions and returning their result.
"""
cursor = self.connection._cursor()
try:
try:
cursor.execute('SELECT %s()' % func)
row = cursor.fetchone()
except:
# Responsibility of callers to perform error handling.
raise
finally:
# Close out the connection. See #9437.
self.connection.close()
return row[0]
def postgis_geos_version(self):
"Returns the version of the GEOS library used with PostGIS."
return self._get_postgis_func('postgis_geos_version')
def postgis_lib_version(self):
"Returns the version number of the PostGIS library used with PostgreSQL."
return self._get_postgis_func('postgis_lib_version')
def postgis_proj_version(self):
"Returns the version of the PROJ.4 library used with PostGIS."
return self._get_postgis_func('postgis_proj_version')
def postgis_version(self):
"Returns PostGIS version number and compile-time options."
return self._get_postgis_func('postgis_version')
def postgis_full_version(self):
"Returns PostGIS version number and compile-time options."
return self._get_postgis_func('postgis_full_version')
def postgis_version_tuple(self):
"""
Returns the PostGIS version as a tuple (version string, major,
minor, subminor).
"""
# Getting the PostGIS version
version = self.postgis_lib_version()
m = self.version_regex.match(version)
if m:
major = int(m.group('major'))
minor1 = int(m.group('minor1'))
minor2 = int(m.group('minor2'))
else:
raise Exception('Could not parse PostGIS version string: %s' % version)
return (version, major, minor1, minor2)
def proj_version_tuple(self):
"""
Return the version of PROJ.4 used by PostGIS as a tuple of the
major, minor, and subminor release numbers.
"""
proj_regex = re.compile(r'(\d+)\.(\d+)\.(\d+)')
proj_ver_str = self.postgis_proj_version()
m = proj_regex.search(proj_ver_str)
if m:
return tuple(map(int, [m.group(1), m.group(2), m.group(3)]))
else:
raise Exception('Could not determine PROJ.4 version from PostGIS.')
def num_params(self, lookup_type, num_param):
"""
Helper routine that returns a boolean indicating whether the number of
parameters is correct for the lookup type.
"""
def exactly_two(np): return np == 2
def two_to_three(np): return np >= 2 and np <=3
if (lookup_type in self.distance_functions and
lookup_type != 'dwithin'):
return two_to_three(num_param)
else:
return exactly_two(num_param)
def spatial_lookup_sql(self, lvalue, lookup_type, value, field, qn):
"""
Constructs spatial SQL from the given lookup value tuple a
(alias, col, db_type), the lookup type string, lookup value, and
the geometry field.
"""
alias, col, db_type = lvalue
# Getting the quoted geometry column.
geo_col = '%s.%s' % (qn(alias), qn(col))
if lookup_type in self.geometry_operators:
if field.geography and not lookup_type in self.geography_operators:
raise ValueError('PostGIS geography does not support the '
'"%s" lookup.' % lookup_type)
# Handling a PostGIS operator.
op = self.geometry_operators[lookup_type]
return op.as_sql(geo_col, self.get_geom_placeholder(field, value))
elif lookup_type in self.geometry_functions:
if field.geography and not lookup_type in self.geography_functions:
raise ValueError('PostGIS geography type does not support the '
'"%s" lookup.' % lookup_type)
# See if a PostGIS geometry function matches the lookup type.
tmp = self.geometry_functions[lookup_type]
# Lookup types that are tuples take tuple arguments, e.g., 'relate' and
# distance lookups.
if isinstance(tmp, tuple):
# First element of tuple is the PostGISOperation instance, and the
# second element is either the type or a tuple of acceptable types
# that may passed in as further parameters for the lookup type.
op, arg_type = tmp
# Ensuring that a tuple _value_ was passed in from the user
if not isinstance(value, (tuple, list)):
raise ValueError('Tuple required for `%s` lookup type.' % lookup_type)
# Geometry is first element of lookup tuple.
geom = value[0]
# Number of valid tuple parameters depends on the lookup type.
nparams = len(value)
if not self.num_params(lookup_type, nparams):
raise ValueError('Incorrect number of parameters given for `%s` lookup type.' % lookup_type)
# Ensuring the argument type matches what we expect.
if not isinstance(value[1], arg_type):
raise ValueError('Argument type should be %s, got %s instead.' % (arg_type, type(value[1])))
# For lookup type `relate`, the op instance is not yet created (has
# to be instantiated here to check the pattern parameter).
if lookup_type == 'relate':
op = op(self.geom_func_prefix, value[1])
elif lookup_type in self.distance_functions and lookup_type != 'dwithin':
if not field.geography and field.geodetic(self.connection):
# Geodetic distances are only availble from Points to
# PointFields on PostGIS 1.4 and below.
if not self.connection.ops.geography:
if field.geom_type != 'POINT':
raise ValueError('PostGIS spherical operations are only valid on PointFields.')
if str(geom.geom_type) != 'Point':
raise ValueError('PostGIS geometry distance parameter is required to be of type Point.')
# Setting up the geodetic operation appropriately.
if nparams == 3 and value[2] == 'spheroid':
op = op['spheroid']
else:
op = op['sphere']
else:
op = op['cartesian']
else:
op = tmp
geom = value
# Calling the `as_sql` function on the operation instance.
return op.as_sql(geo_col, self.get_geom_placeholder(field, geom))
elif lookup_type == 'isnull':
# Handling 'isnull' lookup type
return "%s IS %sNULL" % (geo_col, (not value and 'NOT ' or ''))
raise TypeError("Got invalid lookup_type: %s" % repr(lookup_type))
def spatial_aggregate_sql(self, agg):
"""
Returns the spatial aggregate SQL template and function for the
given Aggregate instance.
"""
agg_name = agg.__class__.__name__
if not self.check_aggregate_support(agg):
raise NotImplementedError('%s spatial aggregate is not implmented for this backend.' % agg_name)
agg_name = agg_name.lower()
if agg_name == 'union': agg_name += 'agg'
sql_template = '%(function)s(%(field)s)'
sql_function = getattr(self, agg_name)
return sql_template, sql_function
# Routines for getting the OGC-compliant models.
def geometry_columns(self):
from django.contrib.gis.db.backends.postgis.models import GeometryColumns
return GeometryColumns
def spatial_ref_sys(self):
from django.contrib.gis.db.backends.postgis.models import SpatialRefSys
return SpatialRefSys
| ajibawa-2023/Python-Code-Large/train/row_98777 | 290 | 588 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0017, 0.0017, 0, 0.66, 0.0, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:ImportFrom_L2_C0", "label": "from decimal import Decimal", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0034, 0.0017, 0, 0.66, 0.0556, 349, 0, 1, 0, 0, 349, 0, 0], "semantic": {"name": "decimal", "arg_names": [], "import_names": ["Decimal"], "rhs_call_name": "", "annotation": ""}, "snippet": "from decimal import Decimal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:ImportFrom_L4_C0", "label": "from django.conf import settings", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0068, 0.0017, 0, 0.66, 0.1111, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:ImportFrom_L5_C0", "label": "from django.contrib.gis.db.backends.base import BaseSpatialOperations", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0085, 0.0017, 0, 0.66, 0.1667, 157, 0, 1, 0, 0, 157, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.base", "arg_names": [], "import_names": ["BaseSpatialOperations"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.backends.base import BaseSpatialOperations"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:ImportFrom_L6_C0", "label": "from django.contrib.gis.db.backends.util import SpatialOperation, SpatialFunction", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0102, 0.0017, 0, 0.66, 0.2222, 674, 0, 2, 0, 0, 674, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.util", "arg_names": [], "import_names": ["SpatialOperation", "SpatialFunction"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.backends.util import SpatialOperation, SpatialFunction"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:ImportFrom_L7_C0", "label": "from django.contrib.gis.db.backends.postgis.adapter import PostGISAdapter", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0119, 0.0017, 0, 0.66, 0.2778, 726, 0, 1, 0, 0, 726, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.postgis.adapter", "arg_names": [], "import_names": ["PostGISAdapter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.backends.postgis.adapter import PostGISAdapter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:ImportFrom_L8_C0", "label": "from django.contrib.gis.geometry.backend import Geometry", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0136, 0.0017, 0, 0.66, 0.3333, 299, 0, 1, 0, 0, 299, 0, 0], "semantic": {"name": "django.contrib.gis.geometry.backend", "arg_names": [], "import_names": ["Geometry"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geometry.backend import Geometry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:ImportFrom_L9_C0", "label": "from django.contrib.gis.measure import Distance", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0153, 0.0017, 0, 0.66, 0.3889, 844, 0, 1, 0, 0, 844, 0, 0], "semantic": {"name": "django.contrib.gis.measure", "arg_names": [], "import_names": ["Distance"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.measure import Distance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:ImportFrom_L10_C0", "label": "from django.core.exceptions import ImproperlyConfigured", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.017, 0.0017, 0, 0.66, 0.4444, 160, 0, 1, 0, 0, 160, 0, 0], "semantic": {"name": "django.core.exceptions", "arg_names": [], "import_names": ["ImproperlyConfigured"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.exceptions import ImproperlyConfigured"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:ImportFrom_L11_C0", "label": "from django.db.backends.postgresql_psycopg2.base import DatabaseOperations", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0187, 0.0017, 0, 0.66, 0.5, 485, 0, 1, 0, 0, 485, 0, 0], "semantic": {"name": "django.db.backends.postgresql_psycopg2.base", "arg_names": [], "import_names": ["DatabaseOperations"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.backends.postgresql_psycopg2.base import DatabaseOperations"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:ImportFrom_L12_C0", "label": "from django.db.utils import DatabaseError", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0204, 0.0017, 0, 0.66, 0.5556, 495, 0, 1, 0, 0, 495, 0, 0], "semantic": {"name": "django.db.utils", "arg_names": [], "import_names": ["DatabaseError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.utils import DatabaseError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L15_C0", "label": "PostGISOperator", "type": "class", "loc": [15, 18], "level": 0, "parent": null, "vector": [3, 0, 0.0281, 0.0068, 0, 0.66, 0.6111, 796, 0, 1, 0, 0, 191, 0, 2], "semantic": {"name": "PostGISOperator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PostGISOperator(SpatialOperation):\n \"For PostGIS operators (e.g. `&&`, `~`).\"\n def __init__(self, operator):\n super(PostGISOperator, self).__init__(operator=operator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L16_C4", "label": "expression", "type": "expression", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L15_C0", "vector": [8, 1, 0.0272, 0.0017, 1, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"For PostGIS operators (e.g. `&&`, `~`).\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L17_C4", "label": "__init__", "type": "function", "loc": [17, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L15_C0", "vector": [2, 1, 0.0298, 0.0034, 1, 0.57, 1.0, 555, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "operator"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, operator):\n super(PostGISOperator, self).__init__(operator=operator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L18_C8", "label": "__init__()", "type": "expression", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L17_C4", "vector": [8, 2, 0.0306, 0.0017, 2, 0.75, 0.0, 555, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(PostGISOperator, self).__init__(operator=operator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L20_C0", "label": "PostGISFunction", "type": "class", "loc": [20, 23], "level": 0, "parent": null, "vector": [3, 0, 0.0366, 0.0068, 0, 0.66, 0.6667, 348, 0, 1, 0, 0, 763, 0, 2], "semantic": {"name": "PostGISFunction", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PostGISFunction(SpatialFunction):\n \"For PostGIS function calls (e.g., `ST_Contains(table, geom)`).\"\n def __init__(self, prefix, function, **kwargs):\n super(PostGISFunction, self).__init__(prefix + function, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L21_C4", "label": "expression", "type": "expression", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L20_C0", "vector": [8, 1, 0.0357, 0.0017, 1, 0.19, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"For PostGIS function calls (e.g., `ST_Contains(table, geom)`).\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L22_C4", "label": "__init__", "type": "function", "loc": [22, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L20_C0", "vector": [2, 1, 0.0383, 0.0034, 1, 0.19, 1.0, 555, 0, 4, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "prefix", "function", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, prefix, function, **kwargs):\n super(PostGISFunction, self).__init__(prefix + function, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L23_C8", "label": "__init__()", "type": "expression", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L22_C4", "vector": [8, 2, 0.0391, 0.0017, 2, 0.76, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(PostGISFunction, self).__init__(prefix + function, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L25_C0", "label": "PostGISFunctionParam", "type": "class", "loc": [25, 27], "level": 0, "parent": null, "vector": [3, 0, 0.0442, 0.0051, 0, 0.66, 0.7222, 310, 0, 0, 0, 0, 348, 0, 0], "semantic": {"name": "PostGISFunctionParam", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PostGISFunctionParam(PostGISFunction):\n \"For PostGIS functions that take another parameter (e.g. DWithin, Relate).\"\n sql_template = '%(function)s(%(geo_col)s, %(geometry)s, %%s)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L26_C4", "label": "expression", "type": "expression", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L25_C0", "vector": [8, 1, 0.0442, 0.0017, 1, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"For PostGIS functions that take another parameter (e.g. DWithin, Relate).\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L27_C4", "label": "sql_template =", "type": "assigned_variable", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L25_C0", "vector": [14, 1, 0.0459, 0.0017, 1, 0.46, 1.0, 765, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sql_template", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sql_template = '%(function)s(%(geo_col)s, %(geometry)s, %%s)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L29_C0", "label": "PostGISDistance", "type": "class", "loc": [29, 36], "level": 0, "parent": null, "vector": [3, 0, 0.0553, 0.0136, 0, 0.66, 0.7778, 585, 0, 1, 0, 0, 348, 0, 2], "semantic": {"name": "PostGISDistance", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PostGISDistance(PostGISFunction):\n \"For PostGIS distance operations.\"\n dist_func = 'Distance'\n sql_template = '%(function)s(%(geo_col)s, %(geometry)s) %(operator)s %%s'\n\n def __init__(self, prefix, operator):\n super(PostGISDistance, self).__init__(prefix, self.dist_func,\n operator=operator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L30_C4", "label": "expression", "type": "expression", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L29_C0", "vector": [8, 1, 0.051, 0.0017, 1, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"For PostGIS distance operations.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L31_C4", "label": "dist_func =", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L29_C0", "vector": [14, 1, 0.0527, 0.0017, 1, 0.66, 0.3333, 591, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "dist_func", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dist_func = 'Distance'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L32_C4", "label": "sql_template =", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L29_C0", "vector": [14, 1, 0.0544, 0.0017, 1, 0.66, 0.6667, 765, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sql_template", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sql_template = '%(function)s(%(geo_col)s, %(geometry)s) %(operator)s %%s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L34_C4", "label": "__init__", "type": "function", "loc": [34, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L29_C0", "vector": [2, 1, 0.0595, 0.0051, 1, 0.66, 1.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "prefix", "operator"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, prefix, operator):\n super(PostGISDistance, self).__init__(prefix, self.dist_func,\n operator=operator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L35_C8", "label": "__init__()", "type": "expression", "loc": [35, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L34_C4", "vector": [8, 2, 0.0604, 0.0034, 2, 0.0, 0.0, 555, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(PostGISDistance, self).__init__(prefix, self.dist_func,\n operator=operator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L38_C0", "label": "PostGISSpheroidDistance", "type": "class", "loc": [38, 45], "level": 0, "parent": null, "vector": [3, 0, 0.0706, 0.0136, 0, 0.66, 0.8333, 770, 0, 1, 0, 0, 348, 0, 2], "semantic": {"name": "PostGISSpheroidDistance", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PostGISSpheroidDistance(PostGISFunction):\n \"For PostGIS spherical distance operations (using the spheroid).\"\n dist_func = 'distance_spheroid'\n sql_template = '%(function)s(%(geo_col)s, %(geometry)s, %%s) %(operator)s %%s'\n def __init__(self, prefix, operator):\n # An extra parameter in `end_subst` is needed for the spheroid string.\n super(PostGISSpheroidDistance, self).__init__(prefix, self.dist_func,\n operator=operator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L39_C4", "label": "expression", "type": "expression", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L38_C0", "vector": [8, 1, 0.0663, 0.0017, 1, 0.34, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"For PostGIS spherical distance operations (using the spheroid).\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L40_C4", "label": "dist_func =", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L38_C0", "vector": [14, 1, 0.068, 0.0017, 1, 0.34, 0.3333, 591, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "dist_func", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dist_func = 'distance_spheroid'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L41_C4", "label": "sql_template =", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L38_C0", "vector": [14, 1, 0.0697, 0.0017, 1, 0.34, 0.6667, 765, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sql_template", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sql_template = '%(function)s(%(geo_col)s, %(geometry)s, %%s) %(operator)s %%s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L42_C4", "label": "__init__", "type": "function", "loc": [42, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L38_C0", "vector": [2, 1, 0.074, 0.0068, 1, 0.34, 1.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "prefix", "operator"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, prefix, operator):\n # An extra parameter in `end_subst` is needed for the spheroid string.\n super(PostGISSpheroidDistance, self).__init__(prefix, self.dist_func,\n operator=operator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L44_C8", "label": "__init__()", "type": "expression", "loc": [44, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L42_C4", "vector": [8, 2, 0.0757, 0.0034, 2, 0.21, 0.0, 555, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(PostGISSpheroidDistance, self).__init__(prefix, self.dist_func,\n operator=operator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L47_C0", "label": "PostGISSphereDistance", "type": "class", "loc": [47, 49], "level": 0, "parent": null, "vector": [3, 0, 0.0816, 0.0051, 0, 0.66, 0.8889, 711, 0, 0, 0, 0, 585, 0, 0], "semantic": {"name": "PostGISSphereDistance", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PostGISSphereDistance(PostGISDistance):\n \"For PostGIS spherical distance operations.\"\n dist_func = 'distance_sphere'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L48_C4", "label": "expression", "type": "expression", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L47_C0", "vector": [8, 1, 0.0816, 0.0017, 1, 0.17, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"For PostGIS spherical distance operations.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L49_C4", "label": "dist_func =", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L47_C0", "vector": [14, 1, 0.0833, 0.0017, 1, 0.17, 1.0, 591, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "dist_func", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dist_func = 'distance_sphere'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L51_C0", "label": "PostGISRelate", "type": "class", "loc": [51, 57], "level": 0, "parent": null, "vector": [3, 0, 0.0918, 0.0119, 0, 0.66, 0.9444, 184, 0, 1, 0, 0, 310, 0, 5], "semantic": {"name": "PostGISRelate", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PostGISRelate(PostGISFunctionParam):\n \"For PostGIS Relate(<geom>, <pattern>) calls.\"\n pattern_regex = re.compile(r'^[012TF\\*]{9}$')\n def __init__(self, prefix, pattern):\n if not self.pattern_regex.match(pattern):\n raise ValueError('Invalid intersection matrix pattern \"%s\".' % pattern)\n super(PostGISRelate, self).__init__(prefix, 'Relate')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L52_C4", "label": "expression", "type": "expression", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L51_C0", "vector": [8, 1, 0.0884, 0.0017, 1, 0.62, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"For PostGIS Relate(<geom>, <pattern>) calls.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L53_C4", "label": "pattern_regex = compile()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L51_C0", "vector": [14, 1, 0.0901, 0.0017, 1, 0.62, 0.5, 700, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "pattern_regex", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " pattern_regex = re.compile(r'^[012TF\\*]{9}$')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L54_C4", "label": "__init__", "type": "function", "loc": [54, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L51_C0", "vector": [2, 1, 0.0944, 0.0068, 1, 0.62, 1.0, 555, 0, 3, 0, 0, 0, 0, 4], "semantic": {"name": "__init__", "arg_names": ["self", "prefix", "pattern"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, prefix, pattern):\n if not self.pattern_regex.match(pattern):\n raise ValueError('Invalid intersection matrix pattern \"%s\".' % pattern)\n super(PostGISRelate, self).__init__(prefix, 'Relate')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L55_C8", "label": "if", "type": "if", "loc": [55, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L54_C4", "vector": [4, 2, 0.0944, 0.0034, 2, 0.5, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.pattern_regex.match(pattern):\n raise ValueError('Invalid intersection matrix pattern \"%s\".' % pattern)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L57_C8", "label": "__init__()", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L54_C4", "vector": [8, 2, 0.0969, 0.0017, 2, 0.5, 1.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(PostGISRelate, self).__init__(prefix, 'Relate')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "label": "PostGISOperations", "type": "class", "loc": [60, 588], "level": 0, "parent": null, "vector": [3, 0, 0.551, 0.8997, 0, 0.66, 1.0, 187, 0, 24, 0, 0, 311, 0, 99], "semantic": {"name": "PostGISOperations", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PostGISOperations(DatabaseOperations, BaseSpatialOperations):\n compiler_module = 'django.contrib.gis.db.models.sql.compiler'\n name = 'postgis'\n postgis = True\n version_regex = re.compile(r'^(?P<major>\\d)\\.(?P<minor1>\\d)\\.(?P<minor2>\\d+)')\n valid_aggregates = dict([(k, None) for k in\n ('Collect', 'Extent', 'Extent3D', 'MakeLine', 'Union')])\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L61_C4", "label": "compiler_module =", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [14, 1, 0.1037, 0.0017, 1, 0.98, 0.0, 902, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "compiler_module", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " compiler_module = 'django.contrib.gis.db.models.sql.compiler'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L62_C4", "label": "name =", "type": "assigned_variable", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [14, 1, 0.1054, 0.0017, 1, 0.98, 0.037, 57, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = 'postgis'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L63_C4", "label": "postgis =", "type": "assigned_variable", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [14, 1, 0.1071, 0.0017, 1, 0.98, 0.0741, 526, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "postgis", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " postgis = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L64_C4", "label": "version_regex = compile()", "type": "assigned_variable", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [14, 1, 0.1088, 0.0017, 1, 0.98, 0.1111, 866, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "version_regex", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " version_regex = re.compile(r'^(?P<major>\\d)\\.(?P<minor1>\\d)\\.(?P<minor2>\\d+)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L65_C4", "label": "valid_aggregates = dict()", "type": "assigned_variable", "loc": [65, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [14, 1, 0.1114, 0.0034, 1, 0.98, 0.1481, 414, 3, 1, 0, 0, 827, 10, 1], "semantic": {"name": "valid_aggregates", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " valid_aggregates = dict([(k, None) for k in\n ('Collect', 'Extent', 'Extent3D', 'MakeLine', 'Union')])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L68_C4", "label": "Adapter =", "type": "assigned_variable", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [14, 1, 0.1156, 0.0017, 1, 0.98, 0.1852, 6, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Adapter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " Adapter = PostGISAdapter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L69_C4", "label": "Adaptor =", "type": "assigned_variable", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [14, 1, 0.1173, 0.0017, 1, 0.98, 0.2222, 764, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Adaptor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " Adaptor = Adapter # Backwards-compatibility alias."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "label": "__init__", "type": "function", "loc": [71, 279], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [2, 1, 0.2976, 0.3554, 1, 0.98, 0.2593, 555, 0, 2, 1, 0, 0, 0, 46], "semantic": {"name": "__init__", "arg_names": ["self", "connection"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, connection):\n super(PostGISOperations, self).__init__(connection)\n\n # Trying to get the PostGIS version because the function\n # signatures will depend on the version used. The cost\n # here is a database query to determine the version, which\n # can be mitigated by setting `POSTGIS_VERSION` with a 3-tuple\n # comprising user-supplied values for the major, minor, and"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L72_C8", "label": "__init__()", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [8, 2, 0.1224, 0.0017, 2, 0.55, 0.0, 555, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(PostGISOperations, self).__init__(connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Try_L80_C8", "label": "try", "type": "try", "loc": [80, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [7, 2, 0.1624, 0.0544, 2, 0.55, 0.0196, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if hasattr(settings, 'POSTGIS_VERSION'):\n vtup = settings.POSTGIS_VERSION\n if len(vtup) == 3:\n # The user-supplied PostGIS version.\n version = vtup\n else:\n # This was the old documented way, but it's stupid to"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L81_C12", "label": "if", "type": "if", "loc": [81, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:Try_L80_C8", "vector": [4, 3, 0.1471, 0.0204, 3, 0.57, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(settings, 'POSTGIS_VERSION'):\n vtup = settings.POSTGIS_VERSION\n if len(vtup) == 3:\n # The user-supplied PostGIS version.\n version = vtup\n else:\n # This was the old documented way, but it's stupid to\n # include the string."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L82_C16", "label": "vtup =", "type": "assigned_variable", "loc": [82, 82], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L81_C12", "vector": [14, 4, 0.1395, 0.0017, 4, 0.74, 0.0, 630, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "vtup", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " vtup = settings.POSTGIS_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L83_C16", "label": "if", "type": "if", "loc": [83, 89], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L81_C12", "vector": [4, 4, 0.1463, 0.0119, 4, 0.74, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(vtup) == 3:\n # The user-supplied PostGIS version.\n version = vtup\n else:\n # This was the old documented way, but it's stupid to\n # include the string.\n version = vtup[1:4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L85_C20", "label": "version =", "type": "assigned_variable", "loc": [85, 85], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L83_C16", "vector": [14, 5, 0.1446, 0.0017, 5, 0.92, 0.0, 623, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = vtup"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L89_C20", "label": "version =", "type": "assigned_variable", "loc": [89, 89], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L83_C16", "vector": [14, 5, 0.1514, 0.0017, 5, 0.92, 1.0, 623, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = vtup[1:4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L91_C16", "label": "vtup = postgis_version_tuple()", "type": "assigned_variable", "loc": [91, 91], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L81_C12", "vector": [14, 4, 0.1548, 0.0017, 4, 0.74, 0.6667, 630, 3, 0, 0, 0, 477, 10, 1], "semantic": {"name": "vtup", "arg_names": [], "import_names": [], "rhs_call_name": "postgis_version_tuple", "annotation": ""}, "snippet": " vtup = self.postgis_version_tuple()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L92_C16", "label": "version =", "type": "assigned_variable", "loc": [92, 92], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L81_C12", "vector": [14, 4, 0.1565, 0.0017, 4, 0.74, 1.0, 623, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = vtup[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L97_C12", "label": "if", "type": "if", "loc": [97, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:Try_L80_C8", "vector": [4, 3, 0.1675, 0.0068, 3, 0.57, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if version >= (1, 2, 2):\n prefix = 'ST_'\n else:\n prefix = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L98_C16", "label": "prefix =", "type": "assigned_variable", "loc": [98, 98], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L97_C12", "vector": [14, 4, 0.1667, 0.0017, 4, 0.72, 0.0, 284, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "prefix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prefix = 'ST_'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L100_C16", "label": "prefix =", "type": "assigned_variable", "loc": [100, 100], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L97_C12", "vector": [14, 4, 0.1701, 0.0017, 4, 0.72, 1.0, 284, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "prefix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prefix = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L102_C12", "label": "self.geom_func_prefix =", "type": "assigned_variable", "loc": [102, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:Try_L80_C8", "vector": [14, 3, 0.1735, 0.0017, 3, 0.57, 0.6667, 689, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.geom_func_prefix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.geom_func_prefix = prefix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L103_C12", "label": "self.spatial_version =", "type": "assigned_variable", "loc": [103, 103], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:Try_L80_C8", "vector": [14, 3, 0.1752, 0.0017, 3, 0.57, 1.0, 501, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.spatial_version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.spatial_version = version"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L115_C8", "label": "self.geometry_operators =", "type": "assigned_variable", "loc": [115, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.2287, 0.068, 2, 0.55, 0.0392, 782, 0, 0, 0, 0, 0, 6, 13], "semantic": {"name": "self.geometry_operators", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.geometry_operators = {\n # The \"&<\" operator returns true if A's bounding box overlaps or\n # is to the left of B's bounding box.\n 'overlaps_left' : PostGISOperator('&<'),\n # The \"&>\" operator returns true if A's bounding box overlaps or\n # is to the right of B's bounding box.\n 'overlaps_right' : PostGISOperator('&>'),\n # The \"<<\" operator returns true if A's bounding box is strictly"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L156_C8", "label": "self.geometry_functions =", "type": "assigned_variable", "loc": [156, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.2738, 0.0187, 2, 0.55, 0.0588, 45, 0, 0, 0, 0, 0, 6, 8], "semantic": {"name": "self.geometry_functions", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.geometry_functions = {\n 'equals' : PostGISFunction(prefix, 'Equals'),\n 'disjoint' : PostGISFunction(prefix, 'Disjoint'),\n 'touches' : PostGISFunction(prefix, 'Touches'),\n 'crosses' : PostGISFunction(prefix, 'Crosses'),\n 'within' : PostGISFunction(prefix, 'Within'),\n 'overlaps' : PostGISFunction(prefix, 'Overlaps'),\n 'contains' : PostGISFunction(prefix, 'Contains'),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L169_C8", "label": "dtypes =", "type": "assigned_variable", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.2874, 0.0017, 2, 0.55, 0.0784, 87, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "dtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dtypes = (Decimal, Distance, float, int, long)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L170_C8", "label": "get_dist_ops", "type": "function", "loc": [170, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [2, 2, 0.2934, 0.0102, 2, 0.55, 0.098, 215, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "get_dist_ops", "arg_names": ["operator"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_dist_ops(operator):\n \"Returns operations for both regular and spherical distances.\"\n return {'cartesian' : PostGISDistance(prefix, operator),\n 'sphere' : PostGISSphereDistance(prefix, operator),\n 'spheroid' : PostGISSpheroidDistance(prefix, operator),\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L171_C12", "label": "expression", "type": "expression", "loc": [171, 171], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L170_C8", "vector": [8, 3, 0.2908, 0.0017, 3, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns operations for both regular and spherical distances.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L172_C12", "label": "return", "type": "return", "loc": [172, 175], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L170_C8", "vector": [13, 3, 0.2951, 0.0068, 3, 0.37, 1.0, 0, 0, 0, 0, 0, 0, 6, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'cartesian' : PostGISDistance(prefix, operator),\n 'sphere' : PostGISSphereDistance(prefix, operator),\n 'spheroid' : PostGISSpheroidDistance(prefix, operator),\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L176_C8", "label": "self.distance_functions =", "type": "assigned_variable", "loc": [176, 181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.3036, 0.0102, 2, 0.55, 0.1176, 410, 0, 0, 0, 0, 0, 6, 4], "semantic": {"name": "self.distance_functions", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.distance_functions = {\n 'distance_gt' : (get_dist_ops('>'), dtypes),\n 'distance_gte' : (get_dist_ops('>='), dtypes),\n 'distance_lt' : (get_dist_ops('<'), dtypes),\n 'distance_lte' : (get_dist_ops('<='), dtypes),\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L184_C8", "label": "if", "type": "if", "loc": [184, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [4, 2, 0.3197, 0.0153, 2, 0.55, 0.1373, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if version < (1, 2, 2):\n ASKML = False\n else:\n ASKML = 'ST_AsKML'\n self.geometry_functions.update(\n {'coveredby' : PostGISFunction(prefix, 'CoveredBy'),\n 'covers' : PostGISFunction(prefix, 'Covers'),\n })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L185_C12", "label": "ASKML =", "type": "assigned_variable", "loc": [185, 185], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L184_C8", "vector": [14, 3, 0.3146, 0.0017, 3, 0.73, 0.0, 78, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "ASKML", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ASKML = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L187_C12", "label": "ASKML =", "type": "assigned_variable", "loc": [187, 187], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L184_C8", "vector": [14, 3, 0.318, 0.0017, 3, 0.73, 0.3333, 78, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ASKML", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ASKML = 'ST_AsKML'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L188_C12", "label": "update()", "type": "expression", "loc": [188, 191], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L184_C8", "vector": [8, 3, 0.3223, 0.0068, 3, 0.73, 0.6667, 637, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self.geometry_functions.update(\n {'coveredby' : PostGISFunction(prefix, 'CoveredBy'),\n 'covers' : PostGISFunction(prefix, 'Covers'),\n })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L192_C12", "label": "assign", "type": "assigned_variable", "loc": [192, 192], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L184_C8", "vector": [14, 3, 0.3265, 0.0017, 3, 0.73, 1.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.distance_functions['dwithin'] = (PostGISFunctionParam(prefix, 'DWithin'), dtypes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L195_C8", "label": "update()", "type": "expression", "loc": [195, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [8, 2, 0.3316, 0.0017, 2, 0.55, 0.1569, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self.geometry_functions.update(self.distance_functions)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L199_C8", "label": "if", "type": "if", "loc": [199, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [4, 2, 0.3444, 0.0136, 2, 0.55, 0.1765, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if version < (1, 3, 0):\n UNIONAGG = 'GeomUnion'\n UNION = 'Union'\n MAKELINE = False\n else:\n UNIONAGG = 'ST_Union'\n UNION = 'ST_Union'\n MAKELINE = 'ST_MakeLine'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L200_C12", "label": "UNIONAGG =", "type": "assigned_variable", "loc": [200, 200], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L199_C8", "vector": [14, 3, 0.3401, 0.0017, 3, 0.04, 0.0, 549, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "UNIONAGG", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " UNIONAGG = 'GeomUnion'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L201_C12", "label": "UNION =", "type": "assigned_variable", "loc": [201, 201], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L199_C8", "vector": [14, 3, 0.3418, 0.0017, 3, 0.04, 0.2, 69, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "UNION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " UNION = 'Union'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L202_C12", "label": "MAKELINE =", "type": "assigned_variable", "loc": [202, 202], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L199_C8", "vector": [14, 3, 0.3435, 0.0017, 3, 0.04, 0.4, 119, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "MAKELINE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " MAKELINE = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L204_C12", "label": "UNIONAGG =", "type": "assigned_variable", "loc": [204, 204], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L199_C8", "vector": [14, 3, 0.3469, 0.0017, 3, 0.04, 0.6, 549, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "UNIONAGG", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " UNIONAGG = 'ST_Union'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L205_C12", "label": "UNION =", "type": "assigned_variable", "loc": [205, 205], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L199_C8", "vector": [14, 3, 0.3486, 0.0017, 3, 0.04, 0.8, 69, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "UNION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " UNION = 'ST_Union'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L206_C12", "label": "MAKELINE =", "type": "assigned_variable", "loc": [206, 206], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L199_C8", "vector": [14, 3, 0.3503, 0.0017, 3, 0.04, 1.0, 119, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "MAKELINE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " MAKELINE = 'ST_MakeLine'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L209_C8", "label": "if", "type": "if", "loc": [209, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [4, 2, 0.358, 0.0068, 2, 0.55, 0.1961, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if version < (1, 3, 4):\n GEOJSON = False\n else:\n GEOJSON = prefix + 'AsGeoJson'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L210_C12", "label": "GEOJSON =", "type": "assigned_variable", "loc": [210, 210], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L209_C8", "vector": [14, 3, 0.3571, 0.0017, 3, 0.81, 0.0, 805, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "GEOJSON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " GEOJSON = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L212_C12", "label": "GEOJSON =", "type": "assigned_variable", "loc": [212, 212], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L209_C8", "vector": [14, 3, 0.3605, 0.0017, 3, 0.81, 1.0, 805, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "GEOJSON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " GEOJSON = prefix + 'AsGeoJson'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L215_C8", "label": "if", "type": "if", "loc": [215, 220], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [4, 2, 0.3699, 0.0102, 2, 0.55, 0.2157, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if version >= (1, 4, 0):\n GEOHASH = 'ST_GeoHash'\n BOUNDINGCIRCLE = 'ST_MinimumBoundingCircle'\n self.geometry_functions['contains_properly'] = PostGISFunction(prefix, 'ContainsProperly')\n else:\n GEOHASH, BOUNDINGCIRCLE = False, False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L216_C12", "label": "GEOHASH =", "type": "assigned_variable", "loc": [216, 216], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L215_C8", "vector": [14, 3, 0.3673, 0.0017, 3, 0.74, 0.0, 559, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "GEOHASH", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " GEOHASH = 'ST_GeoHash'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L217_C12", "label": "BOUNDINGCIRCLE =", "type": "assigned_variable", "loc": [217, 217], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L215_C8", "vector": [14, 3, 0.369, 0.0017, 3, 0.74, 0.3333, 601, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "BOUNDINGCIRCLE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " BOUNDINGCIRCLE = 'ST_MinimumBoundingCircle'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L218_C12", "label": " = PostGISFunction()", "type": "assigned_variable", "loc": [218, 218], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L215_C8", "vector": [14, 3, 0.3707, 0.0017, 3, 0.74, 0.6667, 0, 3, 2, 0, 0, 348, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "PostGISFunction", "annotation": ""}, "snippet": " self.geometry_functions['contains_properly'] = PostGISFunction(prefix, 'ContainsProperly')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L220_C12", "label": "GEOHASH, BOUNDINGCIRCLE =", "type": "assigned_variable", "loc": [220, 220], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L215_C8", "vector": [14, 3, 0.3741, 0.0017, 3, 0.74, 1.0, 157, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "GEOHASH, BOUNDINGCIRCLE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " GEOHASH, BOUNDINGCIRCLE = False, False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L223_C8", "label": "if", "type": "if", "loc": [223, 235], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [4, 2, 0.3895, 0.0221, 2, 0.55, 0.2353, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if version >= (1, 5, 0):\n self.geography = True\n # Only a subset of the operators and functions are available\n # for the geography type.\n self.geography_functions = self.distance_functions.copy()\n self.geography_functions.update({\n 'coveredby' : self.geometry_functions['coveredby'],\n 'covers' : self.geometry_functions['covers'],"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L224_C12", "label": "self.geography =", "type": "assigned_variable", "loc": [224, 224], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L223_C8", "vector": [14, 3, 0.381, 0.0017, 3, 0.81, 0.0, 663, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.geography", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.geography = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L227_C12", "label": "self.geography_functions = copy()", "type": "assigned_variable", "loc": [227, 227], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L223_C8", "vector": [14, 3, 0.3861, 0.0017, 3, 0.81, 0.3333, 16, 3, 0, 0, 0, 739, 10, 1], "semantic": {"name": "self.geography_functions", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " self.geography_functions = self.distance_functions.copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L228_C12", "label": "update()", "type": "expression", "loc": [228, 232], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L223_C8", "vector": [8, 3, 0.3912, 0.0085, 3, 0.81, 0.6667, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self.geography_functions.update({\n 'coveredby' : self.geometry_functions['coveredby'],\n 'covers' : self.geometry_functions['covers'],\n 'intersects' : self.geometry_functions['intersects'],\n })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L233_C12", "label": "self.geography_operators =", "type": "assigned_variable", "loc": [233, 235], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L223_C8", "vector": [14, 3, 0.398, 0.0051, 3, 0.81, 1.0, 13, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "self.geography_operators", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.geography_operators = {\n 'bboverlaps' : PostGISOperator('&&'),\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L238_C8", "label": "gis_terms =", "type": "assigned_variable", "loc": [238, 238], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4048, 0.0017, 2, 0.55, 0.2549, 983, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "gis_terms", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " gis_terms = ['isnull']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L241_C8", "label": "self.gis_terms = dict()", "type": "assigned_variable", "loc": [241, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4099, 0.0017, 2, 0.55, 0.2745, 479, 3, 1, 0, 0, 827, 10, 1], "semantic": {"name": "self.gis_terms", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " self.gis_terms = dict([(term, None) for term in gis_terms])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L243_C8", "label": "self.area =", "type": "assigned_variable", "loc": [243, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4133, 0.0017, 2, 0.55, 0.2941, 960, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.area", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.area = prefix + 'Area'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L244_C8", "label": "self.bounding_circle =", "type": "assigned_variable", "loc": [244, 244], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.415, 0.0017, 2, 0.55, 0.3137, 391, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.bounding_circle", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.bounding_circle = BOUNDINGCIRCLE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L245_C8", "label": "self.centroid =", "type": "assigned_variable", "loc": [245, 245], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4167, 0.0017, 2, 0.55, 0.3333, 965, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.centroid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.centroid = prefix + 'Centroid'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L246_C8", "label": "self.collect =", "type": "assigned_variable", "loc": [246, 246], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4184, 0.0017, 2, 0.55, 0.3529, 565, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.collect", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.collect = prefix + 'Collect'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L247_C8", "label": "self.difference =", "type": "assigned_variable", "loc": [247, 247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4201, 0.0017, 2, 0.55, 0.3725, 830, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.difference", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.difference = prefix + 'Difference'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L248_C8", "label": "self.distance =", "type": "assigned_variable", "loc": [248, 248], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4218, 0.0017, 2, 0.55, 0.3922, 371, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.distance", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.distance = prefix + 'Distance'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L249_C8", "label": "self.distance_sphere =", "type": "assigned_variable", "loc": [249, 249], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4235, 0.0017, 2, 0.55, 0.4118, 252, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.distance_sphere", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.distance_sphere = prefix + 'distance_sphere'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L250_C8", "label": "self.distance_spheroid =", "type": "assigned_variable", "loc": [250, 250], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4252, 0.0017, 2, 0.55, 0.4314, 701, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.distance_spheroid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.distance_spheroid = prefix + 'distance_spheroid'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L251_C8", "label": "self.envelope =", "type": "assigned_variable", "loc": [251, 251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4269, 0.0017, 2, 0.55, 0.451, 113, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.envelope", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.envelope = prefix + 'Envelope'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L252_C8", "label": "self.extent =", "type": "assigned_variable", "loc": [252, 252], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4286, 0.0017, 2, 0.55, 0.4706, 728, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.extent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.extent = prefix + 'Extent'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L253_C8", "label": "self.extent3d =", "type": "assigned_variable", "loc": [253, 253], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4303, 0.0017, 2, 0.55, 0.4902, 274, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.extent3d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.extent3d = prefix + 'Extent3D'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L254_C8", "label": "self.force_rhr =", "type": "assigned_variable", "loc": [254, 254], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.432, 0.0017, 2, 0.55, 0.5098, 37, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.force_rhr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.force_rhr = prefix + 'ForceRHR'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L255_C8", "label": "self.geohash =", "type": "assigned_variable", "loc": [255, 255], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4337, 0.0017, 2, 0.55, 0.5294, 907, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.geohash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.geohash = GEOHASH"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L256_C8", "label": "self.geojson =", "type": "assigned_variable", "loc": [256, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4354, 0.0017, 2, 0.55, 0.549, 546, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.geojson", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.geojson = GEOJSON"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L257_C8", "label": "self.gml =", "type": "assigned_variable", "loc": [257, 257], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4371, 0.0017, 2, 0.55, 0.5686, 846, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.gml", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.gml = prefix + 'AsGML'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L258_C8", "label": "self.intersection =", "type": "assigned_variable", "loc": [258, 258], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4388, 0.0017, 2, 0.55, 0.5882, 491, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.intersection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.intersection = prefix + 'Intersection'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L259_C8", "label": "self.kml =", "type": "assigned_variable", "loc": [259, 259], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4405, 0.0017, 2, 0.55, 0.6078, 518, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.kml", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.kml = ASKML"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L260_C8", "label": "self.length =", "type": "assigned_variable", "loc": [260, 260], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4422, 0.0017, 2, 0.55, 0.6275, 879, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.length", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.length = prefix + 'Length'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L261_C8", "label": "self.length3d =", "type": "assigned_variable", "loc": [261, 261], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4439, 0.0017, 2, 0.55, 0.6471, 517, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.length3d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.length3d = prefix + 'Length3D'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L262_C8", "label": "self.length_spheroid =", "type": "assigned_variable", "loc": [262, 262], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4456, 0.0017, 2, 0.55, 0.6667, 186, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.length_spheroid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.length_spheroid = prefix + 'length_spheroid'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L263_C8", "label": "self.makeline =", "type": "assigned_variable", "loc": [263, 263], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4473, 0.0017, 2, 0.55, 0.6863, 113, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.makeline", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.makeline = MAKELINE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L264_C8", "label": "self.mem_size =", "type": "assigned_variable", "loc": [264, 264], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.449, 0.0017, 2, 0.55, 0.7059, 587, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.mem_size", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mem_size = prefix + 'mem_size'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L265_C8", "label": "self.num_geom =", "type": "assigned_variable", "loc": [265, 265], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4507, 0.0017, 2, 0.55, 0.7255, 101, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.num_geom", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.num_geom = prefix + 'NumGeometries'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L266_C8", "label": "self.num_points =", "type": "assigned_variable", "loc": [266, 266], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4524, 0.0017, 2, 0.55, 0.7451, 343, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.num_points", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.num_points =prefix + 'npoints'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L267_C8", "label": "self.perimeter =", "type": "assigned_variable", "loc": [267, 267], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4541, 0.0017, 2, 0.55, 0.7647, 213, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.perimeter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.perimeter = prefix + 'Perimeter'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L268_C8", "label": "self.perimeter3d =", "type": "assigned_variable", "loc": [268, 268], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4558, 0.0017, 2, 0.55, 0.7843, 783, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.perimeter3d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.perimeter3d = prefix + 'Perimeter3D'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L269_C8", "label": "self.point_on_surface =", "type": "assigned_variable", "loc": [269, 269], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4575, 0.0017, 2, 0.55, 0.8039, 899, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.point_on_surface", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.point_on_surface = prefix + 'PointOnSurface'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L270_C8", "label": "self.polygonize =", "type": "assigned_variable", "loc": [270, 270], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4592, 0.0017, 2, 0.55, 0.8235, 627, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.polygonize", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.polygonize = prefix + 'Polygonize'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L271_C8", "label": "self.reverse =", "type": "assigned_variable", "loc": [271, 271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4609, 0.0017, 2, 0.55, 0.8431, 690, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.reverse", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.reverse = prefix + 'Reverse'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L272_C8", "label": "self.scale =", "type": "assigned_variable", "loc": [272, 272], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4626, 0.0017, 2, 0.55, 0.8627, 181, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.scale", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.scale = prefix + 'Scale'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L273_C8", "label": "self.snap_to_grid =", "type": "assigned_variable", "loc": [273, 273], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4643, 0.0017, 2, 0.55, 0.8824, 662, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.snap_to_grid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.snap_to_grid = prefix + 'SnapToGrid'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L274_C8", "label": "self.svg =", "type": "assigned_variable", "loc": [274, 274], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.466, 0.0017, 2, 0.55, 0.902, 723, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.svg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.svg = prefix + 'AsSVG'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L275_C8", "label": "self.sym_difference =", "type": "assigned_variable", "loc": [275, 275], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4677, 0.0017, 2, 0.55, 0.9216, 53, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.sym_difference", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.sym_difference = prefix + 'SymDifference'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L276_C8", "label": "self.transform =", "type": "assigned_variable", "loc": [276, 276], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4694, 0.0017, 2, 0.55, 0.9412, 154, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.transform", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.transform = prefix + 'Transform'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L277_C8", "label": "self.translate =", "type": "assigned_variable", "loc": [277, 277], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4711, 0.0017, 2, 0.55, 0.9608, 792, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.translate", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.translate = prefix + 'Translate'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L278_C8", "label": "self.union =", "type": "assigned_variable", "loc": [278, 278], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4728, 0.0017, 2, 0.55, 0.9804, 343, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.union", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.union = UNION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L279_C8", "label": "self.unionagg =", "type": "assigned_variable", "loc": [279, 279], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "vector": [14, 2, 0.4745, 0.0017, 2, 0.55, 1.0, 324, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.unionagg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.unionagg = UNIONAGG"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L281_C4", "label": "check_aggregate_support", "type": "function", "loc": [281, 287], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [2, 1, 0.483, 0.0119, 1, 0.98, 0.2963, 517, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "check_aggregate_support", "arg_names": ["self", "aggregate"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def check_aggregate_support(self, aggregate):\n \"\"\"\n Checks if the given aggregate name is supported (that is, if it's\n in `self.valid_aggregates`).\n \"\"\"\n agg_name = aggregate.__class__.__name__\n return agg_name in self.valid_aggregates"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L282_C8", "label": "expression", "type": "expression", "loc": [282, 285], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L281_C4", "vector": [8, 2, 0.4821, 0.0068, 2, 0.64, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Checks if the given aggregate name is supported (that is, if it's\n in `self.valid_aggregates`).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L286_C8", "label": "agg_name =", "type": "assigned_variable", "loc": [286, 286], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L281_C4", "vector": [14, 2, 0.4864, 0.0017, 2, 0.64, 0.5, 817, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "agg_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " agg_name = aggregate.__class__.__name__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L287_C8", "label": "return", "type": "return", "loc": [287, 287], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L281_C4", "vector": [13, 2, 0.4881, 0.0017, 2, 0.64, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return agg_name in self.valid_aggregates"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L289_C4", "label": "convert_extent", "type": "function", "loc": [289, 298], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [2, 1, 0.4991, 0.017, 1, 0.98, 0.3333, 816, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "convert_extent", "arg_names": ["self", "box"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def convert_extent(self, box):\n \"\"\"\n Returns a 4-tuple extent for the `Extent` aggregate by converting\n the bounding box text returned by PostGIS (`box` argument), for\n example: \"BOX(-90.0 30.0, -85.0 40.0)\".\n \"\"\"\n ll, ur = box[4:-1].split(',')\n xmin, ymin = map(float, ll.split())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L290_C8", "label": "expression", "type": "expression", "loc": [290, 294], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L289_C4", "vector": [8, 2, 0.4966, 0.0085, 2, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a 4-tuple extent for the `Extent` aggregate by converting\n the bounding box text returned by PostGIS (`box` argument), for\n example: \"BOX(-90.0 30.0, -85.0 40.0)\".\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L295_C8", "label": "ll, ur = split()", "type": "assigned_variable", "loc": [295, 295], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L289_C4", "vector": [14, 2, 0.5017, 0.0017, 2, 0.18, 0.25, 979, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "ll, ur", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " ll, ur = box[4:-1].split(',')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L296_C8", "label": "xmin, ymin = map()", "type": "assigned_variable", "loc": [296, 296], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L289_C4", "vector": [14, 2, 0.5034, 0.0017, 2, 0.18, 0.5, 72, 3, 2, 0, 0, 53, 10, 2], "semantic": {"name": "xmin, ymin", "arg_names": [], "import_names": [], "rhs_call_name": "map", "annotation": ""}, "snippet": " xmin, ymin = map(float, ll.split())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L297_C8", "label": "xmax, ymax = map()", "type": "assigned_variable", "loc": [297, 297], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L289_C4", "vector": [14, 2, 0.5051, 0.0017, 2, 0.18, 0.75, 344, 3, 2, 0, 0, 53, 10, 2], "semantic": {"name": "xmax, ymax", "arg_names": [], "import_names": [], "rhs_call_name": "map", "annotation": ""}, "snippet": " xmax, ymax = map(float, ur.split())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L298_C8", "label": "return", "type": "return", "loc": [298, 298], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L289_C4", "vector": [13, 2, 0.5068, 0.0017, 2, 0.18, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (xmin, ymin, xmax, ymax)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L300_C4", "label": "convert_extent3d", "type": "function", "loc": [300, 309], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [2, 1, 0.5179, 0.017, 1, 0.98, 0.3704, 35, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "convert_extent3d", "arg_names": ["self", "box3d"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def convert_extent3d(self, box3d):\n \"\"\"\n Returns a 6-tuple extent for the `Extent3D` aggregate by converting\n the 3d bounding-box text returnded by PostGIS (`box3d` argument), for\n example: \"BOX3D(-90.0 30.0 1, -85.0 40.0 2)\".\n \"\"\"\n ll, ur = box3d[6:-1].split(',')\n xmin, ymin, zmin = map(float, ll.split())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L301_C8", "label": "expression", "type": "expression", "loc": [301, 305], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L300_C4", "vector": [8, 2, 0.5153, 0.0085, 2, 0.42, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a 6-tuple extent for the `Extent3D` aggregate by converting\n the 3d bounding-box text returnded by PostGIS (`box3d` argument), for\n example: \"BOX3D(-90.0 30.0 1, -85.0 40.0 2)\".\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L306_C8", "label": "ll, ur = split()", "type": "assigned_variable", "loc": [306, 306], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L300_C4", "vector": [14, 2, 0.5204, 0.0017, 2, 0.42, 0.25, 979, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "ll, ur", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " ll, ur = box3d[6:-1].split(',')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L307_C8", "label": "xmin, ymin, zmin = map()", "type": "assigned_variable", "loc": [307, 307], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L300_C4", "vector": [14, 2, 0.5221, 0.0017, 2, 0.42, 0.5, 464, 3, 2, 0, 0, 53, 10, 2], "semantic": {"name": "xmin, ymin, zmin", "arg_names": [], "import_names": [], "rhs_call_name": "map", "annotation": ""}, "snippet": " xmin, ymin, zmin = map(float, ll.split())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L308_C8", "label": "xmax, ymax, zmax = map()", "type": "assigned_variable", "loc": [308, 308], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L300_C4", "vector": [14, 2, 0.5238, 0.0017, 2, 0.42, 0.75, 575, 3, 2, 0, 0, 53, 10, 2], "semantic": {"name": "xmax, ymax, zmax", "arg_names": [], "import_names": [], "rhs_call_name": "map", "annotation": ""}, "snippet": " xmax, ymax, zmax = map(float, ur.split())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L309_C8", "label": "return", "type": "return", "loc": [309, 309], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L300_C4", "vector": [13, 2, 0.5255, 0.0017, 2, 0.42, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (xmin, ymin, zmin, xmax, ymax, zmax)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L311_C4", "label": "convert_geom", "type": "function", "loc": [311, 318], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [2, 1, 0.5349, 0.0136, 1, 0.98, 0.4074, 452, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "convert_geom", "arg_names": ["self", "hex", "geo_field"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def convert_geom(self, hex, geo_field):\n \"\"\"\n Converts the geometry returned from PostGIS aggretates.\n \"\"\"\n if hex:\n return Geometry(hex)\n else:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L312_C8", "label": "expression", "type": "expression", "loc": [312, 314], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L311_C4", "vector": [8, 2, 0.5323, 0.0051, 2, 0.93, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Converts the geometry returned from PostGIS aggretates.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L315_C8", "label": "if", "type": "if", "loc": [315, 318], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L311_C4", "vector": [4, 2, 0.5383, 0.0068, 2, 0.93, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hex:\n return Geometry(hex)\n else:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L316_C12", "label": "return", "type": "return", "loc": [316, 316], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L315_C8", "vector": [13, 3, 0.5374, 0.0017, 3, 0.37, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Geometry(hex)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L318_C12", "label": "return", "type": "return", "loc": [318, 318], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L315_C8", "vector": [13, 3, 0.5408, 0.0017, 3, 0.37, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L320_C4", "label": "geo_db_type", "type": "function", "loc": [320, 337], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [2, 1, 0.5587, 0.0306, 1, 0.98, 0.4444, 347, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "geo_db_type", "arg_names": ["self", "f"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geo_db_type(self, f):\n \"\"\"\n Return the database field type for the given geometry field.\n Typically this is `None` because geometry columns are added via\n the `AddGeometryColumn` stored procedure, unless the field\n has been specified to be of geography type instead.\n \"\"\"\n if f.geography:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L321_C8", "label": "expression", "type": "expression", "loc": [321, 326], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L320_C4", "vector": [8, 2, 0.5502, 0.0102, 2, 0.95, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Return the database field type for the given geometry field.\n Typically this is `None` because geometry columns are added via\n the `AddGeometryColumn` stored procedure, unless the field\n has been specified to be of geography type instead.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L327_C8", "label": "if", "type": "if", "loc": [327, 337], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L320_C4", "vector": [4, 2, 0.5646, 0.0187, 2, 0.95, 1.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if f.geography:\n if not self.geography:\n raise NotImplementedError('PostGIS 1.5 required for geography column support.')\n\n if f.srid != 4326:\n raise NotImplementedError('PostGIS 1.5 supports geography columns '\n 'only with an SRID of 4326.')\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L328_C12", "label": "if", "type": "if", "loc": [328, 329], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L327_C8", "vector": [4, 3, 0.5587, 0.0034, 3, 0.11, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.geography:\n raise NotImplementedError('PostGIS 1.5 required for geography column support.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L331_C12", "label": "if", "type": "if", "loc": [331, 333], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L327_C8", "vector": [4, 3, 0.5646, 0.0051, 3, 0.11, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if f.srid != 4326:\n raise NotImplementedError('PostGIS 1.5 supports geography columns '\n 'only with an SRID of 4326.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L335_C12", "label": "return", "type": "return", "loc": [335, 335], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L327_C8", "vector": [13, 3, 0.5697, 0.0017, 3, 0.11, 0.6667, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'geography(%s,%d)'% (f.geom_type, f.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L337_C12", "label": "return", "type": "return", "loc": [337, 337], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L327_C8", "vector": [13, 3, 0.5731, 0.0017, 3, 0.11, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L339_C4", "label": "get_distance", "type": "function", "loc": [339, 379], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [2, 1, 0.6105, 0.0697, 1, 0.98, 0.4815, 243, 0, 4, 1, 0, 0, 0, 7], "semantic": {"name": "get_distance", "arg_names": ["self", "f", "dist_val", "lookup_type"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_distance(self, f, dist_val, lookup_type):\n \"\"\"\n Retrieve the distance parameters for the given geometry field,\n distance lookup value, and the distance lookup type.\n\n This is the most complex implementation of the spatial backends due to\n what is supported on geodetic geometry columns vs. what's available on\n projected geometry columns. In addition, it has to take into account"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L340_C8", "label": "expression", "type": "expression", "loc": [340, 348], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L339_C4", "vector": [8, 2, 0.585, 0.0153, 2, 0.16, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Retrieve the distance parameters for the given geometry field,\n distance lookup value, and the distance lookup type.\n\n This is the most complex implementation of the spatial backends due to\n what is supported on geodetic geometry columns vs. what's available on\n projected geometry columns. In addition, it has to take into account\n the newly introduced geography column type introudced in PostGIS 1.5."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L350_C8", "label": "if", "type": "if", "loc": [350, 353], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L339_C4", "vector": [4, 2, 0.5978, 0.0068, 2, 0.16, 0.2, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(dist_val) == 1:\n value, option = dist_val[0], None\n else:\n value, option = dist_val"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L351_C12", "label": "value, option =", "type": "assigned_variable", "loc": [351, 351], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L350_C8", "vector": [14, 3, 0.5969, 0.0017, 3, 0.92, 0.0, 480, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "value, option", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value, option = dist_val[0], None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L353_C12", "label": "value, option =", "type": "assigned_variable", "loc": [353, 353], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L350_C8", "vector": [14, 3, 0.6003, 0.0017, 3, 0.92, 1.0, 480, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "value, option", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value, option = dist_val"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L356_C8", "label": "geodetic = geodetic()", "type": "assigned_variable", "loc": [356, 356], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L339_C4", "vector": [14, 2, 0.6054, 0.0017, 2, 0.16, 0.4, 279, 3, 1, 0, 0, 279, 10, 1], "semantic": {"name": "geodetic", "arg_names": [], "import_names": [], "rhs_call_name": "geodetic", "annotation": ""}, "snippet": " geodetic = f.geodetic(self.connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L357_C8", "label": "geography =", "type": "assigned_variable", "loc": [357, 357], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L339_C4", "vector": [14, 2, 0.6071, 0.0017, 2, 0.16, 0.6, 899, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geography", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geography = f.geography and self.geography"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L359_C8", "label": "if", "type": "if", "loc": [359, 371], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L339_C4", "vector": [4, 2, 0.6207, 0.0221, 2, 0.16, 0.8, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, Distance):\n if geography:\n dist_param = value.m\n elif geodetic:\n if lookup_type == 'dwithin':\n raise ValueError('Only numeric values of degree units are '\n 'allowed on geographic DWithin queries.')\n dist_param = value.m"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L360_C12", "label": "if", "type": "if", "loc": [360, 368], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L359_C8", "vector": [4, 3, 0.619, 0.0153, 3, 0.32, 0.0, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if geography:\n dist_param = value.m\n elif geodetic:\n if lookup_type == 'dwithin':\n raise ValueError('Only numeric values of degree units are '\n 'allowed on geographic DWithin queries.')\n dist_param = value.m\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L361_C16", "label": "dist_param =", "type": "assigned_variable", "loc": [361, 361], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L360_C12", "vector": [14, 4, 0.6139, 0.0017, 4, 0.49, 0.0, 841, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dist_param", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dist_param = value.m"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L362_C12", "label": "if", "type": "if", "loc": [362, 368], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L360_C12", "vector": [4, 4, 0.6207, 0.0119, 4, 0.49, 1.0, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif geodetic:\n if lookup_type == 'dwithin':\n raise ValueError('Only numeric values of degree units are '\n 'allowed on geographic DWithin queries.')\n dist_param = value.m\n else:\n dist_param = getattr(value, Distance.unit_attname(f.units_name(self.connection)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L363_C16", "label": "if", "type": "if", "loc": [363, 365], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L362_C12", "vector": [4, 5, 0.619, 0.0051, 5, 0.76, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lookup_type == 'dwithin':\n raise ValueError('Only numeric values of degree units are '\n 'allowed on geographic DWithin queries.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L366_C16", "label": "dist_param =", "type": "assigned_variable", "loc": [366, 366], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L362_C12", "vector": [14, 5, 0.6224, 0.0017, 5, 0.76, 0.5, 841, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dist_param", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dist_param = value.m"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L368_C16", "label": "dist_param = getattr()", "type": "assigned_variable", "loc": [368, 368], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L362_C12", "vector": [14, 5, 0.6259, 0.0017, 5, 0.76, 1.0, 841, 3, 2, 0, 0, 121, 10, 3], "semantic": {"name": "dist_param", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " dist_param = getattr(value, Distance.unit_attname(f.units_name(self.connection)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L371_C12", "label": "dist_param =", "type": "assigned_variable", "loc": [371, 371], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L359_C8", "vector": [14, 3, 0.631, 0.0017, 3, 0.32, 1.0, 841, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dist_param", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dist_param = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L373_C8", "label": "if", "type": "if", "loc": [373, 379], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L339_C4", "vector": [4, 2, 0.6395, 0.0119, 2, 0.16, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (not geography and geodetic and lookup_type != 'dwithin'\n and option == 'spheroid'):\n # using distance_spheroid requires the spheroid of the field as\n # a parameter.\n return [f._spheroid, dist_param]\n else:\n return [dist_param]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L377_C12", "label": "return", "type": "return", "loc": [377, 377], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L373_C8", "vector": [13, 3, 0.6412, 0.0017, 3, 0.01, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [f._spheroid, dist_param]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L379_C12", "label": "return", "type": "return", "loc": [379, 379], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L373_C8", "vector": [13, 3, 0.6446, 0.0017, 3, 0.01, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [dist_param]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L381_C4", "label": "get_geom_placeholder", "type": "function", "loc": [381, 399], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [2, 1, 0.6633, 0.0323, 1, 0.98, 0.5185, 983, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "get_geom_placeholder", "arg_names": ["self", "f", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_geom_placeholder(self, f, value):\n \"\"\"\n Provides a proper substitution value for Geometries that are not in the\n SRID of the field. Specifically, this routine will substitute in the\n ST_Transform() function call.\n \"\"\"\n if value is None or value.srid == f.srid:\n placeholder = '%s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L382_C8", "label": "expression", "type": "expression", "loc": [382, 386], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L381_C4", "vector": [8, 2, 0.6531, 0.0085, 2, 0.24, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Provides a proper substitution value for Geometries that are not in the\n SRID of the field. Specifically, this routine will substitute in the\n ST_Transform() function call.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L387_C8", "label": "if", "type": "if", "loc": [387, 391], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L381_C4", "vector": [4, 2, 0.6616, 0.0085, 2, 0.24, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value is None or value.srid == f.srid:\n placeholder = '%s'\n else:\n # Adding Transform() to the SQL placeholder.\n placeholder = '%s(%%s, %s)' % (self.transform, f.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L388_C12", "label": "placeholder =", "type": "assigned_variable", "loc": [388, 388], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L387_C8", "vector": [14, 3, 0.6599, 0.0017, 3, 0.1, 0.0, 847, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "placeholder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " placeholder = '%s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L391_C12", "label": "placeholder =", "type": "assigned_variable", "loc": [391, 391], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L387_C8", "vector": [14, 3, 0.665, 0.0017, 3, 0.1, 1.0, 847, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "placeholder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " placeholder = '%s(%%s, %s)' % (self.transform, f.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L393_C8", "label": "if", "type": "if", "loc": [393, 397], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L381_C4", "vector": [4, 2, 0.6718, 0.0085, 2, 0.24, 0.6667, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(value, 'expression'):\n # If this is an F expression, then we don't really want\n # a placeholder and instead substitute in the column\n # of the expression.\n placeholder = placeholder % '%s.%s' % tuple(map(self.quote_name, value.cols[value.expression]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L397_C12", "label": "placeholder =", "type": "assigned_variable", "loc": [397, 397], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L393_C8", "vector": [14, 3, 0.6752, 0.0017, 3, 0.15, 0.0, 847, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "placeholder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " placeholder = placeholder % '%s.%s' % tuple(map(self.quote_name, value.cols[value.expression]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L399_C8", "label": "return", "type": "return", "loc": [399, 399], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L381_C4", "vector": [13, 2, 0.6786, 0.0017, 2, 0.24, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return placeholder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L401_C4", "label": "_get_postgis_func", "type": "function", "loc": [401, 416], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [2, 1, 0.6947, 0.0272, 1, 0.98, 0.5556, 781, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "_get_postgis_func", "arg_names": ["self", "func"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_postgis_func(self, func):\n \"\"\"\n Helper routine for calling PostGIS functions and returning their result.\n \"\"\"\n cursor = self.connection._cursor()\n try:\n try:\n cursor.execute('SELECT %s()' % func)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L402_C8", "label": "expression", "type": "expression", "loc": [402, 404], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L401_C4", "vector": [8, 2, 0.6854, 0.0051, 2, 0.65, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Helper routine for calling PostGIS functions and returning their result.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L405_C8", "label": "cursor = _cursor()", "type": "assigned_variable", "loc": [405, 405], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L401_C4", "vector": [14, 2, 0.6888, 0.0017, 2, 0.65, 0.3333, 231, 3, 0, 0, 0, 670, 10, 1], "semantic": {"name": "cursor", "arg_names": [], "import_names": [], "rhs_call_name": "_cursor", "annotation": ""}, "snippet": " cursor = self.connection._cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Try_L406_C8", "label": "try", "type": "try", "loc": [406, 415], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L401_C4", "vector": [7, 2, 0.6981, 0.017, 2, 0.65, 0.6667, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n try:\n cursor.execute('SELECT %s()' % func)\n row = cursor.fetchone()\n except:\n # Responsibility of callers to perform error handling.\n raise\n finally:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Try_L407_C12", "label": "try", "type": "try", "loc": [407, 412], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:Try_L406_C8", "vector": [7, 3, 0.6964, 0.0102, 3, 0.3, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n cursor.execute('SELECT %s()' % func)\n row = cursor.fetchone()\n except:\n # Responsibility of callers to perform error handling.\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L408_C16", "label": "execute()", "type": "expression", "loc": [408, 408], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:Try_L407_C12", "vector": [8, 4, 0.6939, 0.0017, 4, 0.64, 0.0, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cursor.execute('SELECT %s()' % func)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L409_C16", "label": "row = fetchone()", "type": "assigned_variable", "loc": [409, 409], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:Try_L407_C12", "vector": [14, 4, 0.6956, 0.0017, 4, 0.64, 1.0, 767, 3, 0, 0, 0, 561, 10, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "fetchone", "annotation": ""}, "snippet": " row = cursor.fetchone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L415_C12", "label": "close()", "type": "expression", "loc": [415, 415], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:Try_L406_C8", "vector": [8, 3, 0.7058, 0.0017, 3, 0.3, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " self.connection.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L416_C8", "label": "return", "type": "return", "loc": [416, 416], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L401_C4", "vector": [13, 2, 0.7075, 0.0017, 2, 0.65, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return row[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L418_C4", "label": "postgis_geos_version", "type": "function", "loc": [418, 420], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [2, 1, 0.7126, 0.0051, 1, 0.98, 0.5926, 756, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "postgis_geos_version", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def postgis_geos_version(self):\n \"Returns the version of the GEOS library used with PostGIS.\"\n return self._get_postgis_func('postgis_geos_version')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L419_C8", "label": "expression", "type": "expression", "loc": [419, 419], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L418_C4", "vector": [8, 2, 0.7126, 0.0017, 2, 0.32, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the version of the GEOS library used with PostGIS.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L420_C8", "label": "return", "type": "return", "loc": [420, 420], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L418_C4", "vector": [13, 2, 0.7143, 0.0017, 2, 0.32, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._get_postgis_func('postgis_geos_version')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L422_C4", "label": "postgis_lib_version", "type": "function", "loc": [422, 424], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [2, 1, 0.7194, 0.0051, 1, 0.98, 0.6296, 53, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "postgis_lib_version", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def postgis_lib_version(self):\n \"Returns the version number of the PostGIS library used with PostgreSQL.\"\n return self._get_postgis_func('postgis_lib_version')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L423_C8", "label": "expression", "type": "expression", "loc": [423, 423], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L422_C4", "vector": [8, 2, 0.7194, 0.0017, 2, 0.7, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the version number of the PostGIS library used with PostgreSQL.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L424_C8", "label": "return", "type": "return", "loc": [424, 424], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L422_C4", "vector": [13, 2, 0.7211, 0.0017, 2, 0.7, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._get_postgis_func('postgis_lib_version')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L426_C4", "label": "postgis_proj_version", "type": "function", "loc": [426, 428], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [2, 1, 0.7262, 0.0051, 1, 0.98, 0.6667, 570, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "postgis_proj_version", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def postgis_proj_version(self):\n \"Returns the version of the PROJ.4 library used with PostGIS.\"\n return self._get_postgis_func('postgis_proj_version')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L427_C8", "label": "expression", "type": "expression", "loc": [427, 427], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L426_C4", "vector": [8, 2, 0.7262, 0.0017, 2, 0.86, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the version of the PROJ.4 library used with PostGIS.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L428_C8", "label": "return", "type": "return", "loc": [428, 428], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L426_C4", "vector": [13, 2, 0.7279, 0.0017, 2, 0.86, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._get_postgis_func('postgis_proj_version')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L430_C4", "label": "postgis_version", "type": "function", "loc": [430, 432], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [2, 1, 0.733, 0.0051, 1, 0.98, 0.7037, 170, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "postgis_version", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def postgis_version(self):\n \"Returns PostGIS version number and compile-time options.\"\n return self._get_postgis_func('postgis_version')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L431_C8", "label": "expression", "type": "expression", "loc": [431, 431], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L430_C4", "vector": [8, 2, 0.733, 0.0017, 2, 0.71, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns PostGIS version number and compile-time options.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L432_C8", "label": "return", "type": "return", "loc": [432, 432], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L430_C4", "vector": [13, 2, 0.7347, 0.0017, 2, 0.71, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._get_postgis_func('postgis_version')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L434_C4", "label": "postgis_full_version", "type": "function", "loc": [434, 436], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [2, 1, 0.7398, 0.0051, 1, 0.98, 0.7407, 297, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "postgis_full_version", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def postgis_full_version(self):\n \"Returns PostGIS version number and compile-time options.\"\n return self._get_postgis_func('postgis_full_version')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L435_C8", "label": "expression", "type": "expression", "loc": [435, 435], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L434_C4", "vector": [8, 2, 0.7398, 0.0017, 2, 0.64, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns PostGIS version number and compile-time options.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L436_C8", "label": "return", "type": "return", "loc": [436, 436], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L434_C4", "vector": [13, 2, 0.7415, 0.0017, 2, 0.64, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._get_postgis_func('postgis_full_version')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L438_C4", "label": "postgis_version_tuple", "type": "function", "loc": [438, 454], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [2, 1, 0.7585, 0.0289, 1, 0.98, 0.7778, 477, 0, 1, 1, 0, 0, 0, 9], "semantic": {"name": "postgis_version_tuple", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def postgis_version_tuple(self):\n \"\"\"\n Returns the PostGIS version as a tuple (version string, major,\n minor, subminor).\n \"\"\"\n # Getting the PostGIS version\n version = self.postgis_lib_version()\n m = self.version_regex.match(version)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L439_C8", "label": "expression", "type": "expression", "loc": [439, 442], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L438_C4", "vector": [8, 2, 0.7491, 0.0068, 2, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the PostGIS version as a tuple (version string, major,\n minor, subminor).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L444_C8", "label": "version = postgis_lib_version()", "type": "assigned_variable", "loc": [444, 444], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L438_C4", "vector": [14, 2, 0.7551, 0.0017, 2, 0.25, 0.25, 623, 3, 0, 0, 0, 53, 10, 1], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "postgis_lib_version", "annotation": ""}, "snippet": " version = self.postgis_lib_version()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L445_C8", "label": "m = match()", "type": "assigned_variable", "loc": [445, 445], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L438_C4", "vector": [14, 2, 0.7568, 0.0017, 2, 0.25, 0.5, 711, 3, 1, 0, 0, 36, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " m = self.version_regex.match(version)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L447_C8", "label": "if", "type": "if", "loc": [447, 452], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L438_C4", "vector": [4, 2, 0.7645, 0.0102, 2, 0.25, 0.75, 0, 2, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if m:\n major = int(m.group('major'))\n minor1 = int(m.group('minor1'))\n minor2 = int(m.group('minor2'))\n else:\n raise Exception('Could not parse PostGIS version string: %s' % version)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L448_C12", "label": "major = int()", "type": "assigned_variable", "loc": [448, 448], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L447_C8", "vector": [14, 3, 0.7619, 0.0017, 3, 0.92, 0.0, 681, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "major", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " major = int(m.group('major'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L449_C12", "label": "minor1 = int()", "type": "assigned_variable", "loc": [449, 449], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L447_C8", "vector": [14, 3, 0.7636, 0.0017, 3, 0.92, 0.5, 282, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "minor1", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " minor1 = int(m.group('minor1'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L450_C12", "label": "minor2 = int()", "type": "assigned_variable", "loc": [450, 450], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L447_C8", "vector": [14, 3, 0.7653, 0.0017, 3, 0.92, 1.0, 453, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "minor2", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " minor2 = int(m.group('minor2'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L454_C8", "label": "return", "type": "return", "loc": [454, 454], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L438_C4", "vector": [13, 2, 0.7721, 0.0017, 2, 0.25, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (version, major, minor1, minor2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L456_C4", "label": "proj_version_tuple", "type": "function", "loc": [456, 467], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [2, 1, 0.7849, 0.0204, 1, 0.98, 0.8148, 963, 0, 1, 1, 0, 0, 0, 9], "semantic": {"name": "proj_version_tuple", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def proj_version_tuple(self):\n \"\"\"\n Return the version of PROJ.4 used by PostGIS as a tuple of the\n major, minor, and subminor release numbers.\n \"\"\"\n proj_regex = re.compile(r'(\\d+)\\.(\\d+)\\.(\\d+)')\n proj_ver_str = self.postgis_proj_version()\n m = proj_regex.search(proj_ver_str)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L457_C8", "label": "expression", "type": "expression", "loc": [457, 460], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L456_C4", "vector": [8, 2, 0.7798, 0.0068, 2, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Return the version of PROJ.4 used by PostGIS as a tuple of the\n major, minor, and subminor release numbers.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L461_C8", "label": "proj_regex = compile()", "type": "assigned_variable", "loc": [461, 461], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L456_C4", "vector": [14, 2, 0.784, 0.0017, 2, 0.25, 0.25, 919, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "proj_regex", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " proj_regex = re.compile(r'(\\d+)\\.(\\d+)\\.(\\d+)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L462_C8", "label": "proj_ver_str = postgis_proj_version()", "type": "assigned_variable", "loc": [462, 462], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L456_C4", "vector": [14, 2, 0.7857, 0.0017, 2, 0.25, 0.5, 309, 3, 0, 0, 0, 570, 10, 1], "semantic": {"name": "proj_ver_str", "arg_names": [], "import_names": [], "rhs_call_name": "postgis_proj_version", "annotation": ""}, "snippet": " proj_ver_str = self.postgis_proj_version()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L463_C8", "label": "m = search()", "type": "assigned_variable", "loc": [463, 463], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L456_C4", "vector": [14, 2, 0.7874, 0.0017, 2, 0.25, 0.75, 711, 3, 1, 0, 0, 163, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "search", "annotation": ""}, "snippet": " m = proj_regex.search(proj_ver_str)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L464_C8", "label": "if", "type": "if", "loc": [464, 467], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L456_C4", "vector": [4, 2, 0.7917, 0.0068, 2, 0.25, 1.0, 0, 2, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if m:\n return tuple(map(int, [m.group(1), m.group(2), m.group(3)]))\n else:\n raise Exception('Could not determine PROJ.4 version from PostGIS.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L465_C12", "label": "return", "type": "return", "loc": [465, 465], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L464_C8", "vector": [13, 3, 0.7908, 0.0017, 3, 0.47, 0.0, 0, 3, 0, 0, 0, 0, 10, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return tuple(map(int, [m.group(1), m.group(2), m.group(3)]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L469_C4", "label": "num_params", "type": "function", "loc": [469, 480], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [2, 1, 0.807, 0.0204, 1, 0.98, 0.8519, 11, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "num_params", "arg_names": ["self", "lookup_type", "num_param"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def num_params(self, lookup_type, num_param):\n \"\"\"\n Helper routine that returns a boolean indicating whether the number of\n parameters is correct for the lookup type.\n \"\"\"\n def exactly_two(np): return np == 2\n def two_to_three(np): return np >= 2 and np <=3\n if (lookup_type in self.distance_functions and"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L470_C8", "label": "expression", "type": "expression", "loc": [470, 473], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L469_C4", "vector": [8, 2, 0.8019, 0.0068, 2, 0.97, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Helper routine that returns a boolean indicating whether the number of\n parameters is correct for the lookup type.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L474_C8", "label": "exactly_two", "type": "function", "loc": [474, 474], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L469_C4", "vector": [2, 2, 0.8061, 0.0017, 2, 0.97, 0.3333, 812, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "exactly_two", "arg_names": ["np"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def exactly_two(np): return np == 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L474_C29", "label": "return", "type": "return", "loc": [474, 474], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L474_C8", "vector": [13, 3, 0.8061, 0.0017, 3, 0.83, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def exactly_two(np): return np == 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L475_C8", "label": "two_to_three", "type": "function", "loc": [475, 475], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L469_C4", "vector": [2, 2, 0.8078, 0.0017, 2, 0.97, 0.6667, 854, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "two_to_three", "arg_names": ["np"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def two_to_three(np): return np >= 2 and np <=3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L475_C30", "label": "return", "type": "return", "loc": [475, 475], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L475_C8", "vector": [13, 3, 0.8078, 0.0017, 3, 0.99, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def two_to_three(np): return np >= 2 and np <=3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L476_C8", "label": "if", "type": "if", "loc": [476, 480], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L469_C4", "vector": [4, 2, 0.8129, 0.0085, 2, 0.97, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (lookup_type in self.distance_functions and\n lookup_type != 'dwithin'):\n return two_to_three(num_param)\n else:\n return exactly_two(num_param)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L478_C12", "label": "return", "type": "return", "loc": [478, 478], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L476_C8", "vector": [13, 3, 0.8129, 0.0017, 3, 0.47, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return two_to_three(num_param)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L480_C12", "label": "return", "type": "return", "loc": [480, 480], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L476_C8", "vector": [13, 3, 0.8163, 0.0017, 3, 0.47, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return exactly_two(num_param)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L482_C4", "label": "spatial_lookup_sql", "type": "function", "loc": [482, 565], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [2, 1, 0.8903, 0.1429, 1, 0.98, 0.8889, 975, 0, 6, 1, 0, 0, 0, 24], "semantic": {"name": "spatial_lookup_sql", "arg_names": ["self", "lvalue", "lookup_type", "value", "field", "qn"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def spatial_lookup_sql(self, lvalue, lookup_type, value, field, qn):\n \"\"\"\n Constructs spatial SQL from the given lookup value tuple a\n (alias, col, db_type), the lookup type string, lookup value, and\n the geometry field.\n \"\"\"\n alias, col, db_type = lvalue\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L483_C8", "label": "expression", "type": "expression", "loc": [483, 487], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L482_C4", "vector": [8, 2, 0.8248, 0.0085, 2, 0.8, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Constructs spatial SQL from the given lookup value tuple a\n (alias, col, db_type), the lookup type string, lookup value, and\n the geometry field.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L488_C8", "label": "alias, col, db_type =", "type": "assigned_variable", "loc": [488, 488], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L482_C4", "vector": [14, 2, 0.8299, 0.0017, 2, 0.8, 0.3333, 237, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "alias, col, db_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " alias, col, db_type = lvalue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L491_C8", "label": "geo_col =", "type": "assigned_variable", "loc": [491, 491], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L482_C4", "vector": [14, 2, 0.835, 0.0017, 2, 0.8, 0.6667, 139, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "geo_col", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geo_col = '%s.%s' % (qn(alias), qn(col))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L493_C8", "label": "if", "type": "if", "loc": [493, 563], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L482_C4", "vector": [4, 2, 0.898, 0.1207, 2, 0.8, 1.0, 0, 0, 0, 0, 0, 0, 0, 20], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lookup_type in self.geometry_operators:\n if field.geography and not lookup_type in self.geography_operators:\n raise ValueError('PostGIS geography does not support the '\n '\"%s\" lookup.' % lookup_type)\n # Handling a PostGIS operator.\n op = self.geometry_operators[lookup_type]\n return op.as_sql(geo_col, self.get_geom_placeholder(field, value))\n elif lookup_type in self.geometry_functions:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L494_C12", "label": "if", "type": "if", "loc": [494, 496], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L493_C8", "vector": [4, 3, 0.8418, 0.0051, 3, 0.78, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if field.geography and not lookup_type in self.geography_operators:\n raise ValueError('PostGIS geography does not support the '\n '\"%s\" lookup.' % lookup_type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L498_C12", "label": "op =", "type": "assigned_variable", "loc": [498, 498], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L493_C8", "vector": [14, 3, 0.8469, 0.0017, 3, 0.78, 0.3333, 316, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " op = self.geometry_operators[lookup_type]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L499_C12", "label": "return", "type": "return", "loc": [499, 499], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L493_C8", "vector": [13, 3, 0.8486, 0.0017, 3, 0.78, 0.6667, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return op.as_sql(geo_col, self.get_geom_placeholder(field, value))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L500_C8", "label": "if", "type": "if", "loc": [500, 563], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L493_C8", "vector": [4, 3, 0.9039, 0.1088, 3, 0.78, 1.0, 0, 0, 0, 0, 0, 0, 0, 17], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif lookup_type in self.geometry_functions:\n if field.geography and not lookup_type in self.geography_functions:\n raise ValueError('PostGIS geography type does not support the '\n '\"%s\" lookup.' % lookup_type)\n\n # See if a PostGIS geometry function matches the lookup type.\n tmp = self.geometry_functions[lookup_type]\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L501_C12", "label": "if", "type": "if", "loc": [501, 503], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L500_C8", "vector": [4, 4, 0.8537, 0.0051, 4, 0.47, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if field.geography and not lookup_type in self.geography_functions:\n raise ValueError('PostGIS geography type does not support the '\n '\"%s\" lookup.' % lookup_type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L506_C12", "label": "tmp =", "type": "assigned_variable", "loc": [506, 506], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L500_C8", "vector": [14, 4, 0.8605, 0.0017, 4, 0.47, 0.25, 517, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tmp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tmp = self.geometry_functions[lookup_type]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L510_C12", "label": "if", "type": "if", "loc": [510, 556], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L500_C8", "vector": [4, 4, 0.9065, 0.0799, 4, 0.47, 0.5, 0, 3, 0, 0, 0, 0, 0, 14], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(tmp, tuple):\n # First element of tuple is the PostGISOperation instance, and the\n # second element is either the type or a tuple of acceptable types\n # that may passed in as further parameters for the lookup type.\n op, arg_type = tmp\n\n # Ensuring that a tuple _value_ was passed in from the user\n if not isinstance(value, (tuple, list)):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L514_C16", "label": "op, arg_type =", "type": "assigned_variable", "loc": [514, 514], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L510_C12", "vector": [14, 5, 0.8741, 0.0017, 5, 0.44, 0.0, 709, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "op, arg_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " op, arg_type = tmp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L517_C16", "label": "if", "type": "if", "loc": [517, 518], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L510_C12", "vector": [4, 5, 0.8801, 0.0034, 5, 0.44, 0.125, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(value, (tuple, list)):\n raise ValueError('Tuple required for `%s` lookup type.' % lookup_type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L521_C16", "label": "geom =", "type": "assigned_variable", "loc": [521, 521], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L510_C12", "vector": [14, 5, 0.8861, 0.0017, 5, 0.44, 0.25, 5, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geom", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geom = value[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L524_C16", "label": "nparams = len()", "type": "assigned_variable", "loc": [524, 524], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L510_C12", "vector": [14, 5, 0.8912, 0.0017, 5, 0.44, 0.375, 974, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "nparams", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " nparams = len(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L525_C16", "label": "if", "type": "if", "loc": [525, 526], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L510_C12", "vector": [4, 5, 0.8937, 0.0034, 5, 0.44, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.num_params(lookup_type, nparams):\n raise ValueError('Incorrect number of parameters given for `%s` lookup type.' % lookup_type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L529_C16", "label": "if", "type": "if", "loc": [529, 530], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L510_C12", "vector": [4, 5, 0.9005, 0.0034, 5, 0.44, 0.625, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(value[1], arg_type):\n raise ValueError('Argument type should be %s, got %s instead.' % (arg_type, type(value[1])))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L534_C16", "label": "if", "type": "if", "loc": [534, 553], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L510_C12", "vector": [4, 5, 0.9243, 0.034, 5, 0.44, 0.75, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lookup_type == 'relate':\n op = op(self.geom_func_prefix, value[1])\n elif lookup_type in self.distance_functions and lookup_type != 'dwithin':\n if not field.geography and field.geodetic(self.connection):\n # Geodetic distances are only availble from Points to\n # PointFields on PostGIS 1.4 and below.\n if not self.connection.ops.geography:\n if field.geom_type != 'POINT':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L535_C20", "label": "op = op()", "type": "assigned_variable", "loc": [535, 535], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L534_C16", "vector": [14, 6, 0.9099, 0.0017, 6, 0.63, 0.0, 316, 3, 2, 0, 0, 316, 10, 1], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "op", "annotation": ""}, "snippet": " op = op(self.geom_func_prefix, value[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L536_C16", "label": "if", "type": "if", "loc": [536, 553], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L534_C16", "vector": [4, 6, 0.926, 0.0306, 6, 0.63, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif lookup_type in self.distance_functions and lookup_type != 'dwithin':\n if not field.geography and field.geodetic(self.connection):\n # Geodetic distances are only availble from Points to\n # PointFields on PostGIS 1.4 and below.\n if not self.connection.ops.geography:\n if field.geom_type != 'POINT':\n raise ValueError('PostGIS spherical operations are only valid on PointFields.')\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L537_C20", "label": "if", "type": "if", "loc": [537, 553], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L536_C16", "vector": [4, 7, 0.9269, 0.0289, 7, 0.75, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not field.geography and field.geodetic(self.connection):\n # Geodetic distances are only availble from Points to\n # PointFields on PostGIS 1.4 and below.\n if not self.connection.ops.geography:\n if field.geom_type != 'POINT':\n raise ValueError('PostGIS spherical operations are only valid on PointFields.')\n\n if str(geom.geom_type) != 'Point':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L540_C24", "label": "if", "type": "if", "loc": [540, 545], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L537_C20", "vector": [4, 8, 0.9226, 0.0102, 8, 0.47, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.connection.ops.geography:\n if field.geom_type != 'POINT':\n raise ValueError('PostGIS spherical operations are only valid on PointFields.')\n\n if str(geom.geom_type) != 'Point':\n raise ValueError('PostGIS geometry distance parameter is required to be of type Point.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L541_C28", "label": "if", "type": "if", "loc": [541, 542], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L540_C24", "vector": [4, 9, 0.9209, 0.0034, 9, 0.39, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if field.geom_type != 'POINT':\n raise ValueError('PostGIS spherical operations are only valid on PointFields.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L544_C28", "label": "if", "type": "if", "loc": [544, 545], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L540_C24", "vector": [4, 9, 0.926, 0.0034, 9, 0.39, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if str(geom.geom_type) != 'Point':\n raise ValueError('PostGIS geometry distance parameter is required to be of type Point.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L548_C24", "label": "if", "type": "if", "loc": [548, 551], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L537_C20", "vector": [4, 8, 0.9345, 0.0068, 8, 0.47, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if nparams == 3 and value[2] == 'spheroid':\n op = op['spheroid']\n else:\n op = op['sphere']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L549_C28", "label": "op =", "type": "assigned_variable", "loc": [549, 549], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L548_C24", "vector": [14, 9, 0.9337, 0.0017, 9, 0.94, 0.0, 316, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " op = op['spheroid']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L551_C28", "label": "op =", "type": "assigned_variable", "loc": [551, 551], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L548_C24", "vector": [14, 9, 0.9371, 0.0017, 9, 0.94, 1.0, 316, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " op = op['sphere']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L553_C24", "label": "op =", "type": "assigned_variable", "loc": [553, 553], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L537_C20", "vector": [14, 8, 0.9405, 0.0017, 8, 0.47, 1.0, 316, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " op = op['cartesian']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L555_C16", "label": "op =", "type": "assigned_variable", "loc": [555, 555], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L510_C12", "vector": [14, 5, 0.9439, 0.0017, 5, 0.44, 0.875, 316, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " op = tmp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L556_C16", "label": "geom =", "type": "assigned_variable", "loc": [556, 556], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L510_C12", "vector": [14, 5, 0.9456, 0.0017, 5, 0.44, 1.0, 5, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geom", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geom = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L559_C12", "label": "return", "type": "return", "loc": [559, 559], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L500_C8", "vector": [13, 4, 0.9507, 0.0017, 4, 0.47, 0.75, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return op.as_sql(geo_col, self.get_geom_placeholder(field, geom))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L561_C8", "label": "if", "type": "if", "loc": [561, 563], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L500_C8", "vector": [4, 4, 0.9558, 0.0051, 4, 0.47, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif lookup_type == 'isnull':\n # Handling 'isnull' lookup type\n return \"%s IS %sNULL\" % (geo_col, (not value and 'NOT ' or ''))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L563_C12", "label": "return", "type": "return", "loc": [563, 563], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L561_C8", "vector": [13, 5, 0.9575, 0.0017, 5, 0.51, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"%s IS %sNULL\" % (geo_col, (not value and 'NOT ' or ''))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L567_C4", "label": "spatial_aggregate_sql", "type": "function", "loc": [567, 579], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [2, 1, 0.9745, 0.0221, 1, 0.98, 0.9259, 835, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "spatial_aggregate_sql", "arg_names": ["self", "agg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def spatial_aggregate_sql(self, agg):\n \"\"\"\n Returns the spatial aggregate SQL template and function for the\n given Aggregate instance.\n \"\"\"\n agg_name = agg.__class__.__name__\n if not self.check_aggregate_support(agg):\n raise NotImplementedError('%s spatial aggregate is not implmented for this backend.' % agg_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L568_C8", "label": "expression", "type": "expression", "loc": [568, 571], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L567_C4", "vector": [8, 2, 0.9685, 0.0068, 2, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the spatial aggregate SQL template and function for the\n given Aggregate instance.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L572_C8", "label": "agg_name =", "type": "assigned_variable", "loc": [572, 572], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L567_C4", "vector": [14, 2, 0.9728, 0.0017, 2, 0.73, 0.1429, 817, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "agg_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " agg_name = agg.__class__.__name__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L573_C8", "label": "if", "type": "if", "loc": [573, 574], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L567_C4", "vector": [4, 2, 0.9753, 0.0034, 2, 0.73, 0.2857, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.check_aggregate_support(agg):\n raise NotImplementedError('%s spatial aggregate is not implmented for this backend.' % agg_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L575_C8", "label": "agg_name = lower()", "type": "assigned_variable", "loc": [575, 575], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L567_C4", "vector": [14, 2, 0.9779, 0.0017, 2, 0.73, 0.4286, 817, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "agg_name", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " agg_name = agg_name.lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L576_C8", "label": "if", "type": "if", "loc": [576, 576], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L567_C4", "vector": [4, 2, 0.9796, 0.0017, 2, 0.73, 0.5714, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if agg_name == 'union': agg_name += 'agg'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L577_C8", "label": "sql_template =", "type": "assigned_variable", "loc": [577, 577], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L567_C4", "vector": [14, 2, 0.9813, 0.0017, 2, 0.73, 0.7143, 765, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sql_template", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sql_template = '%(function)s(%(field)s)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L578_C8", "label": "sql_function = getattr()", "type": "assigned_variable", "loc": [578, 578], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L567_C4", "vector": [14, 2, 0.983, 0.0017, 2, 0.73, 0.8571, 586, 3, 2, 0, 0, 121, 10, 1], "semantic": {"name": "sql_function", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " sql_function = getattr(self, agg_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L579_C8", "label": "return", "type": "return", "loc": [579, 579], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L567_C4", "vector": [13, 2, 0.9847, 0.0017, 2, 0.73, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sql_template, sql_function"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L582_C4", "label": "geometry_columns", "type": "function", "loc": [582, 584], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [2, 1, 0.9915, 0.0051, 1, 0.98, 0.963, 291, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "geometry_columns", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geometry_columns(self):\n from django.contrib.gis.db.backends.postgis.models import GeometryColumns\n return GeometryColumns"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:ImportFrom_L583_C8", "label": "from django.contrib.gis.db.backends.postgis.models import GeometryColumns", "type": "import", "loc": [583, 583], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L582_C4", "vector": [1, 2, 0.9915, 0.0017, 2, 0.34, 0.0, 639, 0, 1, 0, 0, 639, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.postgis.models", "arg_names": [], "import_names": ["GeometryColumns"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.db.backends.postgis.models import GeometryColumns"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L584_C8", "label": "return", "type": "return", "loc": [584, 584], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L582_C4", "vector": [13, 2, 0.9932, 0.0017, 2, 0.34, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return GeometryColumns"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L586_C4", "label": "spatial_ref_sys", "type": "function", "loc": [586, 588], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "vector": [2, 1, 0.9983, 0.0051, 1, 0.98, 1.0, 318, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "spatial_ref_sys", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def spatial_ref_sys(self):\n from django.contrib.gis.db.backends.postgis.models import SpatialRefSys\n return SpatialRefSys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:ImportFrom_L587_C8", "label": "from django.contrib.gis.db.backends.postgis.models import SpatialRefSys", "type": "import", "loc": [587, 587], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L586_C4", "vector": [1, 2, 0.9983, 0.0017, 2, 0.12, 0.0, 639, 0, 1, 0, 0, 639, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.postgis.models", "arg_names": [], "import_names": ["SpatialRefSys"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.db.backends.postgis.models import SpatialRefSys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L588_C8", "label": "return", "type": "return", "loc": [588, 588], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L586_C4", "vector": [13, 2, 1.0, 0.0017, 2, 0.12, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return SpatialRefSys"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Try_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:Try_L80_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L81_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L81_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L82_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L81_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L83_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L83_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L85_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L83_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L89_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L81_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L91_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L81_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L92_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:Try_L80_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L97_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L98_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L97_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L100_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:Try_L80_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L102_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:Try_L80_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L103_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L170_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L171_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L170_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L172_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L184_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L185_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L184_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L187_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L184_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L188_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L184_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L192_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L195_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L199_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L199_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L200_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L199_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L201_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L199_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L202_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L199_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L204_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L199_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L205_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L199_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L206_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L209_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L209_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L210_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L209_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L212_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L215_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L215_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L216_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L215_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L217_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L215_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L218_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L215_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L220_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L223_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L223_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L224_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L223_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L227_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L223_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L228_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L223_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L233_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L238_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L241_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L243_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L244_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L245_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L246_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L247_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L248_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L249_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L250_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L252_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L253_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L254_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L255_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L256_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L257_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L258_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L259_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L260_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L261_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L262_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L263_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L264_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L265_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L266_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L267_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L268_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L269_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L270_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L271_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L272_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L273_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L274_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L275_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L276_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L278_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L279_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L281_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L281_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L282_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L281_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L286_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L281_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L287_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L289_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L289_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L290_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L289_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L295_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L289_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L296_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L289_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L297_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L289_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L298_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L300_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L300_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L301_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L300_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L306_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L300_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L307_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L300_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L308_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L300_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L309_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L311_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L311_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L312_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L311_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L315_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L315_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L316_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L315_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L318_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L320_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L320_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L321_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L320_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L327_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L327_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L328_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L327_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L331_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L327_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L335_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L327_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L337_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L339_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L339_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L340_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L339_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L350_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L351_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L353_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L339_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L356_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L339_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L357_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L339_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L359_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L359_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L360_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L360_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L361_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L360_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L362_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L362_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L363_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L362_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L366_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L362_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L368_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L359_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L371_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L339_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L373_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L373_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L377_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L373_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L379_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L381_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L381_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L382_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L381_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L387_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L387_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L388_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L387_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L391_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L381_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L393_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L393_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L397_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L381_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L399_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L401_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L401_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L402_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L401_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L405_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L401_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Try_L406_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:Try_L406_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Try_L407_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:Try_L407_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L408_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:Try_L407_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L409_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:Try_L406_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L415_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L401_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L416_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L418_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L418_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L419_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L418_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L420_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L422_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L422_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L423_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L422_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L424_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L426_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L426_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L427_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L426_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L428_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L430_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L430_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L431_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L430_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L432_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L434_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L434_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L435_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L434_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L436_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L438_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L438_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L439_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L438_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L444_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L438_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L445_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L438_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L447_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L447_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L448_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L447_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L449_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L447_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L450_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L438_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L454_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L456_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L456_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L457_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L456_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L461_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L456_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L462_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L456_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L463_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L456_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L464_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L464_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L465_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L469_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L469_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L470_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L469_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L474_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L474_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L474_C29"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L469_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L475_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L475_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L475_C30"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L469_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L476_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L476_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L478_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L476_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L480_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L482_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L482_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L483_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L482_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L488_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L482_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L491_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L482_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L493_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L493_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L494_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L493_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L498_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L493_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L499_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L493_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L500_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L500_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L501_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L500_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L506_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L500_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L510_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L510_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L514_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L510_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L517_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L510_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L521_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L510_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L524_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L510_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L525_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L510_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L529_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L510_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L534_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L534_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L535_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L534_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L536_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L536_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L537_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L537_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L540_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L540_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L541_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L540_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L544_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L537_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L548_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L548_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L549_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L548_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L551_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L537_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L553_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L510_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L555_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L510_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L556_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L500_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L559_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L500_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L561_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L561_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L563_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L567_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L567_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L568_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L567_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L572_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L567_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L573_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L567_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L575_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L567_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:If_L576_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L567_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L577_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L567_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Assign_L578_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L567_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L579_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L582_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L582_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:ImportFrom_L583_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L582_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L584_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L586_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L586_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:ImportFrom_L587_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L586_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Return_L588_C8"}] |
from django.conf import settings
from django.db.backends.postgresql.creation import DatabaseCreation
class PostGISCreation(DatabaseCreation):
geom_index_type = 'GIST'
geom_index_opts = 'GIST_GEOMETRY_OPS'
def sql_indexes_for_field(self, model, f, style):
"Return any spatial index creation SQL for the field."
from django.contrib.gis.db.models.fields import GeometryField
output = super(PostGISCreation, self).sql_indexes_for_field(model, f, style)
if isinstance(f, GeometryField):
gqn = self.connection.ops.geo_quote_name
qn = self.connection.ops.quote_name
db_table = model._meta.db_table
if f.geography:
# Geogrophy columns are created normally.
pass
else:
# Geometry columns are created by `AddGeometryColumn`
# stored procedure.
output.append(style.SQL_KEYWORD('SELECT ') +
style.SQL_TABLE('AddGeometryColumn') + '(' +
style.SQL_TABLE(gqn(db_table)) + ', ' +
style.SQL_FIELD(gqn(f.column)) + ', ' +
style.SQL_FIELD(str(f.srid)) + ', ' +
style.SQL_COLTYPE(gqn(f.geom_type)) + ', ' +
style.SQL_KEYWORD(str(f.dim)) + ');')
if not f.null:
# Add a NOT NULL constraint to the field
output.append(style.SQL_KEYWORD('ALTER TABLE ') +
style.SQL_TABLE(qn(db_table)) +
style.SQL_KEYWORD(' ALTER ') +
style.SQL_FIELD(qn(f.column)) +
style.SQL_KEYWORD(' SET NOT NULL') + ';')
if f.spatial_index:
# Spatial indexes created the same way for both Geometry and
# Geography columns
if f.geography:
index_opts = ''
else:
index_opts = ' ' + style.SQL_KEYWORD(self.geom_index_opts)
output.append(style.SQL_KEYWORD('CREATE INDEX ') +
style.SQL_TABLE(qn('%s_%s_id' % (db_table, f.column))) +
style.SQL_KEYWORD(' ON ') +
style.SQL_TABLE(qn(db_table)) +
style.SQL_KEYWORD(' USING ') +
style.SQL_COLTYPE(self.geom_index_type) + ' ( ' +
style.SQL_FIELD(qn(f.column)) + index_opts + ' );')
return output
def sql_table_creation_suffix(self):
qn = self.connection.ops.quote_name
return ' TEMPLATE %s' % qn(getattr(settings, 'POSTGIS_TEMPLATE', 'template_postgis'))
| ajibawa-2023/Python-Code-Large/train/row_98778 | 26 | 60 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98778:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0167, 0.0167, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98778:ImportFrom_L2_C0", "label": "from django.db.backends.postgresql.creation import DatabaseCreation", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0333, 0.0167, 0, 0.66, 0.5, 575, 0, 1, 0, 0, 575, 0, 0], "semantic": {"name": "django.db.backends.postgresql.creation", "arg_names": [], "import_names": ["DatabaseCreation"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.backends.postgresql.creation import DatabaseCreation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98778:ClassDef_L4_C0", "label": "PostGISCreation", "type": "class", "loc": [4, 60], "level": 0, "parent": null, "vector": [3, 0, 0.5333, 0.95, 0, 0.66, 1.0, 938, 0, 2, 0, 0, 625, 0, 38], "semantic": {"name": "PostGISCreation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PostGISCreation(DatabaseCreation):\n geom_index_type = 'GIST'\n geom_index_opts = 'GIST_GEOMETRY_OPS'\n\n def sql_indexes_for_field(self, model, f, style):\n \"Return any spatial index creation SQL for the field.\"\n from django.contrib.gis.db.models.fields import GeometryField\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98778:Assign_L5_C4", "label": "geom_index_type =", "type": "assigned_variable", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98778:ClassDef_L4_C0", "vector": [14, 1, 0.0833, 0.0167, 1, 0.79, 0.0, 119, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "geom_index_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geom_index_type = 'GIST'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98778:Assign_L6_C4", "label": "geom_index_opts =", "type": "assigned_variable", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98778:ClassDef_L4_C0", "vector": [14, 1, 0.1, 0.0167, 1, 0.79, 0.3333, 408, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "geom_index_opts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geom_index_opts = 'GIST_GEOMETRY_OPS'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98778:FunctionDef_L8_C4", "label": "sql_indexes_for_field", "type": "function", "loc": [8, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98778:ClassDef_L4_C0", "vector": [2, 1, 0.5333, 0.8167, 1, 0.79, 0.6667, 570, 0, 4, 1, 0, 0, 0, 36], "semantic": {"name": "sql_indexes_for_field", "arg_names": ["self", "model", "f", "style"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def sql_indexes_for_field(self, model, f, style):\n \"Return any spatial index creation SQL for the field.\"\n from django.contrib.gis.db.models.fields import GeometryField\n\n output = super(PostGISCreation, self).sql_indexes_for_field(model, f, style)\n\n if isinstance(f, GeometryField):\n gqn = self.connection.ops.geo_quote_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98778:Expr_L9_C8", "label": "expression", "type": "expression", "loc": [9, 9], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98778:FunctionDef_L8_C4", "vector": [8, 2, 0.15, 0.0167, 2, 0.81, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Return any spatial index creation SQL for the field.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98778:ImportFrom_L10_C8", "label": "from django.contrib.gis.db.models.fields import GeometryField", "type": "import", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98778:FunctionDef_L8_C4", "vector": [1, 2, 0.1667, 0.0167, 2, 0.81, 0.25, 708, 0, 1, 0, 0, 708, 0, 0], "semantic": {"name": "django.contrib.gis.db.models.fields", "arg_names": [], "import_names": ["GeometryField"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.db.models.fields import GeometryField"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98778:Assign_L12_C8", "label": "output = sql_indexes_for_field()", "type": "assigned_variable", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98778:FunctionDef_L8_C4", "vector": [14, 2, 0.2, 0.0167, 2, 0.81, 0.5, 886, 3, 3, 0, 0, 570, 10, 2], "semantic": {"name": "output", "arg_names": [], "import_names": [], "rhs_call_name": "sql_indexes_for_field", "annotation": ""}, "snippet": " output = super(PostGISCreation, self).sql_indexes_for_field(model, f, style)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L14_C8", "label": "if", "type": "if", "loc": [14, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98778:FunctionDef_L8_C4", "vector": [4, 2, 0.575, 0.7, 2, 0.81, 0.75, 0, 3, 0, 0, 0, 0, 0, 34], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(f, GeometryField):\n gqn = self.connection.ops.geo_quote_name\n qn = self.connection.ops.quote_name\n db_table = model._meta.db_table\n\n if f.geography:\n # Geogrophy columns are created normally.\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98778:Assign_L15_C12", "label": "gqn =", "type": "assigned_variable", "loc": [15, 15], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L14_C8", "vector": [14, 3, 0.25, 0.0167, 3, 0.71, 0.0, 613, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "gqn", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " gqn = self.connection.ops.geo_quote_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98778:Assign_L16_C12", "label": "qn =", "type": "assigned_variable", "loc": [16, 16], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L14_C8", "vector": [14, 3, 0.2667, 0.0167, 3, 0.71, 0.25, 514, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "qn", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " qn = self.connection.ops.quote_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98778:Assign_L17_C12", "label": "db_table =", "type": "assigned_variable", "loc": [17, 17], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L14_C8", "vector": [14, 3, 0.2833, 0.0167, 3, 0.71, 0.5, 111, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "db_table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " db_table = model._meta.db_table"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L19_C12", "label": "if", "type": "if", "loc": [19, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L14_C8", "vector": [4, 3, 0.4833, 0.35, 3, 0.71, 0.75, 0, 7, 0, 0, 0, 0, 0, 21], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if f.geography:\n # Geogrophy columns are created normally.\n pass\n else:\n # Geometry columns are created by `AddGeometryColumn`\n # stored procedure.\n output.append(style.SQL_KEYWORD('SELECT ') +\n style.SQL_TABLE('AddGeometryColumn') + '(' +"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98778:Expr_L25_C16", "label": "append()", "type": "expression", "loc": [25, 31], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L19_C12", "vector": [8, 4, 0.4667, 0.1167, 4, 0.21, 0.0, 243, 3, 1, 0, 0, 0, 0, 13], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " output.append(style.SQL_KEYWORD('SELECT ') +\n style.SQL_TABLE('AddGeometryColumn') + '(' +\n style.SQL_TABLE(gqn(db_table)) + ', ' +\n style.SQL_FIELD(gqn(f.column)) + ', ' +\n style.SQL_FIELD(str(f.srid)) + ', ' +\n style.SQL_COLTYPE(gqn(f.geom_type)) + ', ' +\n style.SQL_KEYWORD(str(f.dim)) + ');')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L33_C16", "label": "if", "type": "if", "loc": [33, 39], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L19_C12", "vector": [4, 4, 0.6, 0.1167, 4, 0.21, 1.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not f.null:\n # Add a NOT NULL constraint to the field\n output.append(style.SQL_KEYWORD('ALTER TABLE ') +\n style.SQL_TABLE(qn(db_table)) +\n style.SQL_KEYWORD(' ALTER ') +\n style.SQL_FIELD(qn(f.column)) +\n style.SQL_KEYWORD(' SET NOT NULL') + ';')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98778:Expr_L35_C20", "label": "append()", "type": "expression", "loc": [35, 39], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L33_C16", "vector": [8, 5, 0.6167, 0.0833, 5, 0.38, 0.0, 243, 3, 1, 0, 0, 0, 0, 8], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " output.append(style.SQL_KEYWORD('ALTER TABLE ') +\n style.SQL_TABLE(qn(db_table)) +\n style.SQL_KEYWORD(' ALTER ') +\n style.SQL_FIELD(qn(f.column)) +\n style.SQL_KEYWORD(' SET NOT NULL') + ';')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L42_C12", "label": "if", "type": "if", "loc": [42, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L14_C8", "vector": [4, 3, 0.8083, 0.2333, 3, 0.71, 1.0, 0, 7, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if f.spatial_index:\n # Spatial indexes created the same way for both Geometry and\n # Geography columns\n if f.geography:\n index_opts = ''\n else:\n index_opts = ' ' + style.SQL_KEYWORD(self.geom_index_opts)\n output.append(style.SQL_KEYWORD('CREATE INDEX ') +"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L45_C16", "label": "if", "type": "if", "loc": [45, 48], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L42_C12", "vector": [4, 4, 0.775, 0.0667, 4, 0.92, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if f.geography:\n index_opts = ''\n else:\n index_opts = ' ' + style.SQL_KEYWORD(self.geom_index_opts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98778:Assign_L46_C20", "label": "index_opts =", "type": "assigned_variable", "loc": [46, 46], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L45_C16", "vector": [14, 5, 0.7667, 0.0167, 5, 0.39, 0.0, 689, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "index_opts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " index_opts = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98778:Assign_L48_C20", "label": "index_opts =", "type": "assigned_variable", "loc": [48, 48], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L45_C16", "vector": [14, 5, 0.8, 0.0167, 5, 0.39, 1.0, 689, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "index_opts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " index_opts = ' ' + style.SQL_KEYWORD(self.geom_index_opts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98778:Expr_L49_C16", "label": "append()", "type": "expression", "loc": [49, 55], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L42_C12", "vector": [8, 4, 0.8667, 0.1167, 4, 0.92, 1.0, 243, 3, 1, 0, 0, 0, 0, 11], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " output.append(style.SQL_KEYWORD('CREATE INDEX ') +\n style.SQL_TABLE(qn('%s_%s_id' % (db_table, f.column))) +\n style.SQL_KEYWORD(' ON ') +\n style.SQL_TABLE(qn(db_table)) +\n style.SQL_KEYWORD(' USING ') +\n style.SQL_COLTYPE(self.geom_index_type) + ' ( ' +\n style.SQL_FIELD(qn(f.column)) + index_opts + ' );')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98778:Return_L56_C8", "label": "return", "type": "return", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98778:FunctionDef_L8_C4", "vector": [13, 2, 0.9333, 0.0167, 2, 0.81, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return output"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98778:FunctionDef_L58_C4", "label": "sql_table_creation_suffix", "type": "function", "loc": [58, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98778:ClassDef_L4_C0", "vector": [2, 1, 0.9833, 0.05, 1, 0.79, 1.0, 367, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "sql_table_creation_suffix", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def sql_table_creation_suffix(self):\n qn = self.connection.ops.quote_name\n return ' TEMPLATE %s' % qn(getattr(settings, 'POSTGIS_TEMPLATE', 'template_postgis'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98778:Assign_L59_C8", "label": "qn =", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98778:FunctionDef_L58_C4", "vector": [14, 2, 0.9833, 0.0167, 2, 0.36, 0.0, 514, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "qn", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " qn = self.connection.ops.quote_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98778:Return_L60_C8", "label": "return", "type": "return", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98778:FunctionDef_L58_C4", "vector": [13, 2, 1.0, 0.0167, 2, 0.36, 1.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ' TEMPLATE %s' % qn(getattr(settings, 'POSTGIS_TEMPLATE', 'template_postgis'))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98778:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98778:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98778:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98778:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98778:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98778:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98778:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98778:Expr_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98778:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98778:ImportFrom_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98778:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98778:Assign_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98778:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L14_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98778:Assign_L15_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L14_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98778:Assign_L16_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L14_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98778:Assign_L17_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L14_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L19_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L19_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98778:Expr_L25_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L19_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L33_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L33_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98778:Expr_L35_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L14_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L42_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L42_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L45_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L45_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98778:Assign_L46_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L45_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98778:Assign_L48_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98778:If_L42_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98778:Expr_L49_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98778:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98778:Return_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98778:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98778:FunctionDef_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98778:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98778:Assign_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98778:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98778:Return_L60_C8"}] |
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
from django.contrib.gis.db.backends.postgis.operations import PostGISOperations
class DatabaseWrapper(Psycopg2DatabaseWrapper):
def __init__(self, *args, **kwargs):
super(DatabaseWrapper, self).__init__(*args, **kwargs)
self.creation = PostGISCreation(self)
self.ops = PostGISOperations(self)
self.introspection = PostGISIntrospection(self)
| ajibawa-2023/Python-Code-Large/train/row_98779 | 11 | 12 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98779:ImportFrom_L1_C0", "label": "from django.db.backends.postgresql_psycopg2.base import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0833, 0, 0.66, 0.0, 485, 0, 1, 0, 0, 485, 0, 0], "semantic": {"name": "django.db.backends.postgresql_psycopg2.base", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.backends.postgresql_psycopg2.base import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98779:ImportFrom_L2_C0", "label": "from django.db.backends.postgresql_psycopg2.base import Psycopg2DatabaseWrapper", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0833, 0, 0.66, 0.2, 485, 0, 1, 0, 0, 485, 0, 0], "semantic": {"name": "django.db.backends.postgresql_psycopg2.base", "arg_names": [], "import_names": ["Psycopg2DatabaseWrapper"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.backends.postgresql_psycopg2.base import DatabaseWrapper as Psycopg2DatabaseWrapper"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98779:ImportFrom_L3_C0", "label": "from django.contrib.gis.db.backends.postgis.creation import PostGISCreation", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.25, 0.0833, 0, 0.66, 0.4, 719, 0, 1, 0, 0, 719, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.postgis.creation", "arg_names": [], "import_names": ["PostGISCreation"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.backends.postgis.creation import PostGISCreation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98779:ImportFrom_L4_C0", "label": "from django.contrib.gis.db.backends.postgis.introspection import PostGISIntrospection", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.0833, 0, 0.66, 0.6, 300, 0, 1, 0, 0, 300, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.postgis.introspection", "arg_names": [], "import_names": ["PostGISIntrospection"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.backends.postgis.introspection import PostGISIntrospection"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98779:ImportFrom_L5_C0", "label": "from django.contrib.gis.db.backends.postgis.operations import PostGISOperations", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.4167, 0.0833, 0, 0.66, 0.8, 385, 0, 1, 0, 0, 385, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.postgis.operations", "arg_names": [], "import_names": ["PostGISOperations"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.backends.postgis.operations import PostGISOperations"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98779:ClassDef_L7_C0", "label": "DatabaseWrapper", "type": "class", "loc": [7, 12], "level": 0, "parent": null, "vector": [3, 0, 0.7917, 0.5, 0, 0.66, 1.0, 386, 0, 1, 0, 0, 282, 0, 5], "semantic": {"name": "DatabaseWrapper", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DatabaseWrapper(Psycopg2DatabaseWrapper):\n def __init__(self, *args, **kwargs):\n super(DatabaseWrapper, self).__init__(*args, **kwargs)\n self.creation = PostGISCreation(self)\n self.ops = PostGISOperations(self)\n self.introspection = PostGISIntrospection(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98779:FunctionDef_L8_C4", "label": "__init__", "type": "function", "loc": [8, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98779:ClassDef_L7_C0", "vector": [2, 1, 0.8333, 0.4167, 1, 0.57, 0.0, 555, 0, 3, 0, 0, 0, 0, 5], "semantic": {"name": "__init__", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, *args, **kwargs):\n super(DatabaseWrapper, self).__init__(*args, **kwargs)\n self.creation = PostGISCreation(self)\n self.ops = PostGISOperations(self)\n self.introspection = PostGISIntrospection(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98779:Expr_L9_C8", "label": "__init__()", "type": "expression", "loc": [9, 9], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98779:FunctionDef_L8_C4", "vector": [8, 2, 0.75, 0.0833, 2, 0.6, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(DatabaseWrapper, self).__init__(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98779:Assign_L10_C8", "label": "self.creation = PostGISCreation()", "type": "assigned_variable", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98779:FunctionDef_L8_C4", "vector": [14, 2, 0.8333, 0.0833, 2, 0.6, 0.3333, 748, 3, 1, 0, 0, 938, 10, 1], "semantic": {"name": "self.creation", "arg_names": [], "import_names": [], "rhs_call_name": "PostGISCreation", "annotation": ""}, "snippet": " self.creation = PostGISCreation(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98779:Assign_L11_C8", "label": "self.ops = PostGISOperations()", "type": "assigned_variable", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98779:FunctionDef_L8_C4", "vector": [14, 2, 0.9167, 0.0833, 2, 0.6, 0.6667, 589, 3, 1, 0, 0, 187, 10, 1], "semantic": {"name": "self.ops", "arg_names": [], "import_names": [], "rhs_call_name": "PostGISOperations", "annotation": ""}, "snippet": " self.ops = PostGISOperations(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98779:Assign_L12_C8", "label": "self.introspection = PostGISIntrospection()", "type": "assigned_variable", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98779:FunctionDef_L8_C4", "vector": [14, 2, 1.0, 0.0833, 2, 0.6, 1.0, 217, 3, 1, 0, 0, 970, 10, 1], "semantic": {"name": "self.introspection", "arg_names": [], "import_names": [], "rhs_call_name": "PostGISIntrospection", "annotation": ""}, "snippet": " self.introspection = PostGISIntrospection(self)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98779:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98779:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98779:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98779:Expr_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98779:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98779:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98779:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98779:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98779:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98779:Assign_L12_C8"}] |
"""
A collection of utility routines and classes used by the spatial
backends.
"""
def gqn(val):
"""
The geographic quote name function; used for quoting tables and
geometries (they use single rather than the double quotes of the
backend quotename function).
"""
if isinstance(val, basestring):
if isinstance(val, unicode): val = val.encode('ascii')
return "'%s'" % val
else:
return str(val)
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.function = function
self.operator = operator
self.result = result
self.extra = kwargs
def as_sql(self, geo_col, geometry='%s'):
return self.sql_template % self.params(geo_col, geometry)
def params(self, geo_col, geometry):
params = {'function' : self.function,
'geo_col' : geo_col,
'geometry' : geometry,
'operator' : self.operator,
'result' : self.result,
}
params.update(self.extra)
return params
class SpatialFunction(SpatialOperation):
"""
Base class for generating spatial SQL related to a function.
"""
sql_template = '%(function)s(%(geo_col)s, %(geometry)s)'
def __init__(self, func, result='', operator='', **kwargs):
# Getting the function prefix.
default = {'function' : func,
'operator' : operator,
'result' : result
}
kwargs.update(default)
super(SpatialFunction, self).__init__(**kwargs)
| ajibawa-2023/Python-Code-Large/train/row_98780 | 29 | 56 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98780:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0446, 0.0714, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nA collection of utility routines and classes used by the spatial\nbackends.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L6_C0", "label": "gqn", "type": "function", "loc": [6, 16], "level": 0, "parent": null, "vector": [2, 0, 0.1964, 0.1964, 0, 0.66, 0.3333, 613, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "gqn", "arg_names": ["val"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def gqn(val):\n \"\"\"\n The geographic quote name function; used for quoting tables and\n geometries (they use single rather than the double quotes of the\n backend quotename function).\n \"\"\"\n if isinstance(val, basestring):\n if isinstance(val, unicode): val = val.encode('ascii')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:Expr_L7_C4", "label": "expression", "type": "expression", "loc": [7, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L6_C0", "vector": [8, 1, 0.1607, 0.0893, 1, 0.62, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n The geographic quote name function; used for quoting tables and\n geometries (they use single rather than the double quotes of the\n backend quotename function).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:If_L12_C4", "label": "if", "type": "if", "loc": [12, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L6_C0", "vector": [4, 1, 0.25, 0.0893, 1, 0.62, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(val, basestring):\n if isinstance(val, unicode): val = val.encode('ascii')\n return \"'%s'\" % val\n else:\n return str(val)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:If_L13_C8", "label": "if", "type": "if", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98780:If_L12_C4", "vector": [4, 2, 0.2321, 0.0179, 2, 0.33, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(val, unicode): val = val.encode('ascii')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:Assign_L13_C37", "label": "val = encode()", "type": "assigned_variable", "loc": [13, 13], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98780:If_L13_C8", "vector": [14, 3, 0.2321, 0.0179, 3, 0.73, 0.0, 618, 3, 1, 0, 0, 623, 10, 1], "semantic": {"name": "val", "arg_names": [], "import_names": [], "rhs_call_name": "encode", "annotation": ""}, "snippet": " if isinstance(val, unicode): val = val.encode('ascii')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:Return_L14_C8", "label": "return", "type": "return", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98780:If_L12_C4", "vector": [13, 2, 0.25, 0.0179, 2, 0.33, 0.5, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"'%s'\" % val"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:Return_L16_C8", "label": "return", "type": "return", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98780:If_L12_C4", "vector": [13, 2, 0.2857, 0.0179, 2, 0.33, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str(val)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:ClassDef_L18_C0", "label": "SpatialOperation", "type": "class", "loc": [18, 41], "level": 0, "parent": null, "vector": [3, 0, 0.5268, 0.4286, 0, 0.66, 0.6667, 191, 0, 3, 0, 0, 186, 0, 2], "semantic": {"name": "SpatialOperation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SpatialOperation(object):\n \"\"\"\n Base class for generating spatial SQL.\n \"\"\"\n sql_template = '%(geo_col)s %(operator)s %(geometry)s'\n\n def __init__(self, function='', operator='', result='', **kwargs):\n self.function = function"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:Expr_L19_C4", "label": "expression", "type": "expression", "loc": [19, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98780:ClassDef_L18_C0", "vector": [8, 1, 0.3571, 0.0536, 1, 0.33, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Base class for generating spatial SQL.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:Assign_L22_C4", "label": "sql_template =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98780:ClassDef_L18_C0", "vector": [14, 1, 0.3929, 0.0179, 1, 0.33, 0.25, 765, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sql_template", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sql_template = '%(geo_col)s %(operator)s %(geometry)s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L24_C4", "label": "__init__", "type": "function", "loc": [24, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98780:ClassDef_L18_C0", "vector": [2, 1, 0.4643, 0.0893, 1, 0.33, 0.5, 555, 0, 5, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "function", "operator", "result", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, function='', operator='', result='', **kwargs):\n self.function = function\n self.operator = operator\n self.result = result\n self.extra = kwargs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:Assign_L25_C8", "label": "self.function =", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L24_C4", "vector": [14, 2, 0.4464, 0.0179, 2, 0.84, 0.0, 940, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.function", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.function = function"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:Assign_L26_C8", "label": "self.operator =", "type": "assigned_variable", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L24_C4", "vector": [14, 2, 0.4643, 0.0179, 2, 0.84, 0.3333, 337, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.operator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.operator = operator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:Assign_L27_C8", "label": "self.result =", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L24_C4", "vector": [14, 2, 0.4821, 0.0179, 2, 0.84, 0.6667, 341, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.result = result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:Assign_L28_C8", "label": "self.extra =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L24_C4", "vector": [14, 2, 0.5, 0.0179, 2, 0.84, 1.0, 921, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.extra", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.extra = kwargs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L30_C4", "label": "as_sql", "type": "function", "loc": [30, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98780:ClassDef_L18_C0", "vector": [2, 1, 0.5446, 0.0357, 1, 0.33, 0.75, 122, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "as_sql", "arg_names": ["self", "geo_col", "geometry"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def as_sql(self, geo_col, geometry='%s'):\n return self.sql_template % self.params(geo_col, geometry)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:Return_L31_C8", "label": "return", "type": "return", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L30_C4", "vector": [13, 2, 0.5536, 0.0179, 2, 0.72, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.sql_template % self.params(geo_col, geometry)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L33_C4", "label": "params", "type": "function", "loc": [33, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98780:ClassDef_L18_C0", "vector": [2, 1, 0.6607, 0.1607, 1, 0.33, 1.0, 206, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "params", "arg_names": ["self", "geo_col", "geometry"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def params(self, geo_col, geometry):\n params = {'function' : self.function,\n 'geo_col' : geo_col,\n 'geometry' : geometry,\n 'operator' : self.operator,\n 'result' : self.result,\n }\n params.update(self.extra)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:Assign_L34_C8", "label": "params =", "type": "assigned_variable", "loc": [34, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L33_C4", "vector": [14, 2, 0.6518, 0.1071, 2, 0.67, 0.0, 206, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = {'function' : self.function,\n 'geo_col' : geo_col,\n 'geometry' : geometry,\n 'operator' : self.operator,\n 'result' : self.result,\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:Expr_L40_C8", "label": "update()", "type": "expression", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L33_C4", "vector": [8, 2, 0.7143, 0.0179, 2, 0.67, 0.5, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " params.update(self.extra)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:Return_L41_C8", "label": "return", "type": "return", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L33_C4", "vector": [13, 2, 0.7321, 0.0179, 2, 0.67, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return params"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:ClassDef_L43_C0", "label": "SpatialFunction", "type": "class", "loc": [43, 56], "level": 0, "parent": null, "vector": [3, 0, 0.8839, 0.25, 0, 0.66, 1.0, 763, 0, 1, 0, 0, 191, 0, 3], "semantic": {"name": "SpatialFunction", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SpatialFunction(SpatialOperation):\n \"\"\"\n Base class for generating spatial SQL related to a function.\n \"\"\"\n sql_template = '%(function)s(%(geo_col)s, %(geometry)s)'\n\n def __init__(self, func, result='', operator='', **kwargs):\n # Getting the function prefix."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:Expr_L44_C4", "label": "expression", "type": "expression", "loc": [44, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98780:ClassDef_L43_C0", "vector": [8, 1, 0.8036, 0.0536, 1, 0.93, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Base class for generating spatial SQL related to a function.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:Assign_L47_C4", "label": "sql_template =", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98780:ClassDef_L43_C0", "vector": [14, 1, 0.8393, 0.0179, 1, 0.93, 0.5, 765, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sql_template", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sql_template = '%(function)s(%(geo_col)s, %(geometry)s)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L49_C4", "label": "__init__", "type": "function", "loc": [49, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98780:ClassDef_L43_C0", "vector": [2, 1, 0.9375, 0.1429, 1, 0.93, 1.0, 555, 0, 5, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "func", "result", "operator", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, func, result='', operator='', **kwargs):\n # Getting the function prefix.\n default = {'function' : func,\n 'operator' : operator,\n 'result' : result\n }\n kwargs.update(default)\n super(SpatialFunction, self).__init__(**kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:Assign_L51_C8", "label": "default =", "type": "assigned_variable", "loc": [51, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L49_C4", "vector": [14, 2, 0.9375, 0.0714, 2, 0.7, 0.0, 977, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "default", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " default = {'function' : func,\n 'operator' : operator,\n 'result' : result\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:Expr_L55_C8", "label": "update()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L49_C4", "vector": [8, 2, 0.9821, 0.0179, 2, 0.7, 0.5, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " kwargs.update(default)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98780:Expr_L56_C8", "label": "__init__()", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L49_C4", "vector": [8, 2, 1.0, 0.0179, 2, 0.7, 1.0, 555, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(SpatialFunction, self).__init__(**kwargs)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:If_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98780:If_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:If_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98780:If_L13_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:Assign_L13_C37"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98780:If_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:Return_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98780:If_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:Return_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98780:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98780:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98780:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:Assign_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:Assign_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98780:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:Return_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98780:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:Expr_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:Return_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98780:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98780:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98780:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:Expr_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:Expr_L56_C8"}] |
from django.contrib.gis.db.models.sql.compiler import GeoSQLCompiler as BaseGeoSQLCompiler
from django.db.backends.oracle import compiler
SQLCompiler = compiler.SQLCompiler
class GeoSQLCompiler(BaseGeoSQLCompiler, SQLCompiler):
pass
class SQLInsertCompiler(compiler.SQLInsertCompiler, GeoSQLCompiler):
def placeholder(self, field, val):
if field is None:
# A field value of None means the value is raw.
return val
elif hasattr(field, 'get_placeholder'):
# Some fields (e.g. geo fields) need special munging before
# they can be inserted.
ph = field.get_placeholder(val, self.connection)
if ph == 'NULL':
# If the placeholder returned is 'NULL', then we need to
# to remove None from the Query parameters. Specifically,
# cx_Oracle will assume a CHAR type when a placeholder ('%s')
# is used for columns of MDSYS.SDO_GEOMETRY. Thus, we use
# 'NULL' for the value, and remove None from the query params.
# See also #10888.
param_idx = self.query.columns.index(field.column)
params = list(self.query.params)
params.pop(param_idx)
self.query.params = tuple(params)
return ph
else:
# Return the common case for the placeholder
return '%s'
class SQLDeleteCompiler(compiler.SQLDeleteCompiler, GeoSQLCompiler):
pass
class SQLUpdateCompiler(compiler.SQLUpdateCompiler, GeoSQLCompiler):
pass
class SQLAggregateCompiler(compiler.SQLAggregateCompiler, GeoSQLCompiler):
pass
class SQLDateCompiler(compiler.SQLDateCompiler, GeoSQLCompiler):
pass
| ajibawa-2023/Python-Code-Large/train/row_98783 | 21 | 44 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98783:ImportFrom_L1_C0", "label": "from django.contrib.gis.db.models.sql.compiler import BaseGeoSQLCompiler", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0227, 0.0227, 0, 0.66, 0.0, 973, 0, 1, 0, 0, 973, 0, 0], "semantic": {"name": "django.contrib.gis.db.models.sql.compiler", "arg_names": [], "import_names": ["BaseGeoSQLCompiler"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.models.sql.compiler import GeoSQLCompiler as BaseGeoSQLCompiler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98783:ImportFrom_L2_C0", "label": "from django.db.backends.oracle import compiler", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0227, 0, 0.66, 0.125, 772, 0, 1, 0, 0, 772, 0, 0], "semantic": {"name": "django.db.backends.oracle", "arg_names": [], "import_names": ["compiler"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.backends.oracle import compiler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98783:Assign_L4_C0", "label": "SQLCompiler =", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.0909, 0.0227, 0, 0.66, 0.25, 718, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "SQLCompiler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SQLCompiler = compiler.SQLCompiler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98783:ClassDef_L6_C0", "label": "GeoSQLCompiler", "type": "class", "loc": [6, 7], "level": 0, "parent": null, "vector": [3, 0, 0.1477, 0.0455, 0, 0.66, 0.375, 214, 0, 0, 0, 0, 339, 0, 0], "semantic": {"name": "GeoSQLCompiler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GeoSQLCompiler(BaseGeoSQLCompiler, SQLCompiler):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98783:ClassDef_L9_C0", "label": "SQLInsertCompiler", "type": "class", "loc": [9, 32], "level": 0, "parent": null, "vector": [3, 0, 0.4659, 0.5455, 0, 0.66, 0.5, 217, 0, 1, 0, 0, 928, 0, 6], "semantic": {"name": "SQLInsertCompiler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SQLInsertCompiler(compiler.SQLInsertCompiler, GeoSQLCompiler):\n def placeholder(self, field, val):\n if field is None:\n # A field value of None means the value is raw.\n return val\n elif hasattr(field, 'get_placeholder'):\n # Some fields (e.g. geo fields) need special munging before\n # they can be inserted."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98783:FunctionDef_L10_C4", "label": "placeholder", "type": "function", "loc": [10, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98783:ClassDef_L9_C0", "vector": [2, 1, 0.4773, 0.5227, 1, 0.83, 0.0, 847, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "placeholder", "arg_names": ["self", "field", "val"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def placeholder(self, field, val):\n if field is None:\n # A field value of None means the value is raw.\n return val\n elif hasattr(field, 'get_placeholder'):\n # Some fields (e.g. geo fields) need special munging before\n # they can be inserted.\n ph = field.get_placeholder(val, self.connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L11_C8", "label": "if", "type": "if", "loc": [11, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98783:FunctionDef_L10_C4", "vector": [4, 2, 0.4886, 0.5, 2, 0.1, 0.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if field is None:\n # A field value of None means the value is raw.\n return val\n elif hasattr(field, 'get_placeholder'):\n # Some fields (e.g. geo fields) need special munging before\n # they can be inserted.\n ph = field.get_placeholder(val, self.connection)\n if ph == 'NULL':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98783:Return_L13_C12", "label": "return", "type": "return", "loc": [13, 13], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L11_C8", "vector": [13, 3, 0.2955, 0.0227, 3, 0.43, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return val"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L14_C8", "label": "if", "type": "if", "loc": [14, 32], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L11_C8", "vector": [4, 3, 0.5227, 0.4318, 3, 0.43, 1.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif hasattr(field, 'get_placeholder'):\n # Some fields (e.g. geo fields) need special munging before\n # they can be inserted.\n ph = field.get_placeholder(val, self.connection)\n if ph == 'NULL':\n # If the placeholder returned is 'NULL', then we need to\n # to remove None from the Query parameters. Specifically,\n # cx_Oracle will assume a CHAR type when a placeholder ('%s')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98783:Assign_L17_C12", "label": "ph = get_placeholder()", "type": "assigned_variable", "loc": [17, 17], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L14_C8", "vector": [14, 4, 0.3864, 0.0227, 4, 0.49, 0.0, 947, 3, 2, 0, 0, 571, 10, 1], "semantic": {"name": "ph", "arg_names": [], "import_names": [], "rhs_call_name": "get_placeholder", "annotation": ""}, "snippet": " ph = field.get_placeholder(val, self.connection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L18_C12", "label": "if", "type": "if", "loc": [18, 28], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L14_C8", "vector": [4, 4, 0.5227, 0.25, 4, 0.49, 0.3333, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ph == 'NULL':\n # If the placeholder returned is 'NULL', then we need to\n # to remove None from the Query parameters. Specifically,\n # cx_Oracle will assume a CHAR type when a placeholder ('%s')\n # is used for columns of MDSYS.SDO_GEOMETRY. Thus, we use\n # 'NULL' for the value, and remove None from the query params.\n # See also #10888.\n param_idx = self.query.columns.index(field.column)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98783:Assign_L25_C16", "label": "param_idx = index()", "type": "assigned_variable", "loc": [25, 25], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L18_C12", "vector": [14, 5, 0.5682, 0.0227, 5, 0.37, 0.0, 77, 3, 1, 0, 0, 780, 10, 1], "semantic": {"name": "param_idx", "arg_names": [], "import_names": [], "rhs_call_name": "index", "annotation": ""}, "snippet": " param_idx = self.query.columns.index(field.column)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98783:Assign_L26_C16", "label": "params = list()", "type": "assigned_variable", "loc": [26, 26], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L18_C12", "vector": [14, 5, 0.5909, 0.0227, 5, 0.37, 0.3333, 206, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " params = list(self.query.params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98783:Expr_L27_C16", "label": "pop()", "type": "expression", "loc": [27, 27], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L18_C12", "vector": [8, 5, 0.6136, 0.0227, 5, 0.37, 0.6667, 969, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pop", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " params.pop(param_idx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98783:Assign_L28_C16", "label": "self.query.params = tuple()", "type": "assigned_variable", "loc": [28, 28], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L18_C12", "vector": [14, 5, 0.6364, 0.0227, 5, 0.37, 1.0, 14, 3, 1, 0, 0, 259, 10, 1], "semantic": {"name": "self.query.params", "arg_names": [], "import_names": [], "rhs_call_name": "tuple", "annotation": ""}, "snippet": " self.query.params = tuple(params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98783:Return_L29_C12", "label": "return", "type": "return", "loc": [29, 29], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L14_C8", "vector": [13, 4, 0.6591, 0.0227, 4, 0.49, 0.6667, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ph"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98783:Return_L32_C12", "label": "return", "type": "return", "loc": [32, 32], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L14_C8", "vector": [13, 4, 0.7273, 0.0227, 4, 0.49, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98783:ClassDef_L34_C0", "label": "SQLDeleteCompiler", "type": "class", "loc": [34, 35], "level": 0, "parent": null, "vector": [3, 0, 0.7841, 0.0455, 0, 0.66, 0.625, 715, 0, 0, 0, 0, 754, 0, 0], "semantic": {"name": "SQLDeleteCompiler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SQLDeleteCompiler(compiler.SQLDeleteCompiler, GeoSQLCompiler):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98783:ClassDef_L37_C0", "label": "SQLUpdateCompiler", "type": "class", "loc": [37, 38], "level": 0, "parent": null, "vector": [3, 0, 0.8523, 0.0455, 0, 0.66, 0.75, 756, 0, 0, 0, 0, 592, 0, 0], "semantic": {"name": "SQLUpdateCompiler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SQLUpdateCompiler(compiler.SQLUpdateCompiler, GeoSQLCompiler):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98783:ClassDef_L40_C0", "label": "SQLAggregateCompiler", "type": "class", "loc": [40, 41], "level": 0, "parent": null, "vector": [3, 0, 0.9205, 0.0455, 0, 0.66, 0.875, 216, 0, 0, 0, 0, 742, 0, 0], "semantic": {"name": "SQLAggregateCompiler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SQLAggregateCompiler(compiler.SQLAggregateCompiler, GeoSQLCompiler):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98783:ClassDef_L43_C0", "label": "SQLDateCompiler", "type": "class", "loc": [43, 44], "level": 0, "parent": null, "vector": [3, 0, 0.9886, 0.0455, 0, 0.66, 1.0, 583, 0, 0, 0, 0, 171, 0, 0], "semantic": {"name": "SQLDateCompiler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SQLDateCompiler(compiler.SQLDateCompiler, GeoSQLCompiler):\n pass"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98783:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98783:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98783:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L11_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98783:Return_L13_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L11_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L14_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98783:Assign_L17_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L14_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L18_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L18_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98783:Assign_L25_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L18_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98783:Assign_L26_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L18_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98783:Expr_L27_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L18_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98783:Assign_L28_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L14_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98783:Return_L29_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L14_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98783:Return_L32_C12"}] |
from cx_Oracle import CLOB
from django.contrib.gis.db.backends.adapter import WKTAdapter
class OracleSpatialAdapter(WKTAdapter):
input_size = CLOB
| ajibawa-2023/Python-Code-Large/train/row_98784 | 4 | 5 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98784:ImportFrom_L1_C0", "label": "from cx_Oracle import CLOB", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.2, 0, 0.66, 0.0, 554, 0, 1, 0, 0, 554, 0, 0], "semantic": {"name": "cx_Oracle", "arg_names": [], "import_names": ["CLOB"], "rhs_call_name": "", "annotation": ""}, "snippet": "from cx_Oracle import CLOB"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98784:ImportFrom_L2_C0", "label": "from django.contrib.gis.db.backends.adapter import WKTAdapter", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.4, 0.2, 0, 0.66, 0.5, 423, 0, 1, 0, 0, 423, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.adapter", "arg_names": [], "import_names": ["WKTAdapter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.backends.adapter import WKTAdapter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98784:ClassDef_L4_C0", "label": "OracleSpatialAdapter", "type": "class", "loc": [4, 5], "level": 0, "parent": null, "vector": [3, 0, 0.9, 0.4, 0, 0.66, 1.0, 930, 0, 0, 0, 0, 868, 0, 0], "semantic": {"name": "OracleSpatialAdapter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OracleSpatialAdapter(WKTAdapter):\n input_size = CLOB"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98784:Assign_L5_C4", "label": "input_size =", "type": "assigned_variable", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98784:ClassDef_L4_C0", "vector": [14, 1, 1.0, 0.2, 1, 0.26, 0.0, 362, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "input_size", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " input_size = CLOB"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98784:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98784:Assign_L5_C4"}] |
"""
The GeometryColumns and SpatialRefSys models for the Oracle spatial
backend.
It should be noted that Oracle Spatial does not have database tables
named according to the OGC standard, so the closest analogs are used.
For example, the `USER_SDO_GEOM_METADATA` is used for the GeometryColumns
model and the `SDO_COORD_REF_SYS` is used for the SpatialRefSys model.
"""
from django.contrib.gis.db import models
from django.contrib.gis.db.models.fields import GeometryField
from django.contrib.gis.db.backends.base import SpatialRefSysMixin
class GeometryColumns(models.Model):
"Maps to the Oracle USER_SDO_GEOM_METADATA table."
table_name = models.CharField(max_length=32)
column_name = models.CharField(max_length=1024)
srid = models.IntegerField(primary_key=True)
# TODO: Add support for `diminfo` column (type MDSYS.SDO_DIM_ARRAY).
class Meta:
db_table = 'USER_SDO_GEOM_METADATA'
managed = False
@classmethod
def table_name_col(cls):
"""
Returns the name of the metadata column used to store the
the feature table name.
"""
return 'table_name'
@classmethod
def geom_col_name(cls):
"""
Returns the name of the metadata column used to store the
the feature geometry column.
"""
return 'column_name'
def __unicode__(self):
return '%s - %s (SRID: %s)' % (self.table_name, self.column_name, self.srid)
class SpatialRefSys(models.Model, SpatialRefSysMixin):
"Maps to the Oracle MDSYS.CS_SRS table."
cs_name = models.CharField(max_length=68)
srid = models.IntegerField(primary_key=True)
auth_srid = models.IntegerField()
auth_name = models.CharField(max_length=256)
wktext = models.CharField(max_length=2046)
# Optional geometry representing the bounds of this coordinate
# system. By default, all are NULL in the table.
cs_bounds = models.PolygonField(null=True)
objects = models.GeoManager()
class Meta:
db_table = 'CS_SRS'
managed = False
@property
def wkt(self):
return self.wktext
@classmethod
def wkt_col(cls):
return 'wktext'
| ajibawa-2023/Python-Code-Large/train/row_98785 | 36 | 65 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98785:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 9], "level": 0, "parent": null, "vector": [8, 0, 0.0769, 0.1385, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n The GeometryColumns and SpatialRefSys models for the Oracle spatial\n backend.\n\n It should be noted that Oracle Spatial does not have database tables\n named according to the OGC standard, so the closest analogs are used.\n For example, the `USER_SDO_GEOM_METADATA` is used for the GeometryColumns\n model and the `SDO_COORD_REF_SYS` is used for the SpatialRefSys model."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:ImportFrom_L10_C0", "label": "from django.contrib.gis.db import models", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1538, 0.0154, 0, 0.66, 0.2, 964, 0, 1, 0, 0, 964, 0, 0], "semantic": {"name": "django.contrib.gis.db", "arg_names": [], "import_names": ["models"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db import models"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:ImportFrom_L11_C0", "label": "from django.contrib.gis.db.models.fields import GeometryField", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.1692, 0.0154, 0, 0.66, 0.4, 708, 0, 1, 0, 0, 708, 0, 0], "semantic": {"name": "django.contrib.gis.db.models.fields", "arg_names": [], "import_names": ["GeometryField"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.models.fields import GeometryField"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:ImportFrom_L12_C0", "label": "from django.contrib.gis.db.backends.base import SpatialRefSysMixin", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.1846, 0.0154, 0, 0.66, 0.6, 157, 0, 1, 0, 0, 157, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.base", "arg_names": [], "import_names": ["SpatialRefSysMixin"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.backends.base import SpatialRefSysMixin"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L14_C0", "label": "GeometryColumns", "type": "class", "loc": [14, 41], "level": 0, "parent": null, "vector": [3, 0, 0.4231, 0.4308, 0, 0.66, 0.8, 250, 0, 3, 0, 0, 996, 0, 3], "semantic": {"name": "GeometryColumns", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GeometryColumns(models.Model):\n \"Maps to the Oracle USER_SDO_GEOM_METADATA table.\"\n table_name = models.CharField(max_length=32)\n column_name = models.CharField(max_length=1024)\n srid = models.IntegerField(primary_key=True)\n # TODO: Add support for `diminfo` column (type MDSYS.SDO_DIM_ARRAY).\n class Meta:\n db_table = 'USER_SDO_GEOM_METADATA'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:Expr_L15_C4", "label": "expression", "type": "expression", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L14_C0", "vector": [8, 1, 0.2308, 0.0154, 1, 0.78, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Maps to the Oracle USER_SDO_GEOM_METADATA table.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L16_C4", "label": "table_name = CharField()", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L14_C0", "vector": [14, 1, 0.2462, 0.0154, 1, 0.78, 0.1429, 894, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "table_name", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " table_name = models.CharField(max_length=32)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L17_C4", "label": "column_name = CharField()", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L14_C0", "vector": [14, 1, 0.2615, 0.0154, 1, 0.78, 0.2857, 118, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "column_name", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " column_name = models.CharField(max_length=1024)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L18_C4", "label": "srid = IntegerField()", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L14_C0", "vector": [14, 1, 0.2769, 0.0154, 1, 0.78, 0.4286, 357, 3, 1, 0, 0, 877, 10, 1], "semantic": {"name": "srid", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerField", "annotation": ""}, "snippet": " srid = models.IntegerField(primary_key=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L20_C4", "label": "Meta", "type": "class", "loc": [20, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L14_C0", "vector": [3, 1, 0.3231, 0.0462, 1, 0.78, 0.5714, 130, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta:\n db_table = 'USER_SDO_GEOM_METADATA'\n managed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L21_C8", "label": "db_table =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L20_C4", "vector": [14, 2, 0.3231, 0.0154, 2, 0.12, 0.0, 111, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "db_table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " db_table = 'USER_SDO_GEOM_METADATA'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L22_C8", "label": "managed =", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L20_C4", "vector": [14, 2, 0.3385, 0.0154, 2, 0.12, 1.0, 503, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "managed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " managed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:FunctionDef_L25_C4", "label": "table_name_col", "type": "function", "loc": [25, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L14_C0", "vector": [2, 1, 0.4231, 0.0923, 1, 0.78, 0.7143, 702, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "table_name_col", "arg_names": ["cls"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def table_name_col(cls):\n \"\"\"\n Returns the name of the metadata column used to store the\n the feature table name.\n \"\"\"\n return 'table_name'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:Expr_L26_C8", "label": "expression", "type": "expression", "loc": [26, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:FunctionDef_L25_C4", "vector": [8, 2, 0.4231, 0.0615, 2, 0.03, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the name of the metadata column used to store the\n the feature table name.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:Return_L30_C8", "label": "return", "type": "return", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:FunctionDef_L25_C4", "vector": [13, 2, 0.4615, 0.0154, 2, 0.03, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'table_name'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:FunctionDef_L33_C4", "label": "geom_col_name", "type": "function", "loc": [33, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L14_C0", "vector": [2, 1, 0.5462, 0.0923, 1, 0.78, 0.8571, 835, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "geom_col_name", "arg_names": ["cls"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geom_col_name(cls):\n \"\"\"\n Returns the name of the metadata column used to store the\n the feature geometry column.\n \"\"\"\n return 'column_name'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:Expr_L34_C8", "label": "expression", "type": "expression", "loc": [34, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:FunctionDef_L33_C4", "vector": [8, 2, 0.5462, 0.0615, 2, 0.23, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the name of the metadata column used to store the\n the feature geometry column.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:Return_L38_C8", "label": "return", "type": "return", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:FunctionDef_L33_C4", "vector": [13, 2, 0.5846, 0.0154, 2, 0.23, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'column_name'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:FunctionDef_L40_C4", "label": "__unicode__", "type": "function", "loc": [40, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L14_C0", "vector": [2, 1, 0.6231, 0.0308, 1, 0.78, 1.0, 318, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__unicode__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __unicode__(self):\n return '%s - %s (SRID: %s)' % (self.table_name, self.column_name, self.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:Return_L41_C8", "label": "return", "type": "return", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:FunctionDef_L40_C4", "vector": [13, 2, 0.6308, 0.0154, 2, 0.12, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s - %s (SRID: %s)' % (self.table_name, self.column_name, self.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L43_C0", "label": "SpatialRefSys", "type": "class", "loc": [43, 65], "level": 0, "parent": null, "vector": [3, 0, 0.8308, 0.3538, 0, 0.66, 1.0, 219, 0, 2, 0, 0, 996, 0, 7], "semantic": {"name": "SpatialRefSys", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SpatialRefSys(models.Model, SpatialRefSysMixin):\n \"Maps to the Oracle MDSYS.CS_SRS table.\"\n cs_name = models.CharField(max_length=68)\n srid = models.IntegerField(primary_key=True)\n auth_srid = models.IntegerField()\n auth_name = models.CharField(max_length=256)\n wktext = models.CharField(max_length=2046)\n # Optional geometry representing the bounds of this coordinate"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:Expr_L44_C4", "label": "expression", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L43_C0", "vector": [8, 1, 0.6769, 0.0154, 1, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Maps to the Oracle MDSYS.CS_SRS table.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L45_C4", "label": "cs_name = CharField()", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L43_C0", "vector": [14, 1, 0.6923, 0.0154, 1, 0.37, 0.1, 839, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "cs_name", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " cs_name = models.CharField(max_length=68)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L46_C4", "label": "srid = IntegerField()", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L43_C0", "vector": [14, 1, 0.7077, 0.0154, 1, 0.37, 0.2, 357, 3, 1, 0, 0, 877, 10, 1], "semantic": {"name": "srid", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerField", "annotation": ""}, "snippet": " srid = models.IntegerField(primary_key=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L47_C4", "label": "auth_srid = IntegerField()", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L43_C0", "vector": [14, 1, 0.7231, 0.0154, 1, 0.37, 0.3, 568, 3, 0, 0, 0, 877, 10, 1], "semantic": {"name": "auth_srid", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerField", "annotation": ""}, "snippet": " auth_srid = models.IntegerField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L48_C4", "label": "auth_name = CharField()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L43_C0", "vector": [14, 1, 0.7385, 0.0154, 1, 0.37, 0.4, 454, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "auth_name", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " auth_name = models.CharField(max_length=256)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L49_C4", "label": "wktext = CharField()", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L43_C0", "vector": [14, 1, 0.7538, 0.0154, 1, 0.37, 0.5, 666, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "wktext", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " wktext = models.CharField(max_length=2046)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L52_C4", "label": "cs_bounds = PolygonField()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L43_C0", "vector": [14, 1, 0.8, 0.0154, 1, 0.37, 0.6, 187, 3, 1, 0, 0, 736, 10, 1], "semantic": {"name": "cs_bounds", "arg_names": [], "import_names": [], "rhs_call_name": "PolygonField", "annotation": ""}, "snippet": " cs_bounds = models.PolygonField(null=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L53_C4", "label": "objects = GeoManager()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L43_C0", "vector": [14, 1, 0.8154, 0.0154, 1, 0.37, 0.7, 550, 3, 0, 0, 0, 665, 10, 1], "semantic": {"name": "objects", "arg_names": [], "import_names": [], "rhs_call_name": "GeoManager", "annotation": ""}, "snippet": " objects = models.GeoManager()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L55_C4", "label": "Meta", "type": "class", "loc": [55, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L43_C0", "vector": [3, 1, 0.8615, 0.0462, 1, 0.37, 0.8, 130, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta:\n db_table = 'CS_SRS'\n managed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L56_C8", "label": "db_table =", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L55_C4", "vector": [14, 2, 0.8615, 0.0154, 2, 0.48, 0.0, 111, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "db_table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " db_table = 'CS_SRS'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L57_C8", "label": "managed =", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L55_C4", "vector": [14, 2, 0.8769, 0.0154, 2, 0.48, 1.0, 503, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "managed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " managed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:FunctionDef_L60_C4", "label": "wkt", "type": "function", "loc": [60, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L43_C0", "vector": [2, 1, 0.9308, 0.0308, 1, 0.37, 0.9, 836, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "wkt", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wkt(self):\n return self.wktext"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:Return_L61_C8", "label": "return", "type": "return", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:FunctionDef_L60_C4", "vector": [13, 2, 0.9385, 0.0154, 2, 0.08, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.wktext"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:FunctionDef_L64_C4", "label": "wkt_col", "type": "function", "loc": [64, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L43_C0", "vector": [2, 1, 0.9923, 0.0308, 1, 0.37, 1.0, 556, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "wkt_col", "arg_names": ["cls"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wkt_col(cls):\n return 'wktext'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98785:Return_L65_C8", "label": "return", "type": "return", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98785:FunctionDef_L64_C4", "vector": [13, 2, 1.0, 0.0154, 2, 0.63, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'wktext'"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:Return_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:FunctionDef_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:Expr_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:Return_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:FunctionDef_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:Return_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:FunctionDef_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:FunctionDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:Return_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:FunctionDef_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:Return_L65_C8"}] |
"""
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
the WKT constructors.
"""
import re
from decimal import Decimal
from django.db.backends.oracle.base import DatabaseOperations
from django.contrib.gis.db.backends.base import BaseSpatialOperations
from django.contrib.gis.db.backends.oracle.adapter import OracleSpatialAdapter
from django.contrib.gis.db.backends.util import SpatialFunction
from django.contrib.gis.geometry.backend import Geometry
from django.contrib.gis.measure import Distance
class SDOOperation(SpatialFunction):
"Base class for SDO* Oracle operations."
sql_template = "%(function)s(%(geo_col)s, %(geometry)s) %(operator)s '%(result)s'"
def __init__(self, func, **kwargs):
kwargs.setdefault('operator', '=')
kwargs.setdefault('result', 'TRUE')
super(SDOOperation, self).__init__(func, **kwargs)
class SDODistance(SpatialFunction):
"Class for Distance queries."
sql_template = ('%(function)s(%(geo_col)s, %(geometry)s, %(tolerance)s) '
'%(operator)s %(result)s')
dist_func = 'SDO_GEOM.SDO_DISTANCE'
def __init__(self, op, tolerance=0.05):
super(SDODistance, self).__init__(self.dist_func,
tolerance=tolerance,
operator=op, result='%s')
class SDODWithin(SpatialFunction):
dwithin_func = 'SDO_WITHIN_DISTANCE'
sql_template = "%(function)s(%(geo_col)s, %(geometry)s, %%s) = 'TRUE'"
def __init__(self):
super(SDODWithin, self).__init__(self.dwithin_func)
class SDOGeomRelate(SpatialFunction):
"Class for using SDO_GEOM.RELATE."
relate_func = 'SDO_GEOM.RELATE'
sql_template = ("%(function)s(%(geo_col)s, '%(mask)s', %(geometry)s, "
"%(tolerance)s) %(operator)s '%(mask)s'")
def __init__(self, mask, tolerance=0.05):
# SDO_GEOM.RELATE(...) has a peculiar argument order: column, mask, geom, tolerance.
# Moreover, the runction result is the mask (e.g., 'DISJOINT' instead of 'TRUE').
super(SDOGeomRelate, self).__init__(self.relate_func, operator='=',
mask=mask, tolerance=tolerance)
class SDORelate(SpatialFunction):
"Class for using SDO_RELATE."
masks = 'TOUCH|OVERLAPBDYDISJOINT|OVERLAPBDYINTERSECT|EQUAL|INSIDE|COVEREDBY|CONTAINS|COVERS|ANYINTERACT|ON'
mask_regex = re.compile(r'^(%s)(\+(%s))*$' % (masks, masks), re.I)
sql_template = "%(function)s(%(geo_col)s, %(geometry)s, 'mask=%(mask)s') = 'TRUE'"
relate_func = 'SDO_RELATE'
def __init__(self, mask):
if not self.mask_regex.match(mask):
raise ValueError('Invalid %s mask: "%s"' % (self.relate_func, mask))
super(SDORelate, self).__init__(self.relate_func, mask=mask)
# Valid distance types and substitutions
dtypes = (Decimal, Distance, float, int, long)
class OracleOperations(DatabaseOperations, BaseSpatialOperations):
compiler_module = "django.contrib.gis.db.backends.oracle.compiler"
name = 'oracle'
oracle = True
valid_aggregates = dict([(a, None) for a in ('Union', 'Extent')])
Adapter = OracleSpatialAdapter
Adaptor = Adapter # Backwards-compatibility alias.
area = 'SDO_GEOM.SDO_AREA'
gml= 'SDO_UTIL.TO_GMLGEOMETRY'
centroid = 'SDO_GEOM.SDO_CENTROID'
difference = 'SDO_GEOM.SDO_DIFFERENCE'
distance = 'SDO_GEOM.SDO_DISTANCE'
extent= 'SDO_AGGR_MBR'
intersection= 'SDO_GEOM.SDO_INTERSECTION'
length = 'SDO_GEOM.SDO_LENGTH'
num_geom = 'SDO_UTIL.GETNUMELEM'
num_points = 'SDO_UTIL.GETNUMVERTICES'
perimeter = length
point_on_surface = 'SDO_GEOM.SDO_POINTONSURFACE'
reverse = 'SDO_UTIL.REVERSE_LINESTRING'
sym_difference = 'SDO_GEOM.SDO_XOR'
transform = 'SDO_CS.TRANSFORM'
union = 'SDO_GEOM.SDO_UNION'
unionagg = 'SDO_AGGR_UNION'
# We want to get SDO Geometries as WKT because it is much easier to
# instantiate GEOS proxies from WKT than SDO_GEOMETRY(...) strings.
# However, this adversely affects performance (i.e., Java is called
# to convert to WKT on every query). If someone wishes to write a
# SDO_GEOMETRY(...) parser in Python, let me know =)
select = 'SDO_UTIL.TO_WKTGEOMETRY(%s)'
distance_functions = {
'distance_gt' : (SDODistance('>'), dtypes),
'distance_gte' : (SDODistance('>='), dtypes),
'distance_lt' : (SDODistance('<'), dtypes),
'distance_lte' : (SDODistance('<='), dtypes),
'dwithin' : (SDODWithin(), dtypes),
}
geometry_functions = {
'contains' : SDOOperation('SDO_CONTAINS'),
'coveredby' : SDOOperation('SDO_COVEREDBY'),
'covers' : SDOOperation('SDO_COVERS'),
'disjoint' : SDOGeomRelate('DISJOINT'),
'intersects' : SDOOperation('SDO_OVERLAPBDYINTERSECT'), # TODO: Is this really the same as ST_Intersects()?
'equals' : SDOOperation('SDO_EQUAL'),
'exact' : SDOOperation('SDO_EQUAL'),
'overlaps' : SDOOperation('SDO_OVERLAPS'),
'same_as' : SDOOperation('SDO_EQUAL'),
'relate' : (SDORelate, basestring), # Oracle uses a different syntax, e.g., 'mask=inside+touch'
'touches' : SDOOperation('SDO_TOUCH'),
'within' : SDOOperation('SDO_INSIDE'),
}
geometry_functions.update(distance_functions)
gis_terms = ['isnull']
gis_terms += geometry_functions.keys()
gis_terms = dict([(term, None) for term in gis_terms])
truncate_params = {'relate' : None}
def __init__(self, connection):
super(OracleOperations, self).__init__()
self.connection = connection
def convert_extent(self, clob):
if clob:
# Generally, Oracle returns a polygon for the extent -- however,
# it can return a single point if there's only one Point in the
# table.
ext_geom = Geometry(clob.read())
gtype = str(ext_geom.geom_type)
if gtype == 'Polygon':
# Construct the 4-tuple from the coordinates in the polygon.
shell = ext_geom.shell
ll, ur = shell[0][:2], shell[2][:2]
elif gtype == 'Point':
ll = ext_geom.coords[:2]
ur = ll
else:
raise Exception('Unexpected geometry type returned for extent: %s' % gtype)
xmin, ymin = ll
xmax, ymax = ur
return (xmin, ymin, xmax, ymax)
else:
return None
def convert_geom(self, clob, geo_field):
if clob:
return Geometry(clob.read(), geo_field.srid)
else:
return None
def geo_db_type(self, f):
"""
Returns the geometry database type for Oracle. Unlike other spatial
backends, no stored procedure is necessary and it's the same for all
geometry types.
"""
return 'MDSYS.SDO_GEOMETRY'
def get_distance(self, f, value, lookup_type):
"""
Returns the distance parameters given the value and the lookup type.
On Oracle, geometry columns with a geodetic coordinate system behave
implicitly like a geography column, and thus meters will be used as
the distance parameter on them.
"""
if not value:
return []
value = value[0]
if isinstance(value, Distance):
if f.geodetic(self.connection):
dist_param = value.m
else:
dist_param = getattr(value, Distance.unit_attname(f.units_name(self.connection)))
else:
dist_param = value
# dwithin lookups on oracle require a special string parameter
# that starts with "distance=".
if lookup_type == 'dwithin':
dist_param = 'distance=%s' % dist_param
return [dist_param]
def get_geom_placeholder(self, f, value):
"""
Provides a proper substitution value for Geometries that are not in the
SRID of the field. Specifically, this routine will substitute in the
SDO_CS.TRANSFORM() function call.
"""
if value is None:
return 'NULL'
def transform_value(val, srid):
return val.srid != srid
if hasattr(value, 'expression'):
if transform_value(value, f.srid):
placeholder = '%s(%%s, %s)' % (self.transform, f.srid)
else:
placeholder = '%s'
# No geometry value used for F expression, substitue in
# the column name instead.
return placeholder % '%s.%s' % tuple(map(self.quote_name, value.cols[value.expression]))
else:
if transform_value(value, f.srid):
return '%s(SDO_GEOMETRY(%%s, %s), %s)' % (self.transform, value.srid, f.srid)
else:
return 'SDO_GEOMETRY(%%s, %s)' % f.srid
def spatial_lookup_sql(self, lvalue, lookup_type, value, field, qn):
"Returns the SQL WHERE clause for use in Oracle spatial SQL construction."
alias, col, db_type = lvalue
# Getting the quoted table name as `geo_col`.
geo_col = '%s.%s' % (qn(alias), qn(col))
# See if a Oracle Geometry function matches the lookup type next
lookup_info = self.geometry_functions.get(lookup_type, False)
if lookup_info:
# Lookup types that are tuples take tuple arguments, e.g., 'relate' and
# 'dwithin' lookup types.
if isinstance(lookup_info, tuple):
# First element of tuple is lookup type, second element is the type
# of the expected argument (e.g., str, float)
sdo_op, arg_type = lookup_info
geom = value[0]
# Ensuring that a tuple _value_ was passed in from the user
if not isinstance(value, tuple):
raise ValueError('Tuple required for `%s` lookup type.' % lookup_type)
if len(value) != 2:
raise ValueError('2-element tuple required for %s lookup type.' % lookup_type)
# Ensuring the argument type matches what we expect.
if not isinstance(value[1], arg_type):
raise ValueError('Argument type should be %s, got %s instead.' % (arg_type, type(value[1])))
if lookup_type == 'relate':
# The SDORelate class handles construction for these queries,
# and verifies the mask argument.
return sdo_op(value[1]).as_sql(geo_col, self.get_geom_placeholder(field, geom))
else:
# Otherwise, just call the `as_sql` method on the SDOOperation instance.
return sdo_op.as_sql(geo_col, self.get_geom_placeholder(field, geom))
else:
# Lookup info is a SDOOperation instance, whose `as_sql` method returns
# the SQL necessary for the geometry function call. For example:
# SDO_CONTAINS("geoapp_country"."poly", SDO_GEOMTRY('POINT(5 23)', 4326)) = 'TRUE'
return lookup_info.as_sql(geo_col, self.get_geom_placeholder(field, value))
elif lookup_type == 'isnull':
# Handling 'isnull' lookup type
return "%s IS %sNULL" % (geo_col, (not value and 'NOT ' or ''))
raise TypeError("Got invalid lookup_type: %s" % repr(lookup_type))
def spatial_aggregate_sql(self, agg):
"""
Returns the spatial aggregate SQL template and function for the
given Aggregate instance.
"""
agg_name = agg.__class__.__name__.lower()
if agg_name == 'union' : agg_name += 'agg'
if agg.is_extent:
sql_template = '%(function)s(%(field)s)'
else:
sql_template = '%(function)s(SDOAGGRTYPE(%(field)s,%(tolerance)s))'
sql_function = getattr(self, agg_name)
return self.select % sql_template, sql_function
# Routines for getting the OGC-compliant models.
def geometry_columns(self):
from django.contrib.gis.db.backends.oracle.models import GeometryColumns
return GeometryColumns
def spatial_ref_sys(self):
from django.contrib.gis.db.backends.oracle.models import SpatialRefSys
return SpatialRefSys
| ajibawa-2023/Python-Code-Large/train/row_98786 | 158 | 293 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 9], "level": 0, "parent": null, "vector": [8, 0, 0.0171, 0.0307, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n This module contains the spatial lookup types, and the `get_geo_where_clause`\n routine for Oracle Spatial.\n\n Please note that WKT support is broken on the XE version, and thus\n this backend will not work on such platforms. Specifically, XE lacks\n support for an internal JVM, and Java libraries are required to use\n the WKT constructors."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Import_L10_C0", "label": "re import re", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0341, 0.0034, 0, 0.66, 0.0667, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:ImportFrom_L11_C0", "label": "from decimal import Decimal", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0375, 0.0034, 0, 0.66, 0.1333, 349, 0, 1, 0, 0, 349, 0, 0], "semantic": {"name": "decimal", "arg_names": [], "import_names": ["Decimal"], "rhs_call_name": "", "annotation": ""}, "snippet": "from decimal import Decimal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:ImportFrom_L13_C0", "label": "from django.db.backends.oracle.base import DatabaseOperations", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0444, 0.0034, 0, 0.66, 0.2, 759, 0, 1, 0, 0, 759, 0, 0], "semantic": {"name": "django.db.backends.oracle.base", "arg_names": [], "import_names": ["DatabaseOperations"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.backends.oracle.base import DatabaseOperations"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:ImportFrom_L14_C0", "label": "from django.contrib.gis.db.backends.base import BaseSpatialOperations", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0478, 0.0034, 0, 0.66, 0.2667, 157, 0, 1, 0, 0, 157, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.base", "arg_names": [], "import_names": ["BaseSpatialOperations"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.backends.base import BaseSpatialOperations"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:ImportFrom_L15_C0", "label": "from django.contrib.gis.db.backends.oracle.adapter import OracleSpatialAdapter", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0512, 0.0034, 0, 0.66, 0.3333, 420, 0, 1, 0, 0, 420, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.oracle.adapter", "arg_names": [], "import_names": ["OracleSpatialAdapter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.backends.oracle.adapter import OracleSpatialAdapter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:ImportFrom_L16_C0", "label": "from django.contrib.gis.db.backends.util import SpatialFunction", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0546, 0.0034, 0, 0.66, 0.4, 674, 0, 1, 0, 0, 674, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.util", "arg_names": [], "import_names": ["SpatialFunction"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.backends.util import SpatialFunction"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:ImportFrom_L17_C0", "label": "from django.contrib.gis.geometry.backend import Geometry", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.058, 0.0034, 0, 0.66, 0.4667, 299, 0, 1, 0, 0, 299, 0, 0], "semantic": {"name": "django.contrib.gis.geometry.backend", "arg_names": [], "import_names": ["Geometry"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.geometry.backend import Geometry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:ImportFrom_L18_C0", "label": "from django.contrib.gis.measure import Distance", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0614, 0.0034, 0, 0.66, 0.5333, 844, 0, 1, 0, 0, 844, 0, 0], "semantic": {"name": "django.contrib.gis.measure", "arg_names": [], "import_names": ["Distance"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.measure import Distance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L20_C0", "label": "SDOOperation", "type": "class", "loc": [20, 27], "level": 0, "parent": null, "vector": [3, 0, 0.0802, 0.0273, 0, 0.66, 0.6, 153, 0, 1, 0, 0, 763, 0, 4], "semantic": {"name": "SDOOperation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SDOOperation(SpatialFunction):\n \"Base class for SDO* Oracle operations.\"\n sql_template = \"%(function)s(%(geo_col)s, %(geometry)s) %(operator)s '%(result)s'\"\n\n def __init__(self, func, **kwargs):\n kwargs.setdefault('operator', '=')\n kwargs.setdefault('result', 'TRUE')\n super(SDOOperation, self).__init__(func, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L21_C4", "label": "expression", "type": "expression", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L20_C0", "vector": [8, 1, 0.0717, 0.0034, 1, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Base class for SDO* Oracle operations.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L22_C4", "label": "sql_template =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L20_C0", "vector": [14, 1, 0.0751, 0.0034, 1, 0.91, 0.5, 765, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sql_template", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sql_template = \"%(function)s(%(geo_col)s, %(geometry)s) %(operator)s '%(result)s'\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L24_C4", "label": "__init__", "type": "function", "loc": [24, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L20_C0", "vector": [2, 1, 0.087, 0.0137, 1, 0.91, 1.0, 555, 0, 3, 0, 0, 0, 0, 4], "semantic": {"name": "__init__", "arg_names": ["self", "func", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, func, **kwargs):\n kwargs.setdefault('operator', '=')\n kwargs.setdefault('result', 'TRUE')\n super(SDOOperation, self).__init__(func, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L25_C8", "label": "setdefault()", "type": "expression", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L24_C4", "vector": [8, 2, 0.0853, 0.0034, 2, 0.23, 0.0, 262, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " kwargs.setdefault('operator', '=')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L26_C8", "label": "setdefault()", "type": "expression", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L24_C4", "vector": [8, 2, 0.0887, 0.0034, 2, 0.23, 0.5, 262, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " kwargs.setdefault('result', 'TRUE')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L27_C8", "label": "__init__()", "type": "expression", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L24_C4", "vector": [8, 2, 0.0922, 0.0034, 2, 0.23, 1.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(SDOOperation, self).__init__(func, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L29_C0", "label": "SDODistance", "type": "class", "loc": [29, 37], "level": 0, "parent": null, "vector": [3, 0, 0.1126, 0.0307, 0, 0.66, 0.6667, 256, 0, 1, 0, 0, 763, 0, 2], "semantic": {"name": "SDODistance", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SDODistance(SpatialFunction):\n \"Class for Distance queries.\"\n sql_template = ('%(function)s(%(geo_col)s, %(geometry)s, %(tolerance)s) '\n '%(operator)s %(result)s')\n dist_func = 'SDO_GEOM.SDO_DISTANCE'\n def __init__(self, op, tolerance=0.05):\n super(SDODistance, self).__init__(self.dist_func,\n tolerance=tolerance,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L30_C4", "label": "expression", "type": "expression", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L29_C0", "vector": [8, 1, 0.1024, 0.0034, 1, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Class for Distance queries.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L31_C4", "label": "sql_template =", "type": "assigned_variable", "loc": [31, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L29_C0", "vector": [14, 1, 0.1075, 0.0068, 1, 0.41, 0.3333, 765, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sql_template", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sql_template = ('%(function)s(%(geo_col)s, %(geometry)s, %(tolerance)s) '\n '%(operator)s %(result)s')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L33_C4", "label": "dist_func =", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L29_C0", "vector": [14, 1, 0.1126, 0.0034, 1, 0.41, 0.6667, 591, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "dist_func", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dist_func = 'SDO_GEOM.SDO_DISTANCE'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L34_C4", "label": "__init__", "type": "function", "loc": [34, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L29_C0", "vector": [2, 1, 0.1212, 0.0137, 1, 0.41, 1.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "op", "tolerance"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, op, tolerance=0.05):\n super(SDODistance, self).__init__(self.dist_func,\n tolerance=tolerance,\n operator=op, result='%s')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L35_C8", "label": "__init__()", "type": "expression", "loc": [35, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L34_C4", "vector": [8, 2, 0.1229, 0.0102, 2, 0.3, 0.0, 555, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(SDODistance, self).__init__(self.dist_func,\n tolerance=tolerance,\n operator=op, result='%s')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L39_C0", "label": "SDODWithin", "type": "class", "loc": [39, 43], "level": 0, "parent": null, "vector": [3, 0, 0.1399, 0.0171, 0, 0.66, 0.7333, 360, 0, 1, 0, 0, 763, 0, 2], "semantic": {"name": "SDODWithin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SDODWithin(SpatialFunction):\n dwithin_func = 'SDO_WITHIN_DISTANCE'\n sql_template = \"%(function)s(%(geo_col)s, %(geometry)s, %%s) = 'TRUE'\"\n def __init__(self):\n super(SDODWithin, self).__init__(self.dwithin_func)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L40_C4", "label": "dwithin_func =", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L39_C0", "vector": [14, 1, 0.1365, 0.0034, 1, 0.52, 0.0, 889, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "dwithin_func", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dwithin_func = 'SDO_WITHIN_DISTANCE'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L41_C4", "label": "sql_template =", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L39_C0", "vector": [14, 1, 0.1399, 0.0034, 1, 0.52, 0.5, 765, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sql_template", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sql_template = \"%(function)s(%(geo_col)s, %(geometry)s, %%s) = 'TRUE'\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L42_C4", "label": "__init__", "type": "function", "loc": [42, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L39_C0", "vector": [2, 1, 0.1451, 0.0068, 1, 0.52, 1.0, 555, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n super(SDODWithin, self).__init__(self.dwithin_func)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L43_C8", "label": "__init__()", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L42_C4", "vector": [8, 2, 0.1468, 0.0034, 2, 0.16, 0.0, 555, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(SDODWithin, self).__init__(self.dwithin_func)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L45_C0", "label": "SDOGeomRelate", "type": "class", "loc": [45, 54], "level": 0, "parent": null, "vector": [3, 0, 0.1689, 0.0341, 0, 0.66, 0.8, 438, 0, 1, 0, 0, 763, 0, 2], "semantic": {"name": "SDOGeomRelate", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SDOGeomRelate(SpatialFunction):\n \"Class for using SDO_GEOM.RELATE.\"\n relate_func = 'SDO_GEOM.RELATE'\n sql_template = (\"%(function)s(%(geo_col)s, '%(mask)s', %(geometry)s, \"\n \"%(tolerance)s) %(operator)s '%(mask)s'\")\n def __init__(self, mask, tolerance=0.05):\n # SDO_GEOM.RELATE(...) has a peculiar argument order: column, mask, geom, tolerance.\n # Moreover, the runction result is the mask (e.g., 'DISJOINT' instead of 'TRUE')."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L46_C4", "label": "expression", "type": "expression", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L45_C0", "vector": [8, 1, 0.157, 0.0034, 1, 0.35, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Class for using SDO_GEOM.RELATE.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L47_C4", "label": "relate_func =", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L45_C0", "vector": [14, 1, 0.1604, 0.0034, 1, 0.35, 0.3333, 291, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "relate_func", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " relate_func = 'SDO_GEOM.RELATE'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L48_C4", "label": "sql_template =", "type": "assigned_variable", "loc": [48, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L45_C0", "vector": [14, 1, 0.1655, 0.0068, 1, 0.35, 0.6667, 765, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sql_template", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sql_template = (\"%(function)s(%(geo_col)s, '%(mask)s', %(geometry)s, \"\n \"%(tolerance)s) %(operator)s '%(mask)s'\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L50_C4", "label": "__init__", "type": "function", "loc": [50, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L45_C0", "vector": [2, 1, 0.1775, 0.0171, 1, 0.35, 1.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "mask", "tolerance"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, mask, tolerance=0.05):\n # SDO_GEOM.RELATE(...) has a peculiar argument order: column, mask, geom, tolerance.\n # Moreover, the runction result is the mask (e.g., 'DISJOINT' instead of 'TRUE').\n super(SDOGeomRelate, self).__init__(self.relate_func, operator='=',\n mask=mask, tolerance=tolerance)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L53_C8", "label": "__init__()", "type": "expression", "loc": [53, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L50_C4", "vector": [8, 2, 0.1826, 0.0068, 2, 0.39, 0.0, 555, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(SDOGeomRelate, self).__init__(self.relate_func, operator='=',\n mask=mask, tolerance=tolerance)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L56_C0", "label": "SDORelate", "type": "class", "loc": [56, 65], "level": 0, "parent": null, "vector": [3, 0, 0.2065, 0.0341, 0, 0.66, 0.8667, 927, 0, 1, 0, 0, 763, 0, 5], "semantic": {"name": "SDORelate", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SDORelate(SpatialFunction):\n \"Class for using SDO_RELATE.\"\n masks = 'TOUCH|OVERLAPBDYDISJOINT|OVERLAPBDYINTERSECT|EQUAL|INSIDE|COVEREDBY|CONTAINS|COVERS|ANYINTERACT|ON'\n mask_regex = re.compile(r'^(%s)(\\+(%s))*$' % (masks, masks), re.I)\n sql_template = \"%(function)s(%(geo_col)s, %(geometry)s, 'mask=%(mask)s') = 'TRUE'\"\n relate_func = 'SDO_RELATE'\n def __init__(self, mask):\n if not self.mask_regex.match(mask):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L57_C4", "label": "expression", "type": "expression", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L56_C0", "vector": [8, 1, 0.1945, 0.0034, 1, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Class for using SDO_RELATE.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L58_C4", "label": "masks =", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L56_C0", "vector": [14, 1, 0.198, 0.0034, 1, 0.37, 0.2, 99, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "masks", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " masks = 'TOUCH|OVERLAPBDYDISJOINT|OVERLAPBDYINTERSECT|EQUAL|INSIDE|COVEREDBY|CONTAINS|COVERS|ANYINTERACT|ON'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L59_C4", "label": "mask_regex = compile()", "type": "assigned_variable", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L56_C0", "vector": [14, 1, 0.2014, 0.0034, 1, 0.37, 0.4, 986, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "mask_regex", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " mask_regex = re.compile(r'^(%s)(\\+(%s))*$' % (masks, masks), re.I)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L60_C4", "label": "sql_template =", "type": "assigned_variable", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L56_C0", "vector": [14, 1, 0.2048, 0.0034, 1, 0.37, 0.6, 765, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sql_template", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sql_template = \"%(function)s(%(geo_col)s, %(geometry)s, 'mask=%(mask)s') = 'TRUE'\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L61_C4", "label": "relate_func =", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L56_C0", "vector": [14, 1, 0.2082, 0.0034, 1, 0.37, 0.8, 291, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "relate_func", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " relate_func = 'SDO_RELATE'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L62_C4", "label": "__init__", "type": "function", "loc": [62, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L56_C0", "vector": [2, 1, 0.2167, 0.0137, 1, 0.37, 1.0, 555, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "__init__", "arg_names": ["self", "mask"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, mask):\n if not self.mask_regex.match(mask):\n raise ValueError('Invalid %s mask: \"%s\"' % (self.relate_func, mask))\n super(SDORelate, self).__init__(self.relate_func, mask=mask)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L63_C8", "label": "if", "type": "if", "loc": [63, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L62_C4", "vector": [4, 2, 0.2167, 0.0068, 2, 0.04, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.mask_regex.match(mask):\n raise ValueError('Invalid %s mask: \"%s\"' % (self.relate_func, mask))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L65_C8", "label": "__init__()", "type": "expression", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L62_C4", "vector": [8, 2, 0.2218, 0.0034, 2, 0.04, 1.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(SDORelate, self).__init__(self.relate_func, mask=mask)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L68_C0", "label": "dtypes =", "type": "assigned_variable", "loc": [68, 68], "level": 0, "parent": null, "vector": [14, 0, 0.2321, 0.0034, 0, 0.66, 0.9333, 87, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "dtypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "dtypes = (Decimal, Distance, float, int, long)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "label": "OracleOperations", "type": "class", "loc": [70, 293], "level": 0, "parent": null, "vector": [3, 0, 0.6195, 0.7645, 0, 0.66, 1.0, 397, 0, 11, 0, 0, 311, 0, 60], "semantic": {"name": "OracleOperations", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OracleOperations(DatabaseOperations, BaseSpatialOperations):\n compiler_module = \"django.contrib.gis.db.backends.oracle.compiler\"\n\n name = 'oracle'\n oracle = True\n valid_aggregates = dict([(a, None) for a in ('Union', 'Extent')])\n\n Adapter = OracleSpatialAdapter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L71_C4", "label": "compiler_module =", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.2423, 0.0034, 1, 0.31, 0.0, 902, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "compiler_module", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " compiler_module = \"django.contrib.gis.db.backends.oracle.compiler\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L73_C4", "label": "name =", "type": "assigned_variable", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.2491, 0.0034, 1, 0.31, 0.0256, 57, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = 'oracle'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L74_C4", "label": "oracle =", "type": "assigned_variable", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.2526, 0.0034, 1, 0.31, 0.0513, 86, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "oracle", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " oracle = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L75_C4", "label": "valid_aggregates = dict()", "type": "assigned_variable", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.256, 0.0034, 1, 0.31, 0.0769, 414, 3, 1, 0, 0, 827, 10, 1], "semantic": {"name": "valid_aggregates", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " valid_aggregates = dict([(a, None) for a in ('Union', 'Extent')])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L77_C4", "label": "Adapter =", "type": "assigned_variable", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.2628, 0.0034, 1, 0.31, 0.1026, 6, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Adapter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " Adapter = OracleSpatialAdapter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L78_C4", "label": "Adaptor =", "type": "assigned_variable", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.2662, 0.0034, 1, 0.31, 0.1282, 764, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Adaptor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " Adaptor = Adapter # Backwards-compatibility alias."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L80_C4", "label": "area =", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.273, 0.0034, 1, 0.31, 0.1538, 715, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "area", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " area = 'SDO_GEOM.SDO_AREA'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L81_C4", "label": "gml =", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.2765, 0.0034, 1, 0.31, 0.1795, 410, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "gml", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " gml= 'SDO_UTIL.TO_GMLGEOMETRY'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L82_C4", "label": "centroid =", "type": "assigned_variable", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.2799, 0.0034, 1, 0.31, 0.2051, 439, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "centroid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " centroid = 'SDO_GEOM.SDO_CENTROID'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L83_C4", "label": "difference =", "type": "assigned_variable", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.2833, 0.0034, 1, 0.31, 0.2308, 498, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "difference", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " difference = 'SDO_GEOM.SDO_DIFFERENCE'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L84_C4", "label": "distance =", "type": "assigned_variable", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.2867, 0.0034, 1, 0.31, 0.2564, 145, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "distance", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " distance = 'SDO_GEOM.SDO_DISTANCE'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L85_C4", "label": "extent =", "type": "assigned_variable", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.2901, 0.0034, 1, 0.31, 0.2821, 962, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "extent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " extent= 'SDO_AGGR_MBR'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L86_C4", "label": "intersection =", "type": "assigned_variable", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.2935, 0.0034, 1, 0.31, 0.3077, 568, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "intersection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " intersection= 'SDO_GEOM.SDO_INTERSECTION'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L87_C4", "label": "length =", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.2969, 0.0034, 1, 0.31, 0.3333, 221, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "length", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " length = 'SDO_GEOM.SDO_LENGTH'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L88_C4", "label": "num_geom =", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.3003, 0.0034, 1, 0.31, 0.359, 574, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "num_geom", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " num_geom = 'SDO_UTIL.GETNUMELEM'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L89_C4", "label": "num_points =", "type": "assigned_variable", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.3038, 0.0034, 1, 0.31, 0.3846, 754, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "num_points", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " num_points = 'SDO_UTIL.GETNUMVERTICES'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L90_C4", "label": "perimeter =", "type": "assigned_variable", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.3072, 0.0034, 1, 0.31, 0.4103, 896, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "perimeter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " perimeter = length"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L91_C4", "label": "point_on_surface =", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.3106, 0.0034, 1, 0.31, 0.4359, 858, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "point_on_surface", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " point_on_surface = 'SDO_GEOM.SDO_POINTONSURFACE'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L92_C4", "label": "reverse =", "type": "assigned_variable", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.314, 0.0034, 1, 0.31, 0.4615, 109, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "reverse", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " reverse = 'SDO_UTIL.REVERSE_LINESTRING'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L93_C4", "label": "sym_difference =", "type": "assigned_variable", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.3174, 0.0034, 1, 0.31, 0.4872, 37, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sym_difference", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sym_difference = 'SDO_GEOM.SDO_XOR'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L94_C4", "label": "transform =", "type": "assigned_variable", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.3208, 0.0034, 1, 0.31, 0.5128, 48, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "transform", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " transform = 'SDO_CS.TRANSFORM'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L95_C4", "label": "union =", "type": "assigned_variable", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.3242, 0.0034, 1, 0.31, 0.5385, 140, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "union", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " union = 'SDO_GEOM.SDO_UNION'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L96_C4", "label": "unionagg =", "type": "assigned_variable", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.3276, 0.0034, 1, 0.31, 0.5641, 886, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "unionagg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " unionagg = 'SDO_AGGR_UNION'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L103_C4", "label": "select =", "type": "assigned_variable", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.3515, 0.0034, 1, 0.31, 0.5897, 438, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "select", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " select = 'SDO_UTIL.TO_WKTGEOMETRY(%s)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L105_C4", "label": "distance_functions =", "type": "assigned_variable", "loc": [105, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.3686, 0.0239, 1, 0.31, 0.6154, 23, 0, 0, 0, 0, 0, 6, 5], "semantic": {"name": "distance_functions", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " distance_functions = {\n 'distance_gt' : (SDODistance('>'), dtypes),\n 'distance_gte' : (SDODistance('>='), dtypes),\n 'distance_lt' : (SDODistance('<'), dtypes),\n 'distance_lte' : (SDODistance('<='), dtypes),\n 'dwithin' : (SDODWithin(), dtypes),\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L113_C4", "label": "geometry_functions =", "type": "assigned_variable", "loc": [113, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.4078, 0.0478, 1, 0.31, 0.641, 884, 0, 0, 0, 0, 0, 6, 11], "semantic": {"name": "geometry_functions", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geometry_functions = {\n 'contains' : SDOOperation('SDO_CONTAINS'),\n 'coveredby' : SDOOperation('SDO_COVEREDBY'),\n 'covers' : SDOOperation('SDO_COVERS'),\n 'disjoint' : SDOGeomRelate('DISJOINT'),\n 'intersects' : SDOOperation('SDO_OVERLAPBDYINTERSECT'), # TODO: Is this really the same as ST_Intersects()?\n 'equals' : SDOOperation('SDO_EQUAL'),\n 'exact' : SDOOperation('SDO_EQUAL'),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L127_C4", "label": "update()", "type": "expression", "loc": [127, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [8, 1, 0.4334, 0.0034, 1, 0.31, 0.6667, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " geometry_functions.update(distance_functions)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L129_C4", "label": "gis_terms =", "type": "assigned_variable", "loc": [129, 129], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.4403, 0.0034, 1, 0.31, 0.6923, 983, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "gis_terms", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " gis_terms = ['isnull']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L131_C4", "label": "gis_terms = dict()", "type": "assigned_variable", "loc": [131, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.4471, 0.0034, 1, 0.31, 0.7179, 983, 3, 1, 0, 0, 827, 10, 1], "semantic": {"name": "gis_terms", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " gis_terms = dict([(term, None) for term in gis_terms])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L133_C4", "label": "truncate_params =", "type": "assigned_variable", "loc": [133, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [14, 1, 0.4539, 0.0034, 1, 0.31, 0.7436, 657, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "truncate_params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " truncate_params = {'relate' : None}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L135_C4", "label": "__init__", "type": "function", "loc": [135, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [2, 1, 0.4642, 0.0102, 1, 0.31, 0.7692, 555, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "connection"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, connection):\n super(OracleOperations, self).__init__()\n self.connection = connection"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L136_C8", "label": "__init__()", "type": "expression", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L135_C4", "vector": [8, 2, 0.4642, 0.0034, 2, 0.52, 0.0, 555, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(OracleOperations, self).__init__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L137_C8", "label": "self.connection =", "type": "assigned_variable", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L135_C4", "vector": [14, 2, 0.4676, 0.0034, 2, 0.52, 1.0, 685, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.connection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.connection = connection"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L139_C4", "label": "convert_extent", "type": "function", "loc": [139, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [2, 1, 0.5085, 0.0717, 1, 0.31, 0.7949, 816, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "convert_extent", "arg_names": ["self", "clob"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def convert_extent(self, clob):\n if clob:\n # Generally, Oracle returns a polygon for the extent -- however,\n # it can return a single point if there's only one Point in the\n # table.\n ext_geom = Geometry(clob.read())\n gtype = str(ext_geom.geom_type)\n if gtype == 'Polygon':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L140_C8", "label": "if", "type": "if", "loc": [140, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L139_C4", "vector": [4, 2, 0.5102, 0.0683, 2, 0.42, 0.0, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if clob:\n # Generally, Oracle returns a polygon for the extent -- however,\n # it can return a single point if there's only one Point in the\n # table.\n ext_geom = Geometry(clob.read())\n gtype = str(ext_geom.geom_type)\n if gtype == 'Polygon':\n # Construct the 4-tuple from the coordinates in the polygon."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L144_C12", "label": "ext_geom = Geometry()", "type": "assigned_variable", "loc": [144, 144], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L140_C8", "vector": [14, 3, 0.4915, 0.0034, 3, 0.85, 0.0, 492, 3, 1, 0, 0, 361, 10, 2], "semantic": {"name": "ext_geom", "arg_names": [], "import_names": [], "rhs_call_name": "Geometry", "annotation": ""}, "snippet": " ext_geom = Geometry(clob.read())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L145_C12", "label": "gtype = str()", "type": "assigned_variable", "loc": [145, 145], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L140_C8", "vector": [14, 3, 0.4949, 0.0034, 3, 0.85, 0.1667, 377, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "gtype", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " gtype = str(ext_geom.geom_type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L146_C12", "label": "if", "type": "if", "loc": [146, 154], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L140_C8", "vector": [4, 3, 0.5119, 0.0307, 3, 0.85, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if gtype == 'Polygon':\n # Construct the 4-tuple from the coordinates in the polygon.\n shell = ext_geom.shell\n ll, ur = shell[0][:2], shell[2][:2]\n elif gtype == 'Point':\n ll = ext_geom.coords[:2]\n ur = ll\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L148_C16", "label": "shell =", "type": "assigned_variable", "loc": [148, 148], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L146_C12", "vector": [14, 4, 0.5051, 0.0034, 4, 0.24, 0.0, 192, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "shell", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " shell = ext_geom.shell"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L149_C16", "label": "ll, ur =", "type": "assigned_variable", "loc": [149, 149], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L146_C12", "vector": [14, 4, 0.5085, 0.0034, 4, 0.24, 0.5, 979, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "ll, ur", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ll, ur = shell[0][:2], shell[2][:2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L150_C12", "label": "if", "type": "if", "loc": [150, 154], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L146_C12", "vector": [4, 4, 0.5188, 0.0171, 4, 0.24, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif gtype == 'Point':\n ll = ext_geom.coords[:2]\n ur = ll\n else:\n raise Exception('Unexpected geometry type returned for extent: %s' % gtype)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L151_C16", "label": "ll =", "type": "assigned_variable", "loc": [151, 151], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L150_C12", "vector": [14, 5, 0.5154, 0.0034, 5, 0.39, 0.0, 929, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ll", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ll = ext_geom.coords[:2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L152_C16", "label": "ur =", "type": "assigned_variable", "loc": [152, 152], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L150_C12", "vector": [14, 5, 0.5188, 0.0034, 5, 0.39, 1.0, 611, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ur", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ur = ll"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L155_C12", "label": "xmin, ymin =", "type": "assigned_variable", "loc": [155, 155], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L140_C8", "vector": [14, 3, 0.529, 0.0034, 3, 0.85, 0.5, 72, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "xmin, ymin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xmin, ymin = ll"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L156_C12", "label": "xmax, ymax =", "type": "assigned_variable", "loc": [156, 156], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L140_C8", "vector": [14, 3, 0.5324, 0.0034, 3, 0.85, 0.6667, 344, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "xmax, ymax", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xmax, ymax = ur"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L157_C12", "label": "return", "type": "return", "loc": [157, 157], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L140_C8", "vector": [13, 3, 0.5358, 0.0034, 3, 0.85, 0.8333, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (xmin, ymin, xmax, ymax)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L159_C12", "label": "return", "type": "return", "loc": [159, 159], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L140_C8", "vector": [13, 3, 0.5427, 0.0034, 3, 0.85, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L161_C4", "label": "convert_geom", "type": "function", "loc": [161, 165], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [2, 1, 0.5563, 0.0171, 1, 0.31, 0.8205, 452, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "convert_geom", "arg_names": ["self", "clob", "geo_field"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def convert_geom(self, clob, geo_field):\n if clob:\n return Geometry(clob.read(), geo_field.srid)\n else:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L162_C8", "label": "if", "type": "if", "loc": [162, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L161_C4", "vector": [4, 2, 0.558, 0.0137, 2, 0.65, 0.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if clob:\n return Geometry(clob.read(), geo_field.srid)\n else:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L163_C12", "label": "return", "type": "return", "loc": [163, 163], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L162_C8", "vector": [13, 3, 0.5563, 0.0034, 3, 0.03, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Geometry(clob.read(), geo_field.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L165_C12", "label": "return", "type": "return", "loc": [165, 165], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L162_C8", "vector": [13, 3, 0.5631, 0.0034, 3, 0.03, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L167_C4", "label": "geo_db_type", "type": "function", "loc": [167, 173], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [2, 1, 0.5802, 0.0239, 1, 0.31, 0.8462, 347, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "geo_db_type", "arg_names": ["self", "f"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geo_db_type(self, f):\n \"\"\"\n Returns the geometry database type for Oracle. Unlike other spatial\n backends, no stored procedure is necessary and it's the same for all\n geometry types.\n \"\"\"\n return 'MDSYS.SDO_GEOMETRY'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L168_C8", "label": "expression", "type": "expression", "loc": [168, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L167_C4", "vector": [8, 2, 0.5802, 0.0171, 2, 0.61, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the geometry database type for Oracle. Unlike other spatial\n backends, no stored procedure is necessary and it's the same for all\n geometry types.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L173_C8", "label": "return", "type": "return", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L167_C4", "vector": [13, 2, 0.5904, 0.0034, 2, 0.61, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'MDSYS.SDO_GEOMETRY'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L175_C4", "label": "get_distance", "type": "function", "loc": [175, 198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [2, 1, 0.6365, 0.0819, 1, 0.31, 0.8718, 243, 0, 4, 1, 0, 0, 0, 5], "semantic": {"name": "get_distance", "arg_names": ["self", "f", "value", "lookup_type"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_distance(self, f, value, lookup_type):\n \"\"\"\n Returns the distance parameters given the value and the lookup type.\n On Oracle, geometry columns with a geodetic coordinate system behave\n implicitly like a geography column, and thus meters will be used as\n the distance parameter on them.\n \"\"\"\n if not value:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L176_C8", "label": "expression", "type": "expression", "loc": [176, 181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L175_C4", "vector": [8, 2, 0.6092, 0.0205, 2, 0.08, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the distance parameters given the value and the lookup type.\n On Oracle, geometry columns with a geodetic coordinate system behave\n implicitly like a geography column, and thus meters will be used as\n the distance parameter on them.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L182_C8", "label": "if", "type": "if", "loc": [182, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L175_C4", "vector": [4, 2, 0.6229, 0.0068, 2, 0.08, 0.2, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not value:\n return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L183_C12", "label": "return", "type": "return", "loc": [183, 183], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L182_C8", "vector": [13, 3, 0.6246, 0.0034, 3, 0.77, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L184_C8", "label": "value =", "type": "assigned_variable", "loc": [184, 184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L175_C4", "vector": [14, 2, 0.628, 0.0034, 2, 0.08, 0.4, 441, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = value[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L185_C8", "label": "if", "type": "if", "loc": [185, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L175_C4", "vector": [4, 2, 0.6416, 0.0239, 2, 0.08, 0.6, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, Distance):\n if f.geodetic(self.connection):\n dist_param = value.m\n else:\n dist_param = getattr(value, Distance.unit_attname(f.units_name(self.connection)))\n else:\n dist_param = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L186_C12", "label": "if", "type": "if", "loc": [186, 189], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L185_C8", "vector": [4, 3, 0.6399, 0.0137, 3, 0.11, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if f.geodetic(self.connection):\n dist_param = value.m\n else:\n dist_param = getattr(value, Distance.unit_attname(f.units_name(self.connection)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L187_C16", "label": "dist_param =", "type": "assigned_variable", "loc": [187, 187], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L186_C12", "vector": [14, 4, 0.6382, 0.0034, 4, 0.88, 0.0, 841, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dist_param", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dist_param = value.m"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L189_C16", "label": "dist_param = getattr()", "type": "assigned_variable", "loc": [189, 189], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L186_C12", "vector": [14, 4, 0.6451, 0.0034, 4, 0.88, 1.0, 841, 3, 2, 0, 0, 121, 10, 3], "semantic": {"name": "dist_param", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " dist_param = getattr(value, Distance.unit_attname(f.units_name(self.connection)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L191_C12", "label": "dist_param =", "type": "assigned_variable", "loc": [191, 191], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L185_C8", "vector": [14, 3, 0.6519, 0.0034, 3, 0.11, 1.0, 841, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dist_param", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dist_param = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L195_C8", "label": "if", "type": "if", "loc": [195, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L175_C4", "vector": [4, 2, 0.6672, 0.0068, 2, 0.08, 0.8, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lookup_type == 'dwithin':\n dist_param = 'distance=%s' % dist_param"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L196_C12", "label": "dist_param =", "type": "assigned_variable", "loc": [196, 196], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L195_C8", "vector": [14, 3, 0.6689, 0.0034, 3, 0.76, 0.0, 841, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dist_param", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dist_param = 'distance=%s' % dist_param"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L198_C8", "label": "return", "type": "return", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L175_C4", "vector": [13, 2, 0.6758, 0.0034, 2, 0.08, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [dist_param]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L200_C4", "label": "get_geom_placeholder", "type": "function", "loc": [200, 224], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [2, 1, 0.7235, 0.0853, 1, 0.31, 0.8974, 983, 0, 3, 1, 0, 0, 0, 5], "semantic": {"name": "get_geom_placeholder", "arg_names": ["self", "f", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_geom_placeholder(self, f, value):\n \"\"\"\n Provides a proper substitution value for Geometries that are not in the\n SRID of the field. Specifically, this routine will substitute in the\n SDO_CS.TRANSFORM() function call.\n \"\"\"\n if value is None:\n return 'NULL'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L201_C8", "label": "expression", "type": "expression", "loc": [201, 205], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L200_C4", "vector": [8, 2, 0.6928, 0.0171, 2, 0.24, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Provides a proper substitution value for Geometries that are not in the\n SRID of the field. Specifically, this routine will substitute in the\n SDO_CS.TRANSFORM() function call.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L206_C8", "label": "if", "type": "if", "loc": [206, 207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L200_C4", "vector": [4, 2, 0.7048, 0.0068, 2, 0.24, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value is None:\n return 'NULL'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L207_C12", "label": "return", "type": "return", "loc": [207, 207], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L206_C8", "vector": [13, 3, 0.7065, 0.0034, 3, 0.3, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'NULL'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L209_C8", "label": "transform_value", "type": "function", "loc": [209, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L200_C4", "vector": [2, 2, 0.715, 0.0068, 2, 0.24, 0.6667, 280, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "transform_value", "arg_names": ["val", "srid"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def transform_value(val, srid):\n return val.srid != srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L210_C12", "label": "return", "type": "return", "loc": [210, 210], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L209_C8", "vector": [13, 3, 0.7167, 0.0034, 3, 0.55, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return val.srid != srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L212_C8", "label": "if", "type": "if", "loc": [212, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L200_C4", "vector": [4, 2, 0.744, 0.0444, 2, 0.24, 1.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(value, 'expression'):\n if transform_value(value, f.srid):\n placeholder = '%s(%%s, %s)' % (self.transform, f.srid)\n else:\n placeholder = '%s'\n # No geometry value used for F expression, substitue in\n # the column name instead.\n return placeholder % '%s.%s' % tuple(map(self.quote_name, value.cols[value.expression]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L213_C12", "label": "if", "type": "if", "loc": [213, 216], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L212_C8", "vector": [4, 3, 0.7321, 0.0137, 3, 0.46, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if transform_value(value, f.srid):\n placeholder = '%s(%%s, %s)' % (self.transform, f.srid)\n else:\n placeholder = '%s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L214_C16", "label": "placeholder =", "type": "assigned_variable", "loc": [214, 214], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L213_C12", "vector": [14, 4, 0.7304, 0.0034, 4, 0.47, 0.0, 847, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "placeholder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " placeholder = '%s(%%s, %s)' % (self.transform, f.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L216_C16", "label": "placeholder =", "type": "assigned_variable", "loc": [216, 216], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L213_C12", "vector": [14, 4, 0.7372, 0.0034, 4, 0.47, 1.0, 847, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "placeholder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " placeholder = '%s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L219_C12", "label": "return", "type": "return", "loc": [219, 219], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L212_C8", "vector": [13, 3, 0.7474, 0.0034, 3, 0.46, 0.5, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return placeholder % '%s.%s' % tuple(map(self.quote_name, value.cols[value.expression]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L221_C12", "label": "if", "type": "if", "loc": [221, 224], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L212_C8", "vector": [4, 3, 0.7594, 0.0137, 3, 0.46, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if transform_value(value, f.srid):\n return '%s(SDO_GEOMETRY(%%s, %s), %s)' % (self.transform, value.srid, f.srid)\n else:\n return 'SDO_GEOMETRY(%%s, %s)' % f.srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L222_C16", "label": "return", "type": "return", "loc": [222, 222], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L221_C12", "vector": [13, 4, 0.7577, 0.0034, 4, 0.51, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s(SDO_GEOMETRY(%%s, %s), %s)' % (self.transform, value.srid, f.srid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L224_C16", "label": "return", "type": "return", "loc": [224, 224], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L221_C12", "vector": [13, 4, 0.7645, 0.0034, 4, 0.51, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'SDO_GEOMETRY(%%s, %s)' % f.srid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L226_C4", "label": "spatial_lookup_sql", "type": "function", "loc": [226, 270], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [2, 1, 0.8464, 0.1536, 1, 0.31, 0.9231, 975, 0, 6, 1, 0, 0, 0, 20], "semantic": {"name": "spatial_lookup_sql", "arg_names": ["self", "lvalue", "lookup_type", "value", "field", "qn"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def spatial_lookup_sql(self, lvalue, lookup_type, value, field, qn):\n \"Returns the SQL WHERE clause for use in Oracle spatial SQL construction.\"\n alias, col, db_type = lvalue\n\n # Getting the quoted table name as `geo_col`.\n geo_col = '%s.%s' % (qn(alias), qn(col))\n\n # See if a Oracle Geometry function matches the lookup type next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L227_C8", "label": "expression", "type": "expression", "loc": [227, 227], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L226_C4", "vector": [8, 2, 0.7747, 0.0034, 2, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the SQL WHERE clause for use in Oracle spatial SQL construction.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L228_C8", "label": "alias, col, db_type =", "type": "assigned_variable", "loc": [228, 228], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L226_C4", "vector": [14, 2, 0.7782, 0.0034, 2, 0.25, 0.25, 237, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "alias, col, db_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " alias, col, db_type = lvalue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L231_C8", "label": "geo_col =", "type": "assigned_variable", "loc": [231, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L226_C4", "vector": [14, 2, 0.7884, 0.0034, 2, 0.25, 0.5, 139, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "geo_col", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geo_col = '%s.%s' % (qn(alias), qn(col))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L234_C8", "label": "lookup_info = get()", "type": "assigned_variable", "loc": [234, 234], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L226_C4", "vector": [14, 2, 0.7986, 0.0034, 2, 0.25, 0.75, 472, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "lookup_info", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " lookup_info = self.geometry_functions.get(lookup_type, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L235_C8", "label": "if", "type": "if", "loc": [235, 268], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L226_C4", "vector": [4, 2, 0.8584, 0.116, 2, 0.25, 1.0, 0, 2, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lookup_info:\n # Lookup types that are tuples take tuple arguments, e.g., 'relate' and\n # 'dwithin' lookup types.\n if isinstance(lookup_info, tuple):\n # First element of tuple is lookup type, second element is the type\n # of the expected argument (e.g., str, float)\n sdo_op, arg_type = lookup_info\n geom = value[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L238_C12", "label": "if", "type": "if", "loc": [238, 265], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L235_C8", "vector": [4, 3, 0.8584, 0.0956, 3, 0.58, 0.0, 0, 3, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(lookup_info, tuple):\n # First element of tuple is lookup type, second element is the type\n # of the expected argument (e.g., str, float)\n sdo_op, arg_type = lookup_info\n geom = value[0]\n\n # Ensuring that a tuple _value_ was passed in from the user\n if not isinstance(value, tuple):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L241_C16", "label": "sdo_op, arg_type =", "type": "assigned_variable", "loc": [241, 241], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L238_C12", "vector": [14, 4, 0.8225, 0.0034, 4, 0.22, 0.0, 910, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sdo_op, arg_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sdo_op, arg_type = lookup_info"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L242_C16", "label": "geom =", "type": "assigned_variable", "loc": [242, 242], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L238_C12", "vector": [14, 4, 0.8259, 0.0034, 4, 0.22, 0.1667, 5, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "geom", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " geom = value[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L245_C16", "label": "if", "type": "if", "loc": [245, 246], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L238_C12", "vector": [4, 4, 0.8379, 0.0068, 4, 0.22, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(value, tuple):\n raise ValueError('Tuple required for `%s` lookup type.' % lookup_type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L247_C16", "label": "if", "type": "if", "loc": [247, 248], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L238_C12", "vector": [4, 4, 0.8447, 0.0068, 4, 0.22, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(value) != 2:\n raise ValueError('2-element tuple required for %s lookup type.' % lookup_type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L251_C16", "label": "if", "type": "if", "loc": [251, 252], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L238_C12", "vector": [4, 4, 0.8584, 0.0068, 4, 0.22, 0.6667, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(value[1], arg_type):\n raise ValueError('Argument type should be %s, got %s instead.' % (arg_type, type(value[1])))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L254_C16", "label": "if", "type": "if", "loc": [254, 260], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L238_C12", "vector": [4, 4, 0.8771, 0.0239, 4, 0.22, 0.8333, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lookup_type == 'relate':\n # The SDORelate class handles construction for these queries,\n # and verifies the mask argument.\n return sdo_op(value[1]).as_sql(geo_col, self.get_geom_placeholder(field, geom))\n else:\n # Otherwise, just call the `as_sql` method on the SDOOperation instance.\n return sdo_op.as_sql(geo_col, self.get_geom_placeholder(field, geom))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L257_C20", "label": "return", "type": "return", "loc": [257, 257], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L254_C16", "vector": [13, 5, 0.8771, 0.0034, 5, 0.68, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sdo_op(value[1]).as_sql(geo_col, self.get_geom_placeholder(field, geom))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L260_C20", "label": "return", "type": "return", "loc": [260, 260], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L254_C16", "vector": [13, 5, 0.8874, 0.0034, 5, 0.68, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sdo_op.as_sql(geo_col, self.get_geom_placeholder(field, geom))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L265_C16", "label": "return", "type": "return", "loc": [265, 265], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L238_C12", "vector": [13, 4, 0.9044, 0.0034, 4, 0.22, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return lookup_info.as_sql(geo_col, self.get_geom_placeholder(field, value))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L266_C8", "label": "if", "type": "if", "loc": [266, 268], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L235_C8", "vector": [4, 3, 0.9113, 0.0102, 3, 0.58, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif lookup_type == 'isnull':\n # Handling 'isnull' lookup type\n return \"%s IS %sNULL\" % (geo_col, (not value and 'NOT ' or ''))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L268_C12", "label": "return", "type": "return", "loc": [268, 268], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L266_C8", "vector": [13, 4, 0.9147, 0.0034, 4, 0.17, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"%s IS %sNULL\" % (geo_col, (not value and 'NOT ' or ''))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L272_C4", "label": "spatial_aggregate_sql", "type": "function", "loc": [272, 284], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [2, 1, 0.9488, 0.0444, 1, 0.31, 0.9487, 835, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "spatial_aggregate_sql", "arg_names": ["self", "agg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def spatial_aggregate_sql(self, agg):\n \"\"\"\n Returns the spatial aggregate SQL template and function for the\n given Aggregate instance.\n \"\"\"\n agg_name = agg.__class__.__name__.lower()\n if agg_name == 'union' : agg_name += 'agg'\n if agg.is_extent:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L273_C8", "label": "expression", "type": "expression", "loc": [273, 276], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L272_C4", "vector": [8, 2, 0.9369, 0.0137, 2, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the spatial aggregate SQL template and function for the\n given Aggregate instance.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L277_C8", "label": "agg_name = lower()", "type": "assigned_variable", "loc": [277, 277], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L272_C4", "vector": [14, 2, 0.9454, 0.0034, 2, 0.43, 0.2, 817, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "agg_name", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " agg_name = agg.__class__.__name__.lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L278_C8", "label": "if", "type": "if", "loc": [278, 278], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L272_C4", "vector": [4, 2, 0.9488, 0.0034, 2, 0.43, 0.4, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if agg_name == 'union' : agg_name += 'agg'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L279_C8", "label": "if", "type": "if", "loc": [279, 282], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L272_C4", "vector": [4, 2, 0.9573, 0.0137, 2, 0.43, 0.6, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if agg.is_extent:\n sql_template = '%(function)s(%(field)s)'\n else:\n sql_template = '%(function)s(SDOAGGRTYPE(%(field)s,%(tolerance)s))'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L280_C12", "label": "sql_template =", "type": "assigned_variable", "loc": [280, 280], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L279_C8", "vector": [14, 3, 0.9556, 0.0034, 3, 0.14, 0.0, 765, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sql_template", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sql_template = '%(function)s(%(field)s)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L282_C12", "label": "sql_template =", "type": "assigned_variable", "loc": [282, 282], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L279_C8", "vector": [14, 3, 0.9625, 0.0034, 3, 0.14, 1.0, 765, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sql_template", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sql_template = '%(function)s(SDOAGGRTYPE(%(field)s,%(tolerance)s))'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L283_C8", "label": "sql_function = getattr()", "type": "assigned_variable", "loc": [283, 283], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L272_C4", "vector": [14, 2, 0.9659, 0.0034, 2, 0.43, 0.8, 586, 3, 2, 0, 0, 121, 10, 1], "semantic": {"name": "sql_function", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " sql_function = getattr(self, agg_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L284_C8", "label": "return", "type": "return", "loc": [284, 284], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L272_C4", "vector": [13, 2, 0.9693, 0.0034, 2, 0.43, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.select % sql_template, sql_function"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L287_C4", "label": "geometry_columns", "type": "function", "loc": [287, 289], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [2, 1, 0.9829, 0.0102, 1, 0.31, 0.9744, 291, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "geometry_columns", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def geometry_columns(self):\n from django.contrib.gis.db.backends.oracle.models import GeometryColumns\n return GeometryColumns"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:ImportFrom_L288_C8", "label": "from django.contrib.gis.db.backends.oracle.models import GeometryColumns", "type": "import", "loc": [288, 288], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L287_C4", "vector": [1, 2, 0.9829, 0.0034, 2, 0.19, 0.0, 705, 0, 1, 0, 0, 705, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.oracle.models", "arg_names": [], "import_names": ["GeometryColumns"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.db.backends.oracle.models import GeometryColumns"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L289_C8", "label": "return", "type": "return", "loc": [289, 289], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L287_C4", "vector": [13, 2, 0.9863, 0.0034, 2, 0.19, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return GeometryColumns"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L291_C4", "label": "spatial_ref_sys", "type": "function", "loc": [291, 293], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "vector": [2, 1, 0.9966, 0.0102, 1, 0.31, 1.0, 318, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "spatial_ref_sys", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def spatial_ref_sys(self):\n from django.contrib.gis.db.backends.oracle.models import SpatialRefSys\n return SpatialRefSys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:ImportFrom_L292_C8", "label": "from django.contrib.gis.db.backends.oracle.models import SpatialRefSys", "type": "import", "loc": [292, 292], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L291_C4", "vector": [1, 2, 0.9966, 0.0034, 2, 0.49, 0.0, 705, 0, 1, 0, 0, 705, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.oracle.models", "arg_names": [], "import_names": ["SpatialRefSys"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.db.backends.oracle.models import SpatialRefSys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L293_C8", "label": "return", "type": "return", "loc": [293, 293], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L291_C4", "vector": [13, 2, 1.0, 0.0034, 2, 0.49, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return SpatialRefSys"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L139_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L140_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L144_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L140_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L145_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L140_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L146_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L146_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L148_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L146_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L149_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L146_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L150_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L150_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L151_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L150_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L152_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L140_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L155_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L140_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L156_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L140_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L157_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L140_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L159_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L161_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L162_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L163_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L162_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L165_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L167_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L173_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L175_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L175_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L182_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L182_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L183_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L175_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L175_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L185_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L185_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L186_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L186_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L187_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L186_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L189_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L185_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L191_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L175_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L195_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L195_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L196_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L175_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L200_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L200_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L201_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L200_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L206_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L206_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L207_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L200_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L209_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L209_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L210_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L200_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L212_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L212_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L213_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L213_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L214_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L213_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L216_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L212_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L219_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L212_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L221_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L221_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L222_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L221_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L224_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L226_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L226_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L227_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L226_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L226_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L231_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L226_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L234_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L226_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L235_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L235_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L238_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L238_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L241_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L238_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L242_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L238_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L245_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L238_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L247_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L238_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L251_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L238_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L254_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L254_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L257_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L254_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L260_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L238_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L265_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L235_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L266_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L268_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L272_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L272_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L273_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L272_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L272_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L278_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L272_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L279_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L279_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L280_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:If_L279_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L282_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L272_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L283_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L272_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L284_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L287_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L287_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:ImportFrom_L288_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L287_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L289_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L291_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L291_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:ImportFrom_L292_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:FunctionDef_L291_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Return_L293_C8"}] |
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.fields import GeometryField
output = super(OracleCreation, self).sql_indexes_for_field(model, f, style)
if isinstance(f, GeometryField):
gqn = self.connection.ops.geo_quote_name
qn = self.connection.ops.quote_name
db_table = model._meta.db_table
output.append(style.SQL_KEYWORD('INSERT INTO ') +
style.SQL_TABLE('USER_SDO_GEOM_METADATA') +
' (%s, %s, %s, %s)\n ' % tuple(map(qn, ['TABLE_NAME', 'COLUMN_NAME', 'DIMINFO', 'SRID'])) +
style.SQL_KEYWORD(' VALUES ') + '(\n ' +
style.SQL_TABLE(gqn(db_table)) + ',\n ' +
style.SQL_FIELD(gqn(f.column)) + ',\n ' +
style.SQL_KEYWORD("MDSYS.SDO_DIM_ARRAY") + '(\n ' +
style.SQL_KEYWORD("MDSYS.SDO_DIM_ELEMENT") +
("('LONG', %s, %s, %s),\n " % (f._extent[0], f._extent[2], f._tolerance)) +
style.SQL_KEYWORD("MDSYS.SDO_DIM_ELEMENT") +
("('LAT', %s, %s, %s)\n ),\n" % (f._extent[1], f._extent[3], f._tolerance)) +
' %s\n );' % f.srid)
if f.spatial_index:
# Getting the index name, Oracle doesn't allow object
# names > 30 characters.
idx_name = truncate_name('%s_%s_id' % (db_table, f.column), 30)
output.append(style.SQL_KEYWORD('CREATE INDEX ') +
style.SQL_TABLE(qn(idx_name)) +
style.SQL_KEYWORD(' ON ') +
style.SQL_TABLE(qn(db_table)) + '(' +
style.SQL_FIELD(qn(f.column)) + ') ' +
style.SQL_KEYWORD('INDEXTYPE IS ') +
style.SQL_TABLE('MDSYS.SPATIAL_INDEX') + ';')
return output
| ajibawa-2023/Python-Code-Large/train/row_98787 | 16 | 42 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98787:ImportFrom_L1_C0", "label": "from django.db.backends.oracle.creation import DatabaseCreation", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0238, 0.0238, 0, 0.66, 0.0, 513, 0, 1, 0, 0, 513, 0, 0], "semantic": {"name": "django.db.backends.oracle.creation", "arg_names": [], "import_names": ["DatabaseCreation"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.backends.oracle.creation import DatabaseCreation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98787:ImportFrom_L2_C0", "label": "from django.db.backends.util import truncate_name", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0476, 0.0238, 0, 0.66, 0.5, 446, 0, 1, 0, 0, 446, 0, 0], "semantic": {"name": "django.db.backends.util", "arg_names": [], "import_names": ["truncate_name"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.backends.util import truncate_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98787:ClassDef_L4_C0", "label": "OracleCreation", "type": "class", "loc": [4, 42], "level": 0, "parent": null, "vector": [3, 0, 0.5476, 0.9286, 0, 0.66, 1.0, 272, 0, 1, 0, 0, 625, 0, 28], "semantic": {"name": "OracleCreation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OracleCreation(DatabaseCreation):\n\n def sql_indexes_for_field(self, model, f, style):\n \"Return any spatial index creation SQL for the field.\"\n from django.contrib.gis.db.models.fields import GeometryField\n\n output = super(OracleCreation, self).sql_indexes_for_field(model, f, style)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98787:FunctionDef_L6_C4", "label": "sql_indexes_for_field", "type": "function", "loc": [6, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98787:ClassDef_L4_C0", "vector": [2, 1, 0.5714, 0.881, 1, 0.66, 0.0, 570, 0, 4, 1, 0, 0, 0, 28], "semantic": {"name": "sql_indexes_for_field", "arg_names": ["self", "model", "f", "style"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def sql_indexes_for_field(self, model, f, style):\n \"Return any spatial index creation SQL for the field.\"\n from django.contrib.gis.db.models.fields import GeometryField\n\n output = super(OracleCreation, self).sql_indexes_for_field(model, f, style)\n\n if isinstance(f, GeometryField):\n gqn = self.connection.ops.geo_quote_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98787:Expr_L7_C8", "label": "expression", "type": "expression", "loc": [7, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98787:FunctionDef_L6_C4", "vector": [8, 2, 0.1667, 0.0238, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Return any spatial index creation SQL for the field.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98787:ImportFrom_L8_C8", "label": "from django.contrib.gis.db.models.fields import GeometryField", "type": "import", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98787:FunctionDef_L6_C4", "vector": [1, 2, 0.1905, 0.0238, 2, 0.98, 0.25, 708, 0, 1, 0, 0, 708, 0, 0], "semantic": {"name": "django.contrib.gis.db.models.fields", "arg_names": [], "import_names": ["GeometryField"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.gis.db.models.fields import GeometryField"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98787:Assign_L10_C8", "label": "output = sql_indexes_for_field()", "type": "assigned_variable", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98787:FunctionDef_L6_C4", "vector": [14, 2, 0.2381, 0.0238, 2, 0.98, 0.5, 886, 3, 3, 0, 0, 570, 10, 2], "semantic": {"name": "output", "arg_names": [], "import_names": [], "rhs_call_name": "sql_indexes_for_field", "annotation": ""}, "snippet": " output = super(OracleCreation, self).sql_indexes_for_field(model, f, style)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98787:If_L12_C8", "label": "if", "type": "if", "loc": [12, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98787:FunctionDef_L6_C4", "vector": [4, 2, 0.631, 0.7143, 2, 0.98, 0.75, 0, 3, 0, 0, 0, 0, 0, 26], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(f, GeometryField):\n gqn = self.connection.ops.geo_quote_name\n qn = self.connection.ops.quote_name\n db_table = model._meta.db_table\n\n output.append(style.SQL_KEYWORD('INSERT INTO ') +\n style.SQL_TABLE('USER_SDO_GEOM_METADATA') +\n ' (%s, %s, %s, %s)\\n ' % tuple(map(qn, ['TABLE_NAME', 'COLUMN_NAME', 'DIMINFO', 'SRID'])) +"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98787:Assign_L13_C12", "label": "gqn =", "type": "assigned_variable", "loc": [13, 13], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98787:If_L12_C8", "vector": [14, 3, 0.3095, 0.0238, 3, 0.53, 0.0, 613, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "gqn", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " gqn = self.connection.ops.geo_quote_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98787:Assign_L14_C12", "label": "qn =", "type": "assigned_variable", "loc": [14, 14], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98787:If_L12_C8", "vector": [14, 3, 0.3333, 0.0238, 3, 0.53, 0.25, 514, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "qn", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " qn = self.connection.ops.quote_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98787:Assign_L15_C12", "label": "db_table =", "type": "assigned_variable", "loc": [15, 15], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98787:If_L12_C8", "vector": [14, 3, 0.3571, 0.0238, 3, 0.53, 0.5, 111, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "db_table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " db_table = model._meta.db_table"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98787:Expr_L17_C12", "label": "append()", "type": "expression", "loc": [17, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98787:If_L12_C8", "vector": [8, 3, 0.5357, 0.2857, 3, 0.53, 0.75, 243, 3, 1, 0, 0, 0, 0, 13], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " output.append(style.SQL_KEYWORD('INSERT INTO ') +\n style.SQL_TABLE('USER_SDO_GEOM_METADATA') +\n ' (%s, %s, %s, %s)\\n ' % tuple(map(qn, ['TABLE_NAME', 'COLUMN_NAME', 'DIMINFO', 'SRID'])) +\n style.SQL_KEYWORD(' VALUES ') + '(\\n ' +\n style.SQL_TABLE(gqn(db_table)) + ',\\n ' +\n style.SQL_FIELD(gqn(f.column)) + ',\\n ' +\n style.SQL_KEYWORD(\"MDSYS.SDO_DIM_ARRAY\") + '(\\n ' +\n style.SQL_KEYWORD(\"MDSYS.SDO_DIM_ELEMENT\") +"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98787:If_L30_C12", "label": "if", "type": "if", "loc": [30, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98787:If_L12_C8", "vector": [4, 3, 0.8452, 0.2857, 3, 0.53, 1.0, 0, 7, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if f.spatial_index:\n # Getting the index name, Oracle doesn't allow object\n # names > 30 characters.\n idx_name = truncate_name('%s_%s_id' % (db_table, f.column), 30)\n\n output.append(style.SQL_KEYWORD('CREATE INDEX ') +\n style.SQL_TABLE(qn(idx_name)) +\n style.SQL_KEYWORD(' ON ') +"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98787:Assign_L33_C16", "label": "idx_name = truncate_name()", "type": "assigned_variable", "loc": [33, 33], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98787:If_L30_C12", "vector": [14, 4, 0.7857, 0.0238, 4, 0.37, 0.0, 128, 3, 2, 0, 0, 927, 10, 1], "semantic": {"name": "idx_name", "arg_names": [], "import_names": [], "rhs_call_name": "truncate_name", "annotation": ""}, "snippet": " idx_name = truncate_name('%s_%s_id' % (db_table, f.column), 30)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98787:Expr_L35_C16", "label": "append()", "type": "expression", "loc": [35, 41], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98787:If_L30_C12", "vector": [8, 4, 0.9048, 0.1667, 4, 0.37, 1.0, 243, 3, 1, 0, 0, 0, 0, 11], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " output.append(style.SQL_KEYWORD('CREATE INDEX ') +\n style.SQL_TABLE(qn(idx_name)) +\n style.SQL_KEYWORD(' ON ') +\n style.SQL_TABLE(qn(db_table)) + '(' +\n style.SQL_FIELD(qn(f.column)) + ') ' +\n style.SQL_KEYWORD('INDEXTYPE IS ') +\n style.SQL_TABLE('MDSYS.SPATIAL_INDEX') + ';')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98787:Return_L42_C8", "label": "return", "type": "return", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98787:FunctionDef_L6_C4", "vector": [13, 2, 1.0, 0.0238, 2, 0.98, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return output"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98787:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98787:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98787:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98787:Expr_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98787:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98787:ImportFrom_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98787:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98787:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98787:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98787:If_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98787:If_L12_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98787:Assign_L13_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98787:If_L12_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98787:Assign_L14_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98787:If_L12_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98787:Assign_L15_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98787:If_L12_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98787:Expr_L17_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98787:If_L12_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98787:If_L30_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98787:If_L30_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98787:Assign_L33_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98787:If_L30_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98787:Expr_L35_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98787:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98787:Return_L42_C8"}] |
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.backends.oracle.operations import OracleOperations
class DatabaseWrapper(OracleDatabaseWrapper):
def __init__(self, *args, **kwargs):
super(DatabaseWrapper, self).__init__(*args, **kwargs)
self.ops = OracleOperations(self)
self.creation = OracleCreation(self)
self.introspection = OracleIntrospection(self)
| ajibawa-2023/Python-Code-Large/train/row_98788 | 11 | 12 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98788:ImportFrom_L1_C0", "label": "from django.db.backends.oracle.base import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0833, 0, 0.66, 0.0, 759, 0, 1, 0, 0, 759, 0, 0], "semantic": {"name": "django.db.backends.oracle.base", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.backends.oracle.base import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98788:ImportFrom_L2_C0", "label": "from django.db.backends.oracle.base import OracleDatabaseWrapper", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0833, 0, 0.66, 0.2, 759, 0, 1, 0, 0, 759, 0, 0], "semantic": {"name": "django.db.backends.oracle.base", "arg_names": [], "import_names": ["OracleDatabaseWrapper"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db.backends.oracle.base import DatabaseWrapper as OracleDatabaseWrapper"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98788:ImportFrom_L3_C0", "label": "from django.contrib.gis.db.backends.oracle.creation import OracleCreation", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.25, 0.0833, 0, 0.66, 0.4, 101, 0, 1, 0, 0, 101, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.oracle.creation", "arg_names": [], "import_names": ["OracleCreation"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.backends.oracle.creation import OracleCreation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98788:ImportFrom_L4_C0", "label": "from django.contrib.gis.db.backends.oracle.introspection import OracleIntrospection", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.0833, 0, 0.66, 0.6, 7, 0, 1, 0, 0, 7, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.oracle.introspection", "arg_names": [], "import_names": ["OracleIntrospection"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.backends.oracle.introspection import OracleIntrospection"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98788:ImportFrom_L5_C0", "label": "from django.contrib.gis.db.backends.oracle.operations import OracleOperations", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.4167, 0.0833, 0, 0.66, 0.8, 691, 0, 1, 0, 0, 691, 0, 0], "semantic": {"name": "django.contrib.gis.db.backends.oracle.operations", "arg_names": [], "import_names": ["OracleOperations"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.gis.db.backends.oracle.operations import OracleOperations"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98788:ClassDef_L7_C0", "label": "DatabaseWrapper", "type": "class", "loc": [7, 12], "level": 0, "parent": null, "vector": [3, 0, 0.7917, 0.5, 0, 0.66, 1.0, 386, 0, 1, 0, 0, 915, 0, 5], "semantic": {"name": "DatabaseWrapper", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DatabaseWrapper(OracleDatabaseWrapper):\n def __init__(self, *args, **kwargs):\n super(DatabaseWrapper, self).__init__(*args, **kwargs)\n self.ops = OracleOperations(self)\n self.creation = OracleCreation(self)\n self.introspection = OracleIntrospection(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98788:FunctionDef_L8_C4", "label": "__init__", "type": "function", "loc": [8, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98788:ClassDef_L7_C0", "vector": [2, 1, 0.8333, 0.4167, 1, 0.6, 0.0, 555, 0, 3, 0, 0, 0, 0, 5], "semantic": {"name": "__init__", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, *args, **kwargs):\n super(DatabaseWrapper, self).__init__(*args, **kwargs)\n self.ops = OracleOperations(self)\n self.creation = OracleCreation(self)\n self.introspection = OracleIntrospection(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98788:Expr_L9_C8", "label": "__init__()", "type": "expression", "loc": [9, 9], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98788:FunctionDef_L8_C4", "vector": [8, 2, 0.75, 0.0833, 2, 0.71, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(DatabaseWrapper, self).__init__(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98788:Assign_L10_C8", "label": "self.ops = OracleOperations()", "type": "assigned_variable", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98788:FunctionDef_L8_C4", "vector": [14, 2, 0.8333, 0.0833, 2, 0.71, 0.3333, 589, 3, 1, 0, 0, 397, 10, 1], "semantic": {"name": "self.ops", "arg_names": [], "import_names": [], "rhs_call_name": "OracleOperations", "annotation": ""}, "snippet": " self.ops = OracleOperations(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98788:Assign_L11_C8", "label": "self.creation = OracleCreation()", "type": "assigned_variable", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98788:FunctionDef_L8_C4", "vector": [14, 2, 0.9167, 0.0833, 2, 0.71, 0.6667, 748, 3, 1, 0, 0, 272, 10, 1], "semantic": {"name": "self.creation", "arg_names": [], "import_names": [], "rhs_call_name": "OracleCreation", "annotation": ""}, "snippet": " self.creation = OracleCreation(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98788:Assign_L12_C8", "label": "self.introspection = OracleIntrospection()", "type": "assigned_variable", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98788:FunctionDef_L8_C4", "vector": [14, 2, 1.0, 0.0833, 2, 0.71, 1.0, 217, 3, 1, 0, 0, 773, 10, 1], "semantic": {"name": "self.introspection", "arg_names": [], "import_names": [], "rhs_call_name": "OracleIntrospection", "annotation": ""}, "snippet": " self.introspection = OracleIntrospection(self)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98788:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98788:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98788:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98788:Expr_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98788:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98788:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98788:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98788:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98788:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98788:Assign_L12_C8"}] |
"""
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
http://www.freewisdom.org/projects/python-markdown
* reStructuredText, which requires docutils from http://docutils.sf.net/
"""
from django import template
from django.conf import settings
from django.utils.encoding import smart_str, force_unicode
from django.utils.safestring import mark_safe
register = template.Library()
def textile(value):
try:
import textile
except ImportError:
if settings.DEBUG:
raise template.TemplateSyntaxError("Error in {% textile %} filter: The Python textile library isn't installed.")
return force_unicode(value)
else:
return mark_safe(force_unicode(textile.textile(smart_str(value), encoding='utf-8', output='utf-8')))
textile.is_safe = True
def markdown(value, arg=''):
"""
Runs Markdown over a given value, optionally using various
extensions python-markdown supports.
Syntax::
{{ value|markdown:"extension1_name,extension2_name..." }}
To enable safe mode, which strips raw HTML and only returns HTML
generated by actual Markdown syntax, pass "safe" as the first
extension in the list.
If the version of Markdown in use does not support extensions,
they will be silently ignored.
"""
try:
import markdown
except ImportError:
if settings.DEBUG:
raise template.TemplateSyntaxError("Error in {% markdown %} filter: The Python markdown library isn't installed.")
return force_unicode(value)
else:
# markdown.version was first added in 1.6b. The only version of markdown
# to fully support extensions before 1.6b was the shortlived 1.6a.
if hasattr(markdown, 'version'):
extensions = [e for e in arg.split(",") if e]
if len(extensions) > 0 and extensions[0] == "safe":
extensions = extensions[1:]
safe_mode = True
else:
safe_mode = False
# Unicode support only in markdown v1.7 or above. Version_info
# exist only in markdown v1.6.2rc-2 or above.
if getattr(markdown, "version_info", None) < (1,7):
return mark_safe(force_unicode(markdown.markdown(smart_str(value), extensions, safe_mode=safe_mode)))
else:
return mark_safe(markdown.markdown(force_unicode(value), extensions, safe_mode=safe_mode))
else:
return mark_safe(force_unicode(markdown.markdown(smart_str(value))))
markdown.is_safe = True
def restructuredtext(value):
try:
from docutils.core import publish_parts
except ImportError:
if settings.DEBUG:
raise template.TemplateSyntaxError("Error in {% restructuredtext %} filter: The Python docutils library isn't installed.")
return force_unicode(value)
else:
docutils_settings = getattr(settings, "RESTRUCTUREDTEXT_FILTER_SETTINGS", {})
parts = publish_parts(source=smart_str(value), writer_name="html4css1", settings_overrides=docutils_settings)
return mark_safe(force_unicode(parts["fragment"]))
restructuredtext.is_safe = True
register.filter(textile)
register.filter(markdown)
register.filter(restructuredtext)
| ajibawa-2023/Python-Code-Large/train/row_98790 | 42 | 91 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 12], "level": 0, "parent": null, "vector": [8, 0, 0.0714, 0.1319, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nSet of \"markup\" template filters for Django. These filters transform plain text\nmarkup syntaxes to HTML; currently there is support for:\n\n * Textile, which requires the PyTextile library available at\n http://loopcore.com/python-textile/\n\n * Markdown, which requires the Python-markdown library from"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:ImportFrom_L14_C0", "label": "from django import template", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1538, 0.011, 0, 0.66, 0.0714, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["template"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django import template"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:ImportFrom_L15_C0", "label": "from django.conf import settings", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.1648, 0.011, 0, 0.66, 0.1429, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:ImportFrom_L16_C0", "label": "from django.utils.encoding import smart_str, force_unicode", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.1758, 0.011, 0, 0.66, 0.2143, 96, 0, 2, 0, 0, 96, 0, 0], "semantic": {"name": "django.utils.encoding", "arg_names": [], "import_names": ["smart_str", "force_unicode"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.encoding import smart_str, force_unicode"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:ImportFrom_L17_C0", "label": "from django.utils.safestring import mark_safe", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.1868, 0.011, 0, 0.66, 0.2857, 375, 0, 1, 0, 0, 375, 0, 0], "semantic": {"name": "django.utils.safestring", "arg_names": [], "import_names": ["mark_safe"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.safestring import mark_safe"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Assign_L19_C0", "label": "register = Library()", "type": "assigned_variable", "loc": [19, 19], "level": 0, "parent": null, "vector": [14, 0, 0.2088, 0.011, 0, 0.66, 0.3571, 276, 3, 0, 0, 0, 77, 10, 1], "semantic": {"name": "register", "arg_names": [], "import_names": [], "rhs_call_name": "Library", "annotation": ""}, "snippet": "register = template.Library()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:FunctionDef_L21_C0", "label": "textile", "type": "function", "loc": [21, 29], "level": 0, "parent": null, "vector": [2, 0, 0.2747, 0.0989, 0, 0.66, 0.4286, 155, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "textile", "arg_names": ["value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def textile(value):\n try:\n import textile\n except ImportError:\n if settings.DEBUG:\n raise template.TemplateSyntaxError(\"Error in {% textile %} filter: The Python textile library isn't installed.\")\n return force_unicode(value)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L22_C4", "label": "try", "type": "try", "loc": [22, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:FunctionDef_L21_C0", "vector": [7, 1, 0.2802, 0.0879, 1, 0.64, 0.0, 0, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n import textile\n except ImportError:\n if settings.DEBUG:\n raise template.TemplateSyntaxError(\"Error in {% textile %} filter: The Python textile library isn't installed.\")\n return force_unicode(value)\n else:\n return mark_safe(force_unicode(textile.textile(smart_str(value), encoding='utf-8', output='utf-8')))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Import_L23_C8", "label": "textile import textile", "type": "import", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L22_C4", "vector": [1, 2, 0.2527, 0.011, 2, 0.57, 0.0, 155, 0, 1, 0, 0, 155, 0, 0], "semantic": {"name": "textile", "arg_names": [], "import_names": ["textile"], "rhs_call_name": "", "annotation": ""}, "snippet": " import textile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L25_C8", "label": "if", "type": "if", "loc": [25, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L22_C4", "vector": [4, 2, 0.2802, 0.022, 2, 0.57, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if settings.DEBUG:\n raise template.TemplateSyntaxError(\"Error in {% textile %} filter: The Python textile library isn't installed.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Return_L27_C8", "label": "return", "type": "return", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L22_C4", "vector": [13, 2, 0.2967, 0.011, 2, 0.57, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return force_unicode(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Return_L29_C8", "label": "return", "type": "return", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L22_C4", "vector": [13, 2, 0.3187, 0.011, 2, 0.57, 1.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return mark_safe(force_unicode(textile.textile(smart_str(value), encoding='utf-8', output='utf-8')))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Assign_L30_C0", "label": "textile.is_safe =", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.3297, 0.011, 0, 0.66, 0.5, 388, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "textile.is_safe", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "textile.is_safe = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:FunctionDef_L32_C0", "label": "markdown", "type": "function", "loc": [32, 73], "level": 0, "parent": null, "vector": [2, 0, 0.5769, 0.4615, 0, 0.66, 0.5714, 31, 0, 2, 1, 0, 0, 0, 17], "semantic": {"name": "markdown", "arg_names": ["value", "arg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def markdown(value, arg=''):\n \"\"\"\n Runs Markdown over a given value, optionally using various\n extensions python-markdown supports.\n\n Syntax::\n\n {{ value|markdown:\"extension1_name,extension2_name...\" }}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Expr_L33_C4", "label": "expression", "type": "expression", "loc": [33, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:FunctionDef_L32_C0", "vector": [8, 1, 0.4451, 0.1758, 1, 0.81, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Runs Markdown over a given value, optionally using various\n extensions python-markdown supports.\n\n Syntax::\n\n {{ value|markdown:\"extension1_name,extension2_name...\" }}\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L49_C4", "label": "try", "type": "try", "loc": [49, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:FunctionDef_L32_C0", "vector": [7, 1, 0.6703, 0.2747, 1, 0.81, 1.0, 0, 0, 1, 0, 0, 0, 0, 17], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n import markdown\n except ImportError:\n if settings.DEBUG:\n raise template.TemplateSyntaxError(\"Error in {% markdown %} filter: The Python markdown library isn't installed.\")\n return force_unicode(value)\n else:\n # markdown.version was first added in 1.6b. The only version of markdown"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Import_L50_C8", "label": "markdown import markdown", "type": "import", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L49_C4", "vector": [1, 2, 0.5495, 0.011, 2, 0.46, 0.0, 31, 0, 1, 0, 0, 31, 0, 0], "semantic": {"name": "markdown", "arg_names": [], "import_names": ["markdown"], "rhs_call_name": "", "annotation": ""}, "snippet": " import markdown"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L52_C8", "label": "if", "type": "if", "loc": [52, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L49_C4", "vector": [4, 2, 0.5769, 0.022, 2, 0.46, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if settings.DEBUG:\n raise template.TemplateSyntaxError(\"Error in {% markdown %} filter: The Python markdown library isn't installed.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Return_L54_C8", "label": "return", "type": "return", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L49_C4", "vector": [13, 2, 0.5934, 0.011, 2, 0.46, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return force_unicode(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L58_C8", "label": "if", "type": "if", "loc": [58, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L49_C4", "vector": [4, 2, 0.7198, 0.1758, 2, 0.46, 1.0, 0, 3, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(markdown, 'version'):\n extensions = [e for e in arg.split(\",\") if e]\n if len(extensions) > 0 and extensions[0] == \"safe\":\n extensions = extensions[1:]\n safe_mode = True\n else:\n safe_mode = False\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Assign_L59_C12", "label": "extensions =", "type": "assigned_variable", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L58_C8", "vector": [14, 3, 0.6484, 0.011, 3, 0.29, 0.0, 866, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "extensions", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " extensions = [e for e in arg.split(\",\") if e]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L60_C12", "label": "if", "type": "if", "loc": [60, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L58_C8", "vector": [4, 3, 0.6813, 0.0549, 3, 0.29, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(extensions) > 0 and extensions[0] == \"safe\":\n extensions = extensions[1:]\n safe_mode = True\n else:\n safe_mode = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Assign_L61_C16", "label": "extensions =", "type": "assigned_variable", "loc": [61, 61], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L60_C12", "vector": [14, 4, 0.6703, 0.011, 4, 0.85, 0.0, 866, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "extensions", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " extensions = extensions[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Assign_L62_C16", "label": "safe_mode =", "type": "assigned_variable", "loc": [62, 62], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L60_C12", "vector": [14, 4, 0.6813, 0.011, 4, 0.85, 0.5, 206, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "safe_mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " safe_mode = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Assign_L64_C16", "label": "safe_mode =", "type": "assigned_variable", "loc": [64, 64], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L60_C12", "vector": [14, 4, 0.7033, 0.011, 4, 0.85, 1.0, 206, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "safe_mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " safe_mode = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L68_C12", "label": "if", "type": "if", "loc": [68, 71], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L58_C8", "vector": [4, 3, 0.7637, 0.044, 3, 0.29, 0.6667, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if getattr(markdown, \"version_info\", None) < (1,7):\n return mark_safe(force_unicode(markdown.markdown(smart_str(value), extensions, safe_mode=safe_mode)))\n else:\n return mark_safe(markdown.markdown(force_unicode(value), extensions, safe_mode=safe_mode))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Return_L69_C16", "label": "return", "type": "return", "loc": [69, 69], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L68_C12", "vector": [13, 4, 0.7582, 0.011, 4, 0.84, 0.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return mark_safe(force_unicode(markdown.markdown(smart_str(value), extensions, safe_mode=safe_mode)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Return_L71_C16", "label": "return", "type": "return", "loc": [71, 71], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L68_C12", "vector": [13, 4, 0.7802, 0.011, 4, 0.84, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return mark_safe(markdown.markdown(force_unicode(value), extensions, safe_mode=safe_mode))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Return_L73_C12", "label": "return", "type": "return", "loc": [73, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L58_C8", "vector": [13, 3, 0.8022, 0.011, 3, 0.29, 1.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return mark_safe(force_unicode(markdown.markdown(smart_str(value))))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Assign_L74_C0", "label": "markdown.is_safe =", "type": "assigned_variable", "loc": [74, 74], "level": 0, "parent": null, "vector": [14, 0, 0.8132, 0.011, 0, 0.66, 0.6429, 809, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "markdown.is_safe", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "markdown.is_safe = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:FunctionDef_L76_C0", "label": "restructuredtext", "type": "function", "loc": [76, 86], "level": 0, "parent": null, "vector": [2, 0, 0.8901, 0.1209, 0, 0.66, 0.7143, 865, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "restructuredtext", "arg_names": ["value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def restructuredtext(value):\n try:\n from docutils.core import publish_parts\n except ImportError:\n if settings.DEBUG:\n raise template.TemplateSyntaxError(\"Error in {% restructuredtext %} filter: The Python docutils library isn't installed.\")\n return force_unicode(value)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L77_C4", "label": "try", "type": "try", "loc": [77, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:FunctionDef_L76_C0", "vector": [7, 1, 0.8956, 0.1099, 1, 0.75, 0.0, 0, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n from docutils.core import publish_parts\n except ImportError:\n if settings.DEBUG:\n raise template.TemplateSyntaxError(\"Error in {% restructuredtext %} filter: The Python docutils library isn't installed.\")\n return force_unicode(value)\n else:\n docutils_settings = getattr(settings, \"RESTRUCTUREDTEXT_FILTER_SETTINGS\", {})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:ImportFrom_L78_C8", "label": "from docutils.core import publish_parts", "type": "import", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L77_C4", "vector": [1, 2, 0.8571, 0.011, 2, 0.87, 0.0, 219, 0, 1, 0, 0, 219, 0, 0], "semantic": {"name": "docutils.core", "arg_names": [], "import_names": ["publish_parts"], "rhs_call_name": "", "annotation": ""}, "snippet": " from docutils.core import publish_parts"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L80_C8", "label": "if", "type": "if", "loc": [80, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L77_C4", "vector": [4, 2, 0.8846, 0.022, 2, 0.87, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if settings.DEBUG:\n raise template.TemplateSyntaxError(\"Error in {% restructuredtext %} filter: The Python docutils library isn't installed.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Return_L82_C8", "label": "return", "type": "return", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L77_C4", "vector": [13, 2, 0.9011, 0.011, 2, 0.87, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return force_unicode(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Assign_L84_C8", "label": "docutils_settings = getattr()", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L77_C4", "vector": [14, 2, 0.9231, 0.011, 2, 0.87, 0.3333, 30, 3, 3, 0, 0, 121, 10, 1], "semantic": {"name": "docutils_settings", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " docutils_settings = getattr(settings, \"RESTRUCTUREDTEXT_FILTER_SETTINGS\", {})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Assign_L85_C8", "label": "parts = publish_parts()", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L77_C4", "vector": [14, 2, 0.9341, 0.011, 2, 0.87, 0.6667, 13, 3, 3, 0, 0, 559, 10, 2], "semantic": {"name": "parts", "arg_names": [], "import_names": [], "rhs_call_name": "publish_parts", "annotation": ""}, "snippet": " parts = publish_parts(source=smart_str(value), writer_name=\"html4css1\", settings_overrides=docutils_settings)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Return_L86_C8", "label": "return", "type": "return", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L77_C4", "vector": [13, 2, 0.9451, 0.011, 2, 0.87, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return mark_safe(force_unicode(parts[\"fragment\"]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Assign_L87_C0", "label": "restructuredtext.is_safe =", "type": "assigned_variable", "loc": [87, 87], "level": 0, "parent": null, "vector": [14, 0, 0.956, 0.011, 0, 0.66, 0.7857, 332, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "restructuredtext.is_safe", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "restructuredtext.is_safe = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Expr_L89_C0", "label": "filter()", "type": "expression", "loc": [89, 89], "level": 0, "parent": null, "vector": [8, 0, 0.978, 0.011, 0, 0.66, 0.8571, 526, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "filter", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": "register.filter(textile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Expr_L90_C0", "label": "filter()", "type": "expression", "loc": [90, 90], "level": 0, "parent": null, "vector": [8, 0, 0.989, 0.011, 0, 0.66, 0.9286, 526, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "filter", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": "register.filter(markdown)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98790:Expr_L91_C0", "label": "filter()", "type": "expression", "loc": [91, 91], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.011, 0, 0.66, 1.0, 526, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "filter", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": "register.filter(restructuredtext)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98790:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:Import_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:Return_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:Return_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:Expr_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:Import_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:Return_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:Assign_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L60_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L60_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:Assign_L61_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L60_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:Assign_L62_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L60_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:Assign_L64_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L68_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L68_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:Return_L69_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L68_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:Return_L71_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:Return_L73_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:FunctionDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:ImportFrom_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:If_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:Return_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:Assign_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:Return_L86_C8"}] |
import base64
import cPickle as pickle
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from django.utils.hashcompat import md5_constructor
class SessionManager(models.Manager):
def encode(self, session_dict):
"""
Returns the given session dictionary pickled and encoded as a string.
"""
pickled = pickle.dumps(session_dict)
pickled_md5 = md5_constructor(pickled + settings.SECRET_KEY).hexdigest()
return base64.encodestring(pickled + pickled_md5)
def save(self, session_key, session_dict, expire_date):
s = self.model(session_key, self.encode(session_dict), expire_date)
if session_dict:
s.save()
else:
s.delete() # Clear sessions with no data.
return s
class Session(models.Model):
"""
Django provides full support for anonymous sessions. The session
framework lets you store and retrieve arbitrary data on a
per-site-visitor basis. It stores data on the server side and
abstracts the sending and receiving of cookies. Cookies contain a
session ID -- not the data itself.
The Django sessions framework is entirely cookie-based. It does
not fall back to putting session IDs in URLs. This is an intentional
design decision. Not only does that behavior make URLs ugly, it makes
your site vulnerable to session-ID theft via the "Referer" header.
For complete documentation on using Sessions in your code, consult
the sessions documentation that is shipped with Django (also available
on the Django Web site).
"""
session_key = models.CharField(_('session key'), max_length=40,
primary_key=True)
session_data = models.TextField(_('session data'))
expire_date = models.DateTimeField(_('expire date'), db_index=True)
objects = SessionManager()
class Meta:
db_table = 'django_session'
verbose_name = _('session')
verbose_name_plural = _('sessions')
def get_decoded(self):
encoded_data = base64.decodestring(self.session_data)
pickled, tamper_check = encoded_data[:-32], encoded_data[-32:]
if md5_constructor(pickled + settings.SECRET_KEY).hexdigest() != tamper_check:
from django.core.exceptions import SuspiciousOperation
raise SuspiciousOperation("User tampered with session cookie.")
try:
return pickle.loads(pickled)
# Unpickling can cause a variety of exceptions. If something happens,
# just return an empty dictionary (an empty session).
except:
return {}
| ajibawa-2023/Python-Code-Large/train/row_98791 | 36 | 67 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98791:Import_L1_C0", "label": "base64 import base64", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0149, 0.0149, 0, 0.66, 0.0, 177, 0, 1, 0, 0, 177, 0, 0], "semantic": {"name": "base64", "arg_names": [], "import_names": ["base64"], "rhs_call_name": "", "annotation": ""}, "snippet": "import base64"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:Import_L2_C0", "label": "cPickle import pickle", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0299, 0.0149, 0, 0.66, 0.1429, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "cPickle", "arg_names": [], "import_names": ["pickle"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cPickle as pickle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:ImportFrom_L4_C0", "label": "from django.db import models", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0597, 0.0149, 0, 0.66, 0.2857, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["models"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db import models"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:ImportFrom_L5_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0746, 0.0149, 0, 0.66, 0.4286, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names": [], "import_names": ["_"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.translation import ugettext_lazy as _"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:ImportFrom_L6_C0", "label": "from django.conf import settings", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0896, 0.0149, 0, 0.66, 0.5714, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:ImportFrom_L7_C0", "label": "from django.utils.hashcompat import md5_constructor", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1045, 0.0149, 0, 0.66, 0.7143, 474, 0, 1, 0, 0, 474, 0, 0], "semantic": {"name": "django.utils.hashcompat", "arg_names": [], "import_names": ["md5_constructor"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.hashcompat import md5_constructor"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L10_C0", "label": "SessionManager", "type": "class", "loc": [10, 25], "level": 0, "parent": null, "vector": [3, 0, 0.2612, 0.2388, 0, 0.66, 0.8571, 158, 0, 2, 0, 0, 948, 0, 8], "semantic": {"name": "SessionManager", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SessionManager(models.Manager):\n def encode(self, session_dict):\n \"\"\"\n Returns the given session dictionary pickled and encoded as a string.\n \"\"\"\n pickled = pickle.dumps(session_dict)\n pickled_md5 = md5_constructor(pickled + settings.SECRET_KEY).hexdigest()\n return base64.encodestring(pickled + pickled_md5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L11_C4", "label": "encode", "type": "function", "loc": [11, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L10_C0", "vector": [2, 1, 0.209, 0.1045, 1, 0.09, 0.0, 623, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "encode", "arg_names": ["self", "session_dict"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def encode(self, session_dict):\n \"\"\"\n Returns the given session dictionary pickled and encoded as a string.\n \"\"\"\n pickled = pickle.dumps(session_dict)\n pickled_md5 = md5_constructor(pickled + settings.SECRET_KEY).hexdigest()\n return base64.encodestring(pickled + pickled_md5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:Expr_L12_C8", "label": "expression", "type": "expression", "loc": [12, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L11_C4", "vector": [8, 2, 0.194, 0.0448, 2, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the given session dictionary pickled and encoded as a string.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:Assign_L15_C8", "label": "pickled = dumps()", "type": "assigned_variable", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L11_C4", "vector": [14, 2, 0.2239, 0.0149, 2, 0.66, 0.3333, 271, 3, 1, 0, 0, 160, 10, 1], "semantic": {"name": "pickled", "arg_names": [], "import_names": [], "rhs_call_name": "dumps", "annotation": ""}, "snippet": " pickled = pickle.dumps(session_dict)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:Assign_L16_C8", "label": "pickled_md5 = hexdigest()", "type": "assigned_variable", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L11_C4", "vector": [14, 2, 0.2388, 0.0149, 2, 0.66, 0.6667, 633, 3, 0, 0, 0, 89, 10, 2], "semantic": {"name": "pickled_md5", "arg_names": [], "import_names": [], "rhs_call_name": "hexdigest", "annotation": ""}, "snippet": " pickled_md5 = md5_constructor(pickled + settings.SECRET_KEY).hexdigest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:Return_L17_C8", "label": "return", "type": "return", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L11_C4", "vector": [13, 2, 0.2537, 0.0149, 2, 0.66, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return base64.encodestring(pickled + pickled_md5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L19_C4", "label": "save", "type": "function", "loc": [19, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L10_C0", "vector": [2, 1, 0.3284, 0.1045, 1, 0.09, 1.0, 928, 0, 4, 1, 0, 0, 0, 4], "semantic": {"name": "save", "arg_names": ["self", "session_key", "session_dict", "expire_date"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def save(self, session_key, session_dict, expire_date):\n s = self.model(session_key, self.encode(session_dict), expire_date)\n if session_dict:\n s.save()\n else:\n s.delete() # Clear sessions with no data.\n return s"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:Assign_L20_C8", "label": "s = model()", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L19_C4", "vector": [14, 2, 0.2985, 0.0149, 2, 0.12, 0.0, 553, 3, 3, 0, 0, 722, 10, 2], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "model", "annotation": ""}, "snippet": " s = self.model(session_key, self.encode(session_dict), expire_date)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:If_L21_C8", "label": "if", "type": "if", "loc": [21, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L19_C4", "vector": [4, 2, 0.3358, 0.0597, 2, 0.12, 0.5, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if session_dict:\n s.save()\n else:\n s.delete() # Clear sessions with no data."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:Expr_L22_C12", "label": "save()", "type": "expression", "loc": [22, 22], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:If_L21_C8", "vector": [8, 3, 0.3284, 0.0149, 3, 0.4, 0.0, 928, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " s.save()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:Expr_L24_C12", "label": "delete()", "type": "expression", "loc": [24, 24], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:If_L21_C8", "vector": [8, 3, 0.3582, 0.0149, 3, 0.4, 1.0, 266, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " s.delete() # Clear sessions with no data."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:Return_L25_C8", "label": "return", "type": "return", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L19_C4", "vector": [13, 2, 0.3731, 0.0149, 2, 0.12, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return s"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L28_C0", "label": "Session", "type": "class", "loc": [28, 67], "level": 0, "parent": null, "vector": [3, 0, 0.709, 0.597, 0, 0.66, 1.0, 712, 0, 1, 0, 0, 996, 0, 14], "semantic": {"name": "Session", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Session(models.Model):\n \"\"\"\n Django provides full support for anonymous sessions. The session\n framework lets you store and retrieve arbitrary data on a\n per-site-visitor basis. It stores data on the server side and\n abstracts the sending and receiving of cookies. Cookies contain a\n session ID -- not the data itself.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:Expr_L29_C4", "label": "expression", "type": "expression", "loc": [29, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L28_C0", "vector": [8, 1, 0.5448, 0.2388, 1, 0.52, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Django provides full support for anonymous sessions. The session\n framework lets you store and retrieve arbitrary data on a\n per-site-visitor basis. It stores data on the server side and\n abstracts the sending and receiving of cookies. Cookies contain a\n session ID -- not the data itself.\n\n The Django sessions framework is entirely cookie-based. It does"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:Assign_L45_C4", "label": "session_key = CharField()", "type": "assigned_variable", "loc": [45, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L28_C0", "vector": [14, 1, 0.6791, 0.0299, 1, 0.52, 0.1667, 555, 3, 3, 0, 0, 952, 10, 2], "semantic": {"name": "session_key", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " session_key = models.CharField(_('session key'), max_length=40,\n primary_key=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:Assign_L47_C4", "label": "session_data = TextField()", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L28_C0", "vector": [14, 1, 0.7015, 0.0149, 1, 0.52, 0.3333, 19, 3, 1, 0, 0, 612, 10, 2], "semantic": {"name": "session_data", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " session_data = models.TextField(_('session data'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:Assign_L48_C4", "label": "expire_date = DateTimeField()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L28_C0", "vector": [14, 1, 0.7164, 0.0149, 1, 0.52, 0.5, 747, 3, 2, 0, 0, 789, 10, 2], "semantic": {"name": "expire_date", "arg_names": [], "import_names": [], "rhs_call_name": "DateTimeField", "annotation": ""}, "snippet": " expire_date = models.DateTimeField(_('expire date'), db_index=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:Assign_L49_C4", "label": "objects = SessionManager()", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L28_C0", "vector": [14, 1, 0.7313, 0.0149, 1, 0.52, 0.6667, 550, 3, 0, 0, 0, 158, 10, 1], "semantic": {"name": "objects", "arg_names": [], "import_names": [], "rhs_call_name": "SessionManager", "annotation": ""}, "snippet": " objects = SessionManager()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L51_C4", "label": "Meta", "type": "class", "loc": [51, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L28_C0", "vector": [3, 1, 0.7836, 0.0597, 1, 0.52, 0.8333, 130, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta:\n db_table = 'django_session'\n verbose_name = _('session')\n verbose_name_plural = _('sessions')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:Assign_L52_C8", "label": "db_table =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L51_C4", "vector": [14, 2, 0.7761, 0.0149, 2, 0.53, 0.0, 111, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "db_table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " db_table = 'django_session'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:Assign_L53_C8", "label": "verbose_name = _()", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L51_C4", "vector": [14, 2, 0.791, 0.0149, 2, 0.53, 0.5, 616, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "verbose_name", "arg_names": [], "import_names": [], "rhs_call_name": "_", "annotation": ""}, "snippet": " verbose_name = _('session')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:Assign_L54_C8", "label": "verbose_name_plural = _()", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L51_C4", "vector": [14, 2, 0.806, 0.0149, 2, 0.53, 1.0, 329, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "verbose_name_plural", "arg_names": [], "import_names": [], "rhs_call_name": "_", "annotation": ""}, "snippet": " verbose_name_plural = _('sessions')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L56_C4", "label": "get_decoded", "type": "function", "loc": [56, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L28_C0", "vector": [2, 1, 0.9179, 0.1791, 1, 0.52, 1.0, 878, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "get_decoded", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_decoded(self):\n encoded_data = base64.decodestring(self.session_data)\n pickled, tamper_check = encoded_data[:-32], encoded_data[-32:]\n if md5_constructor(pickled + settings.SECRET_KEY).hexdigest() != tamper_check:\n from django.core.exceptions import SuspiciousOperation\n raise SuspiciousOperation(\"User tampered with session cookie.\")\n try:\n return pickle.loads(pickled)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:Assign_L57_C8", "label": "encoded_data = decodestring()", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L56_C4", "vector": [14, 2, 0.8507, 0.0149, 2, 0.65, 0.0, 185, 3, 1, 0, 0, 480, 10, 1], "semantic": {"name": "encoded_data", "arg_names": [], "import_names": [], "rhs_call_name": "decodestring", "annotation": ""}, "snippet": " encoded_data = base64.decodestring(self.session_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:Assign_L58_C8", "label": "pickled, tamper_check =", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L56_C4", "vector": [14, 2, 0.8657, 0.0149, 2, 0.65, 0.3333, 552, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "pickled, tamper_check", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pickled, tamper_check = encoded_data[:-32], encoded_data[-32:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:If_L59_C8", "label": "if", "type": "if", "loc": [59, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L56_C4", "vector": [4, 2, 0.8955, 0.0448, 2, 0.65, 0.6667, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if md5_constructor(pickled + settings.SECRET_KEY).hexdigest() != tamper_check:\n from django.core.exceptions import SuspiciousOperation\n raise SuspiciousOperation(\"User tampered with session cookie.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:ImportFrom_L60_C12", "label": "from django.core.exceptions import SuspiciousOperation", "type": "import", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:If_L59_C8", "vector": [1, 3, 0.8955, 0.0149, 3, 0.41, 0.0, 160, 0, 1, 0, 0, 160, 0, 0], "semantic": {"name": "django.core.exceptions", "arg_names": [], "import_names": ["SuspiciousOperation"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.core.exceptions import SuspiciousOperation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:Try_L62_C8", "label": "try", "type": "try", "loc": [62, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L56_C4", "vector": [7, 2, 0.9627, 0.0896, 2, 0.65, 1.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return pickle.loads(pickled)\n # Unpickling can cause a variety of exceptions. If something happens,\n # just return an empty dictionary (an empty session).\n except:\n return {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:Return_L63_C12", "label": "return", "type": "return", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:Try_L62_C8", "vector": [13, 3, 0.9403, 0.0149, 3, 0.2, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return pickle.loads(pickled)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98791:Return_L67_C12", "label": "return", "type": "return", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98791:Try_L62_C8", "vector": [13, 3, 1.0, 0.0149, 3, 0.2, 0.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {}"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:Assign_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:Return_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:If_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:If_L21_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:Expr_L22_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:If_L21_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:Expr_L24_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:Return_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:Expr_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:Assign_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:Assign_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:ClassDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:Assign_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:If_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:If_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:ImportFrom_L60_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:Try_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:Try_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:Return_L63_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:Try_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:Return_L67_C12"}] |
import base64
from datetime import datetime, timedelta
import pickle
import shutil
import tempfile
from django.conf import settings
from django.contrib.sessions.backends.db import SessionStore as DatabaseSession
from django.contrib.sessions.backends.cache import SessionStore as CacheSession
from django.contrib.sessions.backends.cached_db import SessionStore as CacheDBSession
from django.contrib.sessions.backends.file import SessionStore as FileSession
from django.contrib.sessions.backends.base import SessionBase
from django.contrib.sessions.models import Session
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from django.utils import unittest
from django.utils.hashcompat import md5_constructor
class SessionTestsMixin(object):
# This does not inherit from TestCase to avoid any tests being run with this
# class, which wouldn't work, and to allow different TestCase subclasses to
# be used.
backend = None # subclasses must specify
def setUp(self):
self.session = self.backend()
def tearDown(self):
# NB: be careful to delete any sessions created; stale sessions fill up
# the /tmp (with some backends) and eventually overwhelm it after lots
# of runs (think buildbots)
self.session.delete()
def test_new_session(self):
self.assertFalse(self.session.modified)
self.assertFalse(self.session.accessed)
def test_get_empty(self):
self.assertEqual(self.session.get('cat'), None)
def test_store(self):
self.session['cat'] = "dog"
self.assertTrue(self.session.modified)
self.assertEqual(self.session.pop('cat'), 'dog')
def test_pop(self):
self.session['some key'] = 'exists'
# Need to reset these to pretend we haven't accessed it:
self.accessed = False
self.modified = False
self.assertEqual(self.session.pop('some key'), 'exists')
self.assertTrue(self.session.accessed)
self.assertTrue(self.session.modified)
self.assertEqual(self.session.get('some key'), None)
def test_pop_default(self):
self.assertEqual(self.session.pop('some key', 'does not exist'),
'does not exist')
self.assertTrue(self.session.accessed)
self.assertFalse(self.session.modified)
def test_setdefault(self):
self.assertEqual(self.session.setdefault('foo', 'bar'), 'bar')
self.assertEqual(self.session.setdefault('foo', 'baz'), 'bar')
self.assertTrue(self.session.accessed)
self.assertTrue(self.session.modified)
def test_update(self):
self.session.update({'update key': 1})
self.assertTrue(self.session.accessed)
self.assertTrue(self.session.modified)
self.assertEqual(self.session.get('update key', None), 1)
def test_has_key(self):
self.session['some key'] = 1
self.session.modified = False
self.session.accessed = False
self.assertTrue(self.session.has_key('some key'))
self.assertTrue(self.session.accessed)
self.assertFalse(self.session.modified)
def test_values(self):
self.assertEqual(self.session.values(), [])
self.assertTrue(self.session.accessed)
self.session['some key'] = 1
self.assertEqual(self.session.values(), [1])
def test_iterkeys(self):
self.session['x'] = 1
self.session.modified = False
self.session.accessed = False
i = self.session.iterkeys()
self.assertTrue(hasattr(i, '__iter__'))
self.assertTrue(self.session.accessed)
self.assertFalse(self.session.modified)
self.assertEqual(list(i), ['x'])
def test_iterkeys(self):
self.session['x'] = 1
self.session.modified = False
self.session.accessed = False
i = self.session.itervalues()
self.assertTrue(hasattr(i, '__iter__'))
self.assertTrue(self.session.accessed)
self.assertFalse(self.session.modified)
self.assertEqual(list(i), [1])
def test_iteritems(self):
self.session['x'] = 1
self.session.modified = False
self.session.accessed = False
i = self.session.iteritems()
self.assertTrue(hasattr(i, '__iter__'))
self.assertTrue(self.session.accessed)
self.assertFalse(self.session.modified)
self.assertEqual(list(i), [('x',1)])
def test_clear(self):
self.session['x'] = 1
self.session.modified = False
self.session.accessed = False
self.assertEqual(self.session.items(), [('x',1)])
self.session.clear()
self.assertEqual(self.session.items(), [])
self.assertTrue(self.session.accessed)
self.assertTrue(self.session.modified)
def test_save(self):
self.session.save()
self.assertTrue(self.session.exists(self.session.session_key))
def test_delete(self):
self.session.delete(self.session.session_key)
self.assertFalse(self.session.exists(self.session.session_key))
def test_flush(self):
self.session['foo'] = 'bar'
self.session.save()
prev_key = self.session.session_key
self.session.flush()
self.assertFalse(self.session.exists(prev_key))
self.assertNotEqual(self.session.session_key, prev_key)
self.assertTrue(self.session.modified)
self.assertTrue(self.session.accessed)
def test_cycle(self):
self.session['a'], self.session['b'] = 'c', 'd'
self.session.save()
prev_key = self.session.session_key
prev_data = self.session.items()
self.session.cycle_key()
self.assertNotEqual(self.session.session_key, prev_key)
self.assertEqual(self.session.items(), prev_data)
def test_invalid_key(self):
# Submitting an invalid session key (either by guessing, or if the db has
# removed the key) results in a new key being generated.
session = self.backend('1')
session.save()
self.assertNotEqual(session.session_key, '1')
self.assertEqual(session.get('cat'), None)
session.delete()
# Custom session expiry
def test_default_expiry(self):
# A normal session has a max age equal to settings
self.assertEqual(self.session.get_expiry_age(), settings.SESSION_COOKIE_AGE)
# So does a custom session with an idle expiration time of 0 (but it'll
# expire at browser close)
self.session.set_expiry(0)
self.assertEqual(self.session.get_expiry_age(), settings.SESSION_COOKIE_AGE)
def test_custom_expiry_seconds(self):
# Using seconds
self.session.set_expiry(10)
delta = self.session.get_expiry_date() - datetime.now()
self.assertTrue(delta.seconds in (9, 10))
age = self.session.get_expiry_age()
self.assertTrue(age in (9, 10))
def test_custom_expiry_timedelta(self):
# Using timedelta
self.session.set_expiry(timedelta(seconds=10))
delta = self.session.get_expiry_date() - datetime.now()
self.assertTrue(delta.seconds in (9, 10))
age = self.session.get_expiry_age()
self.assertTrue(age in (9, 10))
def test_custom_expiry_timedelta(self):
# Using timedelta
self.session.set_expiry(datetime.now() + timedelta(seconds=10))
delta = self.session.get_expiry_date() - datetime.now()
self.assertTrue(delta.seconds in (9, 10))
age = self.session.get_expiry_age()
self.assertTrue(age in (9, 10))
def test_custom_expiry_reset(self):
self.session.set_expiry(None)
self.session.set_expiry(10)
self.session.set_expiry(None)
self.assertEqual(self.session.get_expiry_age(), settings.SESSION_COOKIE_AGE)
def test_get_expire_at_browser_close(self):
# Tests get_expire_at_browser_close with different settings and different
# set_expiry calls
try:
try:
original_expire_at_browser_close = settings.SESSION_EXPIRE_AT_BROWSER_CLOSE
settings.SESSION_EXPIRE_AT_BROWSER_CLOSE = False
self.session.set_expiry(10)
self.assertFalse(self.session.get_expire_at_browser_close())
self.session.set_expiry(0)
self.assertTrue(self.session.get_expire_at_browser_close())
self.session.set_expiry(None)
self.assertFalse(self.session.get_expire_at_browser_close())
settings.SESSION_EXPIRE_AT_BROWSER_CLOSE = True
self.session.set_expiry(10)
self.assertFalse(self.session.get_expire_at_browser_close())
self.session.set_expiry(0)
self.assertTrue(self.session.get_expire_at_browser_close())
self.session.set_expiry(None)
self.assertTrue(self.session.get_expire_at_browser_close())
except:
raise
finally:
settings.SESSION_EXPIRE_AT_BROWSER_CLOSE = original_expire_at_browser_close
def test_decode(self):
# Ensure we can decode what we encode
data = {'a test key': 'a test value'}
encoded = self.session.encode(data)
self.assertEqual(self.session.decode(encoded), data)
def test_decode_django12(self):
# Ensure we can decode values encoded using Django 1.2
# Hard code the Django 1.2 method here:
def encode(session_dict):
pickled = pickle.dumps(session_dict, pickle.HIGHEST_PROTOCOL)
pickled_md5 = md5_constructor(pickled + settings.SECRET_KEY).hexdigest()
return base64.encodestring(pickled + pickled_md5)
data = {'a test key': 'a test value'}
encoded = encode(data)
self.assertEqual(self.session.decode(encoded), data)
class DatabaseSessionTests(SessionTestsMixin, TestCase):
backend = DatabaseSession
class CacheDBSessionTests(SessionTestsMixin, TestCase):
backend = CacheDBSession
# Don't need DB flushing for these tests, so can use unittest.TestCase as base class
class FileSessionTests(SessionTestsMixin, unittest.TestCase):
backend = FileSession
def setUp(self):
super(FileSessionTests, self).setUp()
# Do file session tests in an isolated directory, and kill it after we're done.
self.original_session_file_path = settings.SESSION_FILE_PATH
self.temp_session_store = settings.SESSION_FILE_PATH = tempfile.mkdtemp()
def tearDown(self):
settings.SESSION_FILE_PATH = self.original_session_file_path
shutil.rmtree(self.temp_session_store)
super(FileSessionTests, self).tearDown()
def test_configuration_check(self):
# Make sure the file backend checks for a good storage dir
settings.SESSION_FILE_PATH = "/if/this/directory/exists/you/have/a/weird/computer"
self.assertRaises(ImproperlyConfigured, self.backend)
class CacheSessionTests(SessionTestsMixin, unittest.TestCase):
backend = CacheSession
| ajibawa-2023/Python-Code-Large/train/row_98792 | 207 | 295 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Import_L1_C0", "label": "base64 import base64", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0034, 0.0034, 0, 0.66, 0.0, 177, 0, 1, 0, 0, 177, 0, 0], "semantic": {"name": "base64", "arg_names": [], "import_names": ["base64"], "rhs_call_name": "", "annotation": ""}, "snippet": "import base64"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:ImportFrom_L2_C0", "label": "from datetime import datetime, timedelta", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0068, 0.0034, 0, 0.66, 0.05, 426, 0, 2, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetime", "timedelta"], "rhs_call_name": "", "annotation": ""}, "snippet": "from datetime import datetime, timedelta"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Import_L3_C0", "label": "pickle import pickle", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0102, 0.0034, 0, 0.66, 0.1, 848, 0, 1, 0, 0, 848, 0, 0], "semantic": {"name": "pickle", "arg_names": [], "import_names": ["pickle"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pickle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Import_L4_C0", "label": "shutil import shutil", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0136, 0.0034, 0, 0.66, 0.15, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "shutil", "arg_names": [], "import_names": ["shutil"], "rhs_call_name": "", "annotation": ""}, "snippet": "import shutil"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Import_L5_C0", "label": "tempfile import tempfile", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0169, 0.0034, 0, 0.66, 0.2, 516, 0, 1, 0, 0, 516, 0, 0], "semantic": {"name": "tempfile", "arg_names": [], "import_names": ["tempfile"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tempfile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:ImportFrom_L7_C0", "label": "from django.conf import settings", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0237, 0.0034, 0, 0.66, 0.25, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:ImportFrom_L8_C0", "label": "from django.contrib.sessions.backends.db import DatabaseSession", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0271, 0.0034, 0, 0.66, 0.3, 857, 0, 1, 0, 0, 857, 0, 0], "semantic": {"name": "django.contrib.sessions.backends.db", "arg_names": [], "import_names": ["DatabaseSession"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.sessions.backends.db import SessionStore as DatabaseSession"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:ImportFrom_L9_C0", "label": "from django.contrib.sessions.backends.cache import CacheSession", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0305, 0.0034, 0, 0.66, 0.35, 436, 0, 1, 0, 0, 436, 0, 0], "semantic": {"name": "django.contrib.sessions.backends.cache", "arg_names": [], "import_names": ["CacheSession"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.sessions.backends.cache import SessionStore as CacheSession"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:ImportFrom_L10_C0", "label": "from django.contrib.sessions.backends.cached_db import CacheDBSession", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0339, 0.0034, 0, 0.66, 0.4, 991, 0, 1, 0, 0, 991, 0, 0], "semantic": {"name": "django.contrib.sessions.backends.cached_db", "arg_names": [], "import_names": ["CacheDBSession"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.sessions.backends.cached_db import SessionStore as CacheDBSession"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:ImportFrom_L11_C0", "label": "from django.contrib.sessions.backends.file import FileSession", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0373, 0.0034, 0, 0.66, 0.45, 955, 0, 1, 0, 0, 955, 0, 0], "semantic": {"name": "django.contrib.sessions.backends.file", "arg_names": [], "import_names": ["FileSession"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.sessions.backends.file import SessionStore as FileSession"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:ImportFrom_L12_C0", "label": "from django.contrib.sessions.backends.base import SessionBase", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0407, 0.0034, 0, 0.66, 0.5, 907, 0, 1, 0, 0, 907, 0, 0], "semantic": {"name": "django.contrib.sessions.backends.base", "arg_names": [], "import_names": ["SessionBase"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.sessions.backends.base import SessionBase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:ImportFrom_L13_C0", "label": "from django.contrib.sessions.models import Session", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0441, 0.0034, 0, 0.66, 0.55, 800, 0, 1, 0, 0, 800, 0, 0], "semantic": {"name": "django.contrib.sessions.models", "arg_names": [], "import_names": ["Session"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.sessions.models import Session"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:ImportFrom_L14_C0", "label": "from django.core.exceptions import ImproperlyConfigured", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0475, 0.0034, 0, 0.66, 0.6, 160, 0, 1, 0, 0, 160, 0, 0], "semantic": {"name": "django.core.exceptions", "arg_names": [], "import_names": ["ImproperlyConfigured"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.exceptions import ImproperlyConfigured"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:ImportFrom_L15_C0", "label": "from django.test import TestCase", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0508, 0.0034, 0, 0.66, 0.65, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "django.test", "arg_names": [], "import_names": ["TestCase"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.test import TestCase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:ImportFrom_L16_C0", "label": "from django.utils import unittest", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0542, 0.0034, 0, 0.66, 0.7, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "django.utils", "arg_names": [], "import_names": ["unittest"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils import unittest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:ImportFrom_L17_C0", "label": "from django.utils.hashcompat import md5_constructor", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0576, 0.0034, 0, 0.66, 0.75, 474, 0, 1, 0, 0, 474, 0, 0], "semantic": {"name": "django.utils.hashcompat", "arg_names": [], "import_names": ["md5_constructor"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.hashcompat import md5_constructor"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "label": "SessionTestsMixin", "type": "class", "loc": [20, 259], "level": 0, "parent": null, "vector": [3, 0, 0.4729, 0.8136, 0, 0.66, 0.8, 156, 0, 29, 0, 0, 186, 0, 99], "semantic": {"name": "SessionTestsMixin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SessionTestsMixin(object):\n # This does not inherit from TestCase to avoid any tests being run with this\n # class, which wouldn't work, and to allow different TestCase subclasses to\n # be used.\n\n backend = None # subclasses must specify\n\n def setUp(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L25_C4", "label": "backend =", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [14, 1, 0.0847, 0.0034, 1, 0.84, 0.0, 631, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "backend", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " backend = None # subclasses must specify"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L27_C4", "label": "setUp", "type": "function", "loc": [27, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.0932, 0.0068, 1, 0.84, 0.0357, 952, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setUp", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def setUp(self):\n self.session = self.backend()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L28_C8", "label": "self.session = backend()", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L27_C4", "vector": [14, 2, 0.0949, 0.0034, 2, 0.42, 0.0, 77, 3, 0, 0, 0, 631, 10, 1], "semantic": {"name": "self.session", "arg_names": [], "import_names": [], "rhs_call_name": "backend", "annotation": ""}, "snippet": " self.session = self.backend()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L30_C4", "label": "tearDown", "type": "function", "loc": [30, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.1085, 0.0169, 1, 0.84, 0.0714, 530, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "tearDown", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def tearDown(self):\n # NB: be careful to delete any sessions created; stale sessions fill up\n # the /tmp (with some backends) and eventually overwhelm it after lots\n # of runs (think buildbots)\n self.session.delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L34_C8", "label": "delete()", "type": "expression", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L30_C4", "vector": [8, 2, 0.1153, 0.0034, 2, 0.52, 0.0, 266, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " self.session.delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L36_C4", "label": "test_new_session", "type": "function", "loc": [36, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.1254, 0.0102, 1, 0.84, 0.1071, 794, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "test_new_session", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_new_session(self):\n self.assertFalse(self.session.modified)\n self.assertFalse(self.session.accessed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L37_C8", "label": "assertFalse()", "type": "expression", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L36_C4", "vector": [8, 2, 0.1254, 0.0034, 2, 0.57, 0.0, 861, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(self.session.modified)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L38_C8", "label": "assertFalse()", "type": "expression", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L36_C4", "vector": [8, 2, 0.1288, 0.0034, 2, 0.57, 1.0, 861, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(self.session.accessed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L40_C4", "label": "test_get_empty", "type": "function", "loc": [40, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.1373, 0.0068, 1, 0.84, 0.1429, 109, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "test_get_empty", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_get_empty(self):\n self.assertEqual(self.session.get('cat'), None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L41_C8", "label": "assertEqual()", "type": "expression", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L40_C4", "vector": [8, 2, 0.139, 0.0034, 2, 0.28, 0.0, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(self.session.get('cat'), None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L43_C4", "label": "test_store", "type": "function", "loc": [43, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.1508, 0.0136, 1, 0.84, 0.1786, 953, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "test_store", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_store(self):\n self.session['cat'] = \"dog\"\n self.assertTrue(self.session.modified)\n self.assertEqual(self.session.pop('cat'), 'dog')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L44_C8", "label": "assign", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L43_C4", "vector": [14, 2, 0.1492, 0.0034, 2, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session['cat'] = \"dog\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L45_C8", "label": "assertTrue()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L43_C4", "vector": [8, 2, 0.1525, 0.0034, 2, 0.84, 0.5, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(self.session.modified)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L46_C8", "label": "assertEqual()", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L43_C4", "vector": [8, 2, 0.1559, 0.0034, 2, 0.84, 1.0, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(self.session.pop('cat'), 'dog')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L48_C4", "label": "test_pop", "type": "function", "loc": [48, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.178, 0.0339, 1, 0.84, 0.2143, 243, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "test_pop", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_pop(self):\n self.session['some key'] = 'exists'\n # Need to reset these to pretend we haven't accessed it:\n self.accessed = False\n self.modified = False\n\n self.assertEqual(self.session.pop('some key'), 'exists')\n self.assertTrue(self.session.accessed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L49_C8", "label": "assign", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L48_C4", "vector": [14, 2, 0.1661, 0.0034, 2, 0.63, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session['some key'] = 'exists'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L51_C8", "label": "self.accessed =", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L48_C4", "vector": [14, 2, 0.1729, 0.0034, 2, 0.63, 0.1667, 453, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.accessed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.accessed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L52_C8", "label": "self.modified =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L48_C4", "vector": [14, 2, 0.1763, 0.0034, 2, 0.63, 0.3333, 763, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.modified", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.modified = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L54_C8", "label": "assertEqual()", "type": "expression", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L48_C4", "vector": [8, 2, 0.1831, 0.0034, 2, 0.63, 0.5, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(self.session.pop('some key'), 'exists')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L55_C8", "label": "assertTrue()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L48_C4", "vector": [8, 2, 0.1864, 0.0034, 2, 0.63, 0.6667, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(self.session.accessed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L56_C8", "label": "assertTrue()", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L48_C4", "vector": [8, 2, 0.1898, 0.0034, 2, 0.63, 0.8333, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(self.session.modified)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L57_C8", "label": "assertEqual()", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L48_C4", "vector": [8, 2, 0.1932, 0.0034, 2, 0.63, 1.0, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(self.session.get('some key'), None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L59_C4", "label": "test_pop_default", "type": "function", "loc": [59, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.2068, 0.0169, 1, 0.84, 0.25, 113, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "test_pop_default", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_pop_default(self):\n self.assertEqual(self.session.pop('some key', 'does not exist'),\n 'does not exist')\n self.assertTrue(self.session.accessed)\n self.assertFalse(self.session.modified)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L60_C8", "label": "assertEqual()", "type": "expression", "loc": [60, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L59_C4", "vector": [8, 2, 0.2051, 0.0068, 2, 0.12, 0.0, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(self.session.pop('some key', 'does not exist'),\n 'does not exist')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L62_C8", "label": "assertTrue()", "type": "expression", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L59_C4", "vector": [8, 2, 0.2102, 0.0034, 2, 0.12, 0.5, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(self.session.accessed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L63_C8", "label": "assertFalse()", "type": "expression", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L59_C4", "vector": [8, 2, 0.2136, 0.0034, 2, 0.12, 1.0, 861, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(self.session.modified)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L65_C4", "label": "test_setdefault", "type": "function", "loc": [65, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.2271, 0.0169, 1, 0.84, 0.2857, 847, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "test_setdefault", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_setdefault(self):\n self.assertEqual(self.session.setdefault('foo', 'bar'), 'bar')\n self.assertEqual(self.session.setdefault('foo', 'baz'), 'bar')\n self.assertTrue(self.session.accessed)\n self.assertTrue(self.session.modified)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L66_C8", "label": "assertEqual()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L65_C4", "vector": [8, 2, 0.2237, 0.0034, 2, 0.87, 0.0, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(self.session.setdefault('foo', 'bar'), 'bar')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L67_C8", "label": "assertEqual()", "type": "expression", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L65_C4", "vector": [8, 2, 0.2271, 0.0034, 2, 0.87, 0.3333, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(self.session.setdefault('foo', 'baz'), 'bar')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L68_C8", "label": "assertTrue()", "type": "expression", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L65_C4", "vector": [8, 2, 0.2305, 0.0034, 2, 0.87, 0.6667, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(self.session.accessed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L69_C8", "label": "assertTrue()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L65_C4", "vector": [8, 2, 0.2339, 0.0034, 2, 0.87, 1.0, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(self.session.modified)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L71_C4", "label": "test_update", "type": "function", "loc": [71, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.2475, 0.0169, 1, 0.84, 0.3214, 490, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "test_update", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_update(self):\n self.session.update({'update key': 1})\n self.assertTrue(self.session.accessed)\n self.assertTrue(self.session.modified)\n self.assertEqual(self.session.get('update key', None), 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L72_C8", "label": "update()", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L71_C4", "vector": [8, 2, 0.2441, 0.0034, 2, 0.42, 0.0, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self.session.update({'update key': 1})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L73_C8", "label": "assertTrue()", "type": "expression", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L71_C4", "vector": [8, 2, 0.2475, 0.0034, 2, 0.42, 0.3333, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(self.session.accessed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L74_C8", "label": "assertTrue()", "type": "expression", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L71_C4", "vector": [8, 2, 0.2508, 0.0034, 2, 0.42, 0.6667, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(self.session.modified)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L75_C8", "label": "assertEqual()", "type": "expression", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L71_C4", "vector": [8, 2, 0.2542, 0.0034, 2, 0.42, 1.0, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(self.session.get('update key', None), 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L77_C4", "label": "test_has_key", "type": "function", "loc": [77, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.2712, 0.0237, 1, 0.84, 0.3571, 892, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "test_has_key", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_has_key(self):\n self.session['some key'] = 1\n self.session.modified = False\n self.session.accessed = False\n self.assertTrue(self.session.has_key('some key'))\n self.assertTrue(self.session.accessed)\n self.assertFalse(self.session.modified)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L78_C8", "label": "assign", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L77_C4", "vector": [14, 2, 0.2644, 0.0034, 2, 0.03, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session['some key'] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L79_C8", "label": "self.session.modified =", "type": "assigned_variable", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L77_C4", "vector": [14, 2, 0.2678, 0.0034, 2, 0.03, 0.2, 27, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.session.modified", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session.modified = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L80_C8", "label": "self.session.accessed =", "type": "assigned_variable", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L77_C4", "vector": [14, 2, 0.2712, 0.0034, 2, 0.03, 0.4, 352, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.session.accessed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session.accessed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L81_C8", "label": "assertTrue()", "type": "expression", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L77_C4", "vector": [8, 2, 0.2746, 0.0034, 2, 0.03, 0.6, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(self.session.has_key('some key'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L82_C8", "label": "assertTrue()", "type": "expression", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L77_C4", "vector": [8, 2, 0.278, 0.0034, 2, 0.03, 0.8, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(self.session.accessed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L83_C8", "label": "assertFalse()", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L77_C4", "vector": [8, 2, 0.2814, 0.0034, 2, 0.03, 1.0, 861, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(self.session.modified)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L85_C4", "label": "test_values", "type": "function", "loc": [85, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.2949, 0.0169, 1, 0.84, 0.3929, 158, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "test_values", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_values(self):\n self.assertEqual(self.session.values(), [])\n self.assertTrue(self.session.accessed)\n self.session['some key'] = 1\n self.assertEqual(self.session.values(), [1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L86_C8", "label": "assertEqual()", "type": "expression", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L85_C4", "vector": [8, 2, 0.2915, 0.0034, 2, 0.69, 0.0, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(self.session.values(), [])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L87_C8", "label": "assertTrue()", "type": "expression", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L85_C4", "vector": [8, 2, 0.2949, 0.0034, 2, 0.69, 0.3333, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(self.session.accessed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L88_C8", "label": "assign", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L85_C4", "vector": [14, 2, 0.2983, 0.0034, 2, 0.69, 0.6667, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session['some key'] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L89_C8", "label": "assertEqual()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L85_C4", "vector": [8, 2, 0.3017, 0.0034, 2, 0.69, 1.0, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(self.session.values(), [1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L91_C4", "label": "test_iterkeys", "type": "function", "loc": [91, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.322, 0.0305, 1, 0.84, 0.4286, 837, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "test_iterkeys", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_iterkeys(self):\n self.session['x'] = 1\n self.session.modified = False\n self.session.accessed = False\n i = self.session.iterkeys()\n self.assertTrue(hasattr(i, '__iter__'))\n self.assertTrue(self.session.accessed)\n self.assertFalse(self.session.modified)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L92_C8", "label": "assign", "type": "assigned_variable", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L91_C4", "vector": [14, 2, 0.3119, 0.0034, 2, 0.79, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session['x'] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L93_C8", "label": "self.session.modified =", "type": "assigned_variable", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L91_C4", "vector": [14, 2, 0.3153, 0.0034, 2, 0.79, 0.1429, 27, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.session.modified", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session.modified = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L94_C8", "label": "self.session.accessed =", "type": "assigned_variable", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L91_C4", "vector": [14, 2, 0.3186, 0.0034, 2, 0.79, 0.2857, 352, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.session.accessed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session.accessed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L95_C8", "label": "i = iterkeys()", "type": "assigned_variable", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L91_C4", "vector": [14, 2, 0.322, 0.0034, 2, 0.79, 0.4286, 826, 3, 0, 0, 0, 232, 10, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "iterkeys", "annotation": ""}, "snippet": " i = self.session.iterkeys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L96_C8", "label": "assertTrue()", "type": "expression", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L91_C4", "vector": [8, 2, 0.3254, 0.0034, 2, 0.79, 0.5714, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(hasattr(i, '__iter__'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L97_C8", "label": "assertTrue()", "type": "expression", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L91_C4", "vector": [8, 2, 0.3288, 0.0034, 2, 0.79, 0.7143, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(self.session.accessed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L98_C8", "label": "assertFalse()", "type": "expression", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L91_C4", "vector": [8, 2, 0.3322, 0.0034, 2, 0.79, 0.8571, 861, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(self.session.modified)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L99_C8", "label": "assertEqual()", "type": "expression", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L91_C4", "vector": [8, 2, 0.3356, 0.0034, 2, 0.79, 1.0, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(list(i), ['x'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L101_C4", "label": "test_iterkeys", "type": "function", "loc": [101, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.3559, 0.0305, 1, 0.84, 0.4643, 837, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "test_iterkeys", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_iterkeys(self):\n self.session['x'] = 1\n self.session.modified = False\n self.session.accessed = False\n i = self.session.itervalues()\n self.assertTrue(hasattr(i, '__iter__'))\n self.assertTrue(self.session.accessed)\n self.assertFalse(self.session.modified)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L102_C8", "label": "assign", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L101_C4", "vector": [14, 2, 0.3458, 0.0034, 2, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session['x'] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L103_C8", "label": "self.session.modified =", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L101_C4", "vector": [14, 2, 0.3492, 0.0034, 2, 0.38, 0.1429, 27, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.session.modified", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session.modified = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L104_C8", "label": "self.session.accessed =", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L101_C4", "vector": [14, 2, 0.3525, 0.0034, 2, 0.38, 0.2857, 352, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.session.accessed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session.accessed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L105_C8", "label": "i = itervalues()", "type": "assigned_variable", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L101_C4", "vector": [14, 2, 0.3559, 0.0034, 2, 0.38, 0.4286, 826, 3, 0, 0, 0, 288, 10, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "itervalues", "annotation": ""}, "snippet": " i = self.session.itervalues()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L106_C8", "label": "assertTrue()", "type": "expression", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L101_C4", "vector": [8, 2, 0.3593, 0.0034, 2, 0.38, 0.5714, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(hasattr(i, '__iter__'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L107_C8", "label": "assertTrue()", "type": "expression", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L101_C4", "vector": [8, 2, 0.3627, 0.0034, 2, 0.38, 0.7143, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(self.session.accessed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L108_C8", "label": "assertFalse()", "type": "expression", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L101_C4", "vector": [8, 2, 0.3661, 0.0034, 2, 0.38, 0.8571, 861, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(self.session.modified)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L109_C8", "label": "assertEqual()", "type": "expression", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L101_C4", "vector": [8, 2, 0.3695, 0.0034, 2, 0.38, 1.0, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(list(i), [1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L111_C4", "label": "test_iteritems", "type": "function", "loc": [111, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.3898, 0.0305, 1, 0.84, 0.5, 861, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "test_iteritems", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_iteritems(self):\n self.session['x'] = 1\n self.session.modified = False\n self.session.accessed = False\n i = self.session.iteritems()\n self.assertTrue(hasattr(i, '__iter__'))\n self.assertTrue(self.session.accessed)\n self.assertFalse(self.session.modified)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L112_C8", "label": "assign", "type": "assigned_variable", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L111_C4", "vector": [14, 2, 0.3797, 0.0034, 2, 0.14, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session['x'] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L113_C8", "label": "self.session.modified =", "type": "assigned_variable", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L111_C4", "vector": [14, 2, 0.3831, 0.0034, 2, 0.14, 0.1429, 27, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.session.modified", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session.modified = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L114_C8", "label": "self.session.accessed =", "type": "assigned_variable", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L111_C4", "vector": [14, 2, 0.3864, 0.0034, 2, 0.14, 0.2857, 352, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.session.accessed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session.accessed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L115_C8", "label": "i = iteritems()", "type": "assigned_variable", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L111_C4", "vector": [14, 2, 0.3898, 0.0034, 2, 0.14, 0.4286, 826, 3, 0, 0, 0, 252, 10, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "iteritems", "annotation": ""}, "snippet": " i = self.session.iteritems()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L116_C8", "label": "assertTrue()", "type": "expression", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L111_C4", "vector": [8, 2, 0.3932, 0.0034, 2, 0.14, 0.5714, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(hasattr(i, '__iter__'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L117_C8", "label": "assertTrue()", "type": "expression", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L111_C4", "vector": [8, 2, 0.3966, 0.0034, 2, 0.14, 0.7143, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(self.session.accessed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L118_C8", "label": "assertFalse()", "type": "expression", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L111_C4", "vector": [8, 2, 0.4, 0.0034, 2, 0.14, 0.8571, 861, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(self.session.modified)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L119_C8", "label": "assertEqual()", "type": "expression", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L111_C4", "vector": [8, 2, 0.4034, 0.0034, 2, 0.14, 1.0, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(list(i), [('x',1)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L121_C4", "label": "test_clear", "type": "function", "loc": [121, 129], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.4237, 0.0305, 1, 0.84, 0.5357, 243, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "test_clear", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_clear(self):\n self.session['x'] = 1\n self.session.modified = False\n self.session.accessed = False\n self.assertEqual(self.session.items(), [('x',1)])\n self.session.clear()\n self.assertEqual(self.session.items(), [])\n self.assertTrue(self.session.accessed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L122_C8", "label": "assign", "type": "assigned_variable", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L121_C4", "vector": [14, 2, 0.4136, 0.0034, 2, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session['x'] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L123_C8", "label": "self.session.modified =", "type": "assigned_variable", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L121_C4", "vector": [14, 2, 0.4169, 0.0034, 2, 0.57, 0.1429, 27, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.session.modified", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session.modified = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L124_C8", "label": "self.session.accessed =", "type": "assigned_variable", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L121_C4", "vector": [14, 2, 0.4203, 0.0034, 2, 0.57, 0.2857, 352, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.session.accessed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session.accessed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L125_C8", "label": "assertEqual()", "type": "expression", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L121_C4", "vector": [8, 2, 0.4237, 0.0034, 2, 0.57, 0.4286, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(self.session.items(), [('x',1)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L126_C8", "label": "clear()", "type": "expression", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L121_C4", "vector": [8, 2, 0.4271, 0.0034, 2, 0.57, 0.5714, 712, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "clear", "arg_names": [], "import_names": [], "rhs_call_name": "clear", "annotation": ""}, "snippet": " self.session.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L127_C8", "label": "assertEqual()", "type": "expression", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L121_C4", "vector": [8, 2, 0.4305, 0.0034, 2, 0.57, 0.7143, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(self.session.items(), [])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L128_C8", "label": "assertTrue()", "type": "expression", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L121_C4", "vector": [8, 2, 0.4339, 0.0034, 2, 0.57, 0.8571, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(self.session.accessed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L129_C8", "label": "assertTrue()", "type": "expression", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L121_C4", "vector": [8, 2, 0.4373, 0.0034, 2, 0.57, 1.0, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(self.session.modified)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L131_C4", "label": "test_save", "type": "function", "loc": [131, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.4475, 0.0102, 1, 0.84, 0.5714, 274, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "test_save", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_save(self):\n self.session.save()\n self.assertTrue(self.session.exists(self.session.session_key))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L132_C8", "label": "save()", "type": "expression", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L131_C4", "vector": [8, 2, 0.4475, 0.0034, 2, 0.41, 0.0, 928, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " self.session.save()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L133_C8", "label": "assertTrue()", "type": "expression", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L131_C4", "vector": [8, 2, 0.4508, 0.0034, 2, 0.41, 1.0, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(self.session.exists(self.session.session_key))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L135_C4", "label": "test_delete", "type": "function", "loc": [135, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.461, 0.0102, 1, 0.84, 0.6071, 456, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "test_delete", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_delete(self):\n self.session.delete(self.session.session_key)\n self.assertFalse(self.session.exists(self.session.session_key))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L136_C8", "label": "delete()", "type": "expression", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L135_C4", "vector": [8, 2, 0.461, 0.0034, 2, 0.45, 0.0, 266, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " self.session.delete(self.session.session_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L137_C8", "label": "assertFalse()", "type": "expression", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L135_C4", "vector": [8, 2, 0.4644, 0.0034, 2, 0.45, 1.0, 861, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(self.session.exists(self.session.session_key))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L139_C4", "label": "test_flush", "type": "function", "loc": [139, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.4847, 0.0305, 1, 0.84, 0.6429, 636, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "test_flush", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_flush(self):\n self.session['foo'] = 'bar'\n self.session.save()\n prev_key = self.session.session_key\n self.session.flush()\n self.assertFalse(self.session.exists(prev_key))\n self.assertNotEqual(self.session.session_key, prev_key)\n self.assertTrue(self.session.modified)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L140_C8", "label": "assign", "type": "assigned_variable", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L139_C4", "vector": [14, 2, 0.4746, 0.0034, 2, 0.31, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session['foo'] = 'bar'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L141_C8", "label": "save()", "type": "expression", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L139_C4", "vector": [8, 2, 0.478, 0.0034, 2, 0.31, 0.1429, 928, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " self.session.save()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L142_C8", "label": "prev_key =", "type": "assigned_variable", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L139_C4", "vector": [14, 2, 0.4814, 0.0034, 2, 0.31, 0.2857, 421, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "prev_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prev_key = self.session.session_key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L143_C8", "label": "flush()", "type": "expression", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L139_C4", "vector": [8, 2, 0.4847, 0.0034, 2, 0.31, 0.4286, 439, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "flush", "arg_names": [], "import_names": [], "rhs_call_name": "flush", "annotation": ""}, "snippet": " self.session.flush()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L144_C8", "label": "assertFalse()", "type": "expression", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L139_C4", "vector": [8, 2, 0.4881, 0.0034, 2, 0.31, 0.5714, 861, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(self.session.exists(prev_key))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L145_C8", "label": "assertNotEqual()", "type": "expression", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L139_C4", "vector": [8, 2, 0.4915, 0.0034, 2, 0.31, 0.7143, 120, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertNotEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertNotEqual", "annotation": ""}, "snippet": " self.assertNotEqual(self.session.session_key, prev_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L146_C8", "label": "assertTrue()", "type": "expression", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L139_C4", "vector": [8, 2, 0.4949, 0.0034, 2, 0.31, 0.8571, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(self.session.modified)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L147_C8", "label": "assertTrue()", "type": "expression", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L139_C4", "vector": [8, 2, 0.4983, 0.0034, 2, 0.31, 1.0, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(self.session.accessed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L149_C4", "label": "test_cycle", "type": "function", "loc": [149, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.5169, 0.0271, 1, 0.84, 0.6786, 985, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "test_cycle", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_cycle(self):\n self.session['a'], self.session['b'] = 'c', 'd'\n self.session.save()\n prev_key = self.session.session_key\n prev_data = self.session.items()\n self.session.cycle_key()\n self.assertNotEqual(self.session.session_key, prev_key)\n self.assertEqual(self.session.items(), prev_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L150_C8", "label": "assign", "type": "assigned_variable", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L149_C4", "vector": [14, 2, 0.5085, 0.0034, 2, 0.95, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session['a'], self.session['b'] = 'c', 'd'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L151_C8", "label": "save()", "type": "expression", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L149_C4", "vector": [8, 2, 0.5119, 0.0034, 2, 0.95, 0.1667, 928, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " self.session.save()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L152_C8", "label": "prev_key =", "type": "assigned_variable", "loc": [152, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L149_C4", "vector": [14, 2, 0.5153, 0.0034, 2, 0.95, 0.3333, 421, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "prev_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prev_key = self.session.session_key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L153_C8", "label": "prev_data = items()", "type": "assigned_variable", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L149_C4", "vector": [14, 2, 0.5186, 0.0034, 2, 0.95, 0.5, 239, 3, 0, 0, 0, 339, 10, 1], "semantic": {"name": "prev_data", "arg_names": [], "import_names": [], "rhs_call_name": "items", "annotation": ""}, "snippet": " prev_data = self.session.items()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L154_C8", "label": "cycle_key()", "type": "expression", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L149_C4", "vector": [8, 2, 0.522, 0.0034, 2, 0.95, 0.6667, 573, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "cycle_key", "arg_names": [], "import_names": [], "rhs_call_name": "cycle_key", "annotation": ""}, "snippet": " self.session.cycle_key()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L155_C8", "label": "assertNotEqual()", "type": "expression", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L149_C4", "vector": [8, 2, 0.5254, 0.0034, 2, 0.95, 0.8333, 120, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertNotEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertNotEqual", "annotation": ""}, "snippet": " self.assertNotEqual(self.session.session_key, prev_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L156_C8", "label": "assertEqual()", "type": "expression", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L149_C4", "vector": [8, 2, 0.5288, 0.0034, 2, 0.95, 1.0, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(self.session.items(), prev_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L158_C4", "label": "test_invalid_key", "type": "function", "loc": [158, 165], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.5475, 0.0271, 1, 0.84, 0.7143, 799, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "test_invalid_key", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_invalid_key(self):\n # Submitting an invalid session key (either by guessing, or if the db has\n # removed the key) results in a new key being generated.\n session = self.backend('1')\n session.save()\n self.assertNotEqual(session.session_key, '1')\n self.assertEqual(session.get('cat'), None)\n session.delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L161_C8", "label": "session = backend()", "type": "assigned_variable", "loc": [161, 161], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L158_C4", "vector": [14, 2, 0.5458, 0.0034, 2, 0.86, 0.0, 83, 3, 1, 0, 0, 631, 10, 1], "semantic": {"name": "session", "arg_names": [], "import_names": [], "rhs_call_name": "backend", "annotation": ""}, "snippet": " session = self.backend('1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L162_C8", "label": "save()", "type": "expression", "loc": [162, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L158_C4", "vector": [8, 2, 0.5492, 0.0034, 2, 0.86, 0.25, 928, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " session.save()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L163_C8", "label": "assertNotEqual()", "type": "expression", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L158_C4", "vector": [8, 2, 0.5525, 0.0034, 2, 0.86, 0.5, 120, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertNotEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertNotEqual", "annotation": ""}, "snippet": " self.assertNotEqual(session.session_key, '1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L164_C8", "label": "assertEqual()", "type": "expression", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L158_C4", "vector": [8, 2, 0.5559, 0.0034, 2, 0.86, 0.75, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(session.get('cat'), None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L165_C8", "label": "delete()", "type": "expression", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L158_C4", "vector": [8, 2, 0.5593, 0.0034, 2, 0.86, 1.0, 266, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " session.delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L168_C4", "label": "test_default_expiry", "type": "function", "loc": [168, 175], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.5814, 0.0271, 1, 0.84, 0.75, 764, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "test_default_expiry", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_default_expiry(self):\n # A normal session has a max age equal to settings\n self.assertEqual(self.session.get_expiry_age(), settings.SESSION_COOKIE_AGE)\n\n # So does a custom session with an idle expiration time of 0 (but it'll\n # expire at browser close)\n self.session.set_expiry(0)\n self.assertEqual(self.session.get_expiry_age(), settings.SESSION_COOKIE_AGE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L170_C8", "label": "assertEqual()", "type": "expression", "loc": [170, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L168_C4", "vector": [8, 2, 0.5763, 0.0034, 2, 0.76, 0.0, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(self.session.get_expiry_age(), settings.SESSION_COOKIE_AGE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L174_C8", "label": "set_expiry()", "type": "expression", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L168_C4", "vector": [8, 2, 0.5898, 0.0034, 2, 0.76, 0.5, 454, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_expiry", "arg_names": [], "import_names": [], "rhs_call_name": "set_expiry", "annotation": ""}, "snippet": " self.session.set_expiry(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L175_C8", "label": "assertEqual()", "type": "expression", "loc": [175, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L168_C4", "vector": [8, 2, 0.5932, 0.0034, 2, 0.76, 1.0, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(self.session.get_expiry_age(), settings.SESSION_COOKIE_AGE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L177_C4", "label": "test_custom_expiry_seconds", "type": "function", "loc": [177, 184], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.6119, 0.0271, 1, 0.84, 0.7857, 63, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "test_custom_expiry_seconds", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_custom_expiry_seconds(self):\n # Using seconds\n self.session.set_expiry(10)\n delta = self.session.get_expiry_date() - datetime.now()\n self.assertTrue(delta.seconds in (9, 10))\n\n age = self.session.get_expiry_age()\n self.assertTrue(age in (9, 10))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L179_C8", "label": "set_expiry()", "type": "expression", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L177_C4", "vector": [8, 2, 0.6068, 0.0034, 2, 0.64, 0.0, 454, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_expiry", "arg_names": [], "import_names": [], "rhs_call_name": "set_expiry", "annotation": ""}, "snippet": " self.session.set_expiry(10)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L180_C8", "label": "delta =", "type": "assigned_variable", "loc": [180, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L177_C4", "vector": [14, 2, 0.6102, 0.0034, 2, 0.64, 0.25, 593, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "delta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " delta = self.session.get_expiry_date() - datetime.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L181_C8", "label": "assertTrue()", "type": "expression", "loc": [181, 181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L177_C4", "vector": [8, 2, 0.6136, 0.0034, 2, 0.64, 0.5, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(delta.seconds in (9, 10))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L183_C8", "label": "age = get_expiry_age()", "type": "assigned_variable", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L177_C4", "vector": [14, 2, 0.6203, 0.0034, 2, 0.64, 0.75, 657, 3, 0, 0, 0, 94, 10, 1], "semantic": {"name": "age", "arg_names": [], "import_names": [], "rhs_call_name": "get_expiry_age", "annotation": ""}, "snippet": " age = self.session.get_expiry_age()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L184_C8", "label": "assertTrue()", "type": "expression", "loc": [184, 184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L177_C4", "vector": [8, 2, 0.6237, 0.0034, 2, 0.64, 1.0, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(age in (9, 10))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L186_C4", "label": "test_custom_expiry_timedelta", "type": "function", "loc": [186, 193], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.6424, 0.0271, 1, 0.84, 0.8214, 931, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "test_custom_expiry_timedelta", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_custom_expiry_timedelta(self):\n # Using timedelta\n self.session.set_expiry(timedelta(seconds=10))\n delta = self.session.get_expiry_date() - datetime.now()\n self.assertTrue(delta.seconds in (9, 10))\n\n age = self.session.get_expiry_age()\n self.assertTrue(age in (9, 10))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L188_C8", "label": "set_expiry()", "type": "expression", "loc": [188, 188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L186_C4", "vector": [8, 2, 0.6373, 0.0034, 2, 0.6, 0.0, 454, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "set_expiry", "arg_names": [], "import_names": [], "rhs_call_name": "set_expiry", "annotation": ""}, "snippet": " self.session.set_expiry(timedelta(seconds=10))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L189_C8", "label": "delta =", "type": "assigned_variable", "loc": [189, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L186_C4", "vector": [14, 2, 0.6407, 0.0034, 2, 0.6, 0.25, 593, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "delta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " delta = self.session.get_expiry_date() - datetime.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L190_C8", "label": "assertTrue()", "type": "expression", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L186_C4", "vector": [8, 2, 0.6441, 0.0034, 2, 0.6, 0.5, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(delta.seconds in (9, 10))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L192_C8", "label": "age = get_expiry_age()", "type": "assigned_variable", "loc": [192, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L186_C4", "vector": [14, 2, 0.6508, 0.0034, 2, 0.6, 0.75, 657, 3, 0, 0, 0, 94, 10, 1], "semantic": {"name": "age", "arg_names": [], "import_names": [], "rhs_call_name": "get_expiry_age", "annotation": ""}, "snippet": " age = self.session.get_expiry_age()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L193_C8", "label": "assertTrue()", "type": "expression", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L186_C4", "vector": [8, 2, 0.6542, 0.0034, 2, 0.6, 1.0, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(age in (9, 10))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L195_C4", "label": "test_custom_expiry_timedelta", "type": "function", "loc": [195, 202], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.6729, 0.0271, 1, 0.84, 0.8571, 931, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "test_custom_expiry_timedelta", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_custom_expiry_timedelta(self):\n # Using timedelta\n self.session.set_expiry(datetime.now() + timedelta(seconds=10))\n delta = self.session.get_expiry_date() - datetime.now()\n self.assertTrue(delta.seconds in (9, 10))\n\n age = self.session.get_expiry_age()\n self.assertTrue(age in (9, 10))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L197_C8", "label": "set_expiry()", "type": "expression", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L195_C4", "vector": [8, 2, 0.6678, 0.0034, 2, 0.83, 0.0, 454, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "set_expiry", "arg_names": [], "import_names": [], "rhs_call_name": "set_expiry", "annotation": ""}, "snippet": " self.session.set_expiry(datetime.now() + timedelta(seconds=10))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L198_C8", "label": "delta =", "type": "assigned_variable", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L195_C4", "vector": [14, 2, 0.6712, 0.0034, 2, 0.83, 0.25, 593, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "delta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " delta = self.session.get_expiry_date() - datetime.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L199_C8", "label": "assertTrue()", "type": "expression", "loc": [199, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L195_C4", "vector": [8, 2, 0.6746, 0.0034, 2, 0.83, 0.5, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(delta.seconds in (9, 10))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L201_C8", "label": "age = get_expiry_age()", "type": "assigned_variable", "loc": [201, 201], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L195_C4", "vector": [14, 2, 0.6814, 0.0034, 2, 0.83, 0.75, 657, 3, 0, 0, 0, 94, 10, 1], "semantic": {"name": "age", "arg_names": [], "import_names": [], "rhs_call_name": "get_expiry_age", "annotation": ""}, "snippet": " age = self.session.get_expiry_age()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L202_C8", "label": "assertTrue()", "type": "expression", "loc": [202, 202], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L195_C4", "vector": [8, 2, 0.6847, 0.0034, 2, 0.83, 1.0, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(age in (9, 10))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L204_C4", "label": "test_custom_expiry_reset", "type": "function", "loc": [204, 208], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.6983, 0.0169, 1, 0.84, 0.8929, 791, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "test_custom_expiry_reset", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_custom_expiry_reset(self):\n self.session.set_expiry(None)\n self.session.set_expiry(10)\n self.session.set_expiry(None)\n self.assertEqual(self.session.get_expiry_age(), settings.SESSION_COOKIE_AGE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L205_C8", "label": "set_expiry()", "type": "expression", "loc": [205, 205], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L204_C4", "vector": [8, 2, 0.6949, 0.0034, 2, 0.84, 0.0, 454, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_expiry", "arg_names": [], "import_names": [], "rhs_call_name": "set_expiry", "annotation": ""}, "snippet": " self.session.set_expiry(None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L206_C8", "label": "set_expiry()", "type": "expression", "loc": [206, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L204_C4", "vector": [8, 2, 0.6983, 0.0034, 2, 0.84, 0.3333, 454, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_expiry", "arg_names": [], "import_names": [], "rhs_call_name": "set_expiry", "annotation": ""}, "snippet": " self.session.set_expiry(10)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L207_C8", "label": "set_expiry()", "type": "expression", "loc": [207, 207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L204_C4", "vector": [8, 2, 0.7017, 0.0034, 2, 0.84, 0.6667, 454, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_expiry", "arg_names": [], "import_names": [], "rhs_call_name": "set_expiry", "annotation": ""}, "snippet": " self.session.set_expiry(None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L208_C8", "label": "assertEqual()", "type": "expression", "loc": [208, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L204_C4", "vector": [8, 2, 0.7051, 0.0034, 2, 0.84, 1.0, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(self.session.get_expiry_age(), settings.SESSION_COOKIE_AGE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L210_C4", "label": "test_get_expire_at_browser_close", "type": "function", "loc": [210, 241], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.7644, 0.1085, 1, 0.84, 0.9286, 667, 0, 1, 0, 0, 0, 0, 18], "semantic": {"name": "test_get_expire_at_browser_close", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_get_expire_at_browser_close(self):\n # Tests get_expire_at_browser_close with different settings and different\n # set_expiry calls\n try:\n try:\n original_expire_at_browser_close = settings.SESSION_EXPIRE_AT_BROWSER_CLOSE\n settings.SESSION_EXPIRE_AT_BROWSER_CLOSE = False\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L213_C8", "label": "try", "type": "try", "loc": [213, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L210_C4", "vector": [7, 2, 0.7695, 0.0983, 2, 0.69, 0.0, 0, 0, 0, 0, 0, 0, 0, 18], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n try:\n original_expire_at_browser_close = settings.SESSION_EXPIRE_AT_BROWSER_CLOSE\n settings.SESSION_EXPIRE_AT_BROWSER_CLOSE = False\n\n self.session.set_expiry(10)\n self.assertFalse(self.session.get_expire_at_browser_close())\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "label": "try", "type": "try", "loc": [214, 239], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L213_C8", "vector": [7, 3, 0.7678, 0.0881, 3, 0.4, 0.0, 0, 0, 1, 0, 0, 0, 0, 18], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n original_expire_at_browser_close = settings.SESSION_EXPIRE_AT_BROWSER_CLOSE\n settings.SESSION_EXPIRE_AT_BROWSER_CLOSE = False\n\n self.session.set_expiry(10)\n self.assertFalse(self.session.get_expire_at_browser_close())\n\n self.session.set_expiry(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L215_C16", "label": "original_expire_at_browser_close =", "type": "assigned_variable", "loc": [215, 215], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "vector": [14, 4, 0.7288, 0.0034, 4, 0.17, 0.0, 367, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "original_expire_at_browser_close", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " original_expire_at_browser_close = settings.SESSION_EXPIRE_AT_BROWSER_CLOSE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L216_C16", "label": "settings.SESSION_EXPIRE_AT_BROWSER_CLOSE =", "type": "assigned_variable", "loc": [216, 216], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "vector": [14, 4, 0.7322, 0.0034, 4, 0.17, 0.0714, 192, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "settings.SESSION_EXPIRE_AT_BROWSER_CLOSE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " settings.SESSION_EXPIRE_AT_BROWSER_CLOSE = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L218_C16", "label": "set_expiry()", "type": "expression", "loc": [218, 218], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "vector": [8, 4, 0.739, 0.0034, 4, 0.17, 0.1429, 454, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_expiry", "arg_names": [], "import_names": [], "rhs_call_name": "set_expiry", "annotation": ""}, "snippet": " self.session.set_expiry(10)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L219_C16", "label": "assertFalse()", "type": "expression", "loc": [219, 219], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "vector": [8, 4, 0.7424, 0.0034, 4, 0.17, 0.2143, 861, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(self.session.get_expire_at_browser_close())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L221_C16", "label": "set_expiry()", "type": "expression", "loc": [221, 221], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "vector": [8, 4, 0.7492, 0.0034, 4, 0.17, 0.2857, 454, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_expiry", "arg_names": [], "import_names": [], "rhs_call_name": "set_expiry", "annotation": ""}, "snippet": " self.session.set_expiry(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L222_C16", "label": "assertTrue()", "type": "expression", "loc": [222, 222], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "vector": [8, 4, 0.7525, 0.0034, 4, 0.17, 0.3571, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(self.session.get_expire_at_browser_close())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L224_C16", "label": "set_expiry()", "type": "expression", "loc": [224, 224], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "vector": [8, 4, 0.7593, 0.0034, 4, 0.17, 0.4286, 454, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_expiry", "arg_names": [], "import_names": [], "rhs_call_name": "set_expiry", "annotation": ""}, "snippet": " self.session.set_expiry(None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L225_C16", "label": "assertFalse()", "type": "expression", "loc": [225, 225], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "vector": [8, 4, 0.7627, 0.0034, 4, 0.17, 0.5, 861, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(self.session.get_expire_at_browser_close())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L227_C16", "label": "settings.SESSION_EXPIRE_AT_BROWSER_CLOSE =", "type": "assigned_variable", "loc": [227, 227], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "vector": [14, 4, 0.7695, 0.0034, 4, 0.17, 0.5714, 192, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "settings.SESSION_EXPIRE_AT_BROWSER_CLOSE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " settings.SESSION_EXPIRE_AT_BROWSER_CLOSE = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L229_C16", "label": "set_expiry()", "type": "expression", "loc": [229, 229], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "vector": [8, 4, 0.7763, 0.0034, 4, 0.17, 0.6429, 454, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_expiry", "arg_names": [], "import_names": [], "rhs_call_name": "set_expiry", "annotation": ""}, "snippet": " self.session.set_expiry(10)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L230_C16", "label": "assertFalse()", "type": "expression", "loc": [230, 230], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "vector": [8, 4, 0.7797, 0.0034, 4, 0.17, 0.7143, 861, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(self.session.get_expire_at_browser_close())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L232_C16", "label": "set_expiry()", "type": "expression", "loc": [232, 232], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "vector": [8, 4, 0.7864, 0.0034, 4, 0.17, 0.7857, 454, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_expiry", "arg_names": [], "import_names": [], "rhs_call_name": "set_expiry", "annotation": ""}, "snippet": " self.session.set_expiry(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L233_C16", "label": "assertTrue()", "type": "expression", "loc": [233, 233], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "vector": [8, 4, 0.7898, 0.0034, 4, 0.17, 0.8571, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(self.session.get_expire_at_browser_close())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L235_C16", "label": "set_expiry()", "type": "expression", "loc": [235, 235], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "vector": [8, 4, 0.7966, 0.0034, 4, 0.17, 0.9286, 454, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_expiry", "arg_names": [], "import_names": [], "rhs_call_name": "set_expiry", "annotation": ""}, "snippet": " self.session.set_expiry(None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L236_C16", "label": "assertTrue()", "type": "expression", "loc": [236, 236], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "vector": [8, 4, 0.8, 0.0034, 4, 0.17, 1.0, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(self.session.get_expire_at_browser_close())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L241_C12", "label": "settings.SESSION_EXPIRE_AT_BROWSER_CLOSE =", "type": "assigned_variable", "loc": [241, 241], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L213_C8", "vector": [14, 3, 0.8169, 0.0034, 3, 0.4, 1.0, 192, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "settings.SESSION_EXPIRE_AT_BROWSER_CLOSE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " settings.SESSION_EXPIRE_AT_BROWSER_CLOSE = original_expire_at_browser_close"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L243_C4", "label": "test_decode", "type": "function", "loc": [243, 247], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.8305, 0.0169, 1, 0.84, 0.9643, 313, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "test_decode", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_decode(self):\n # Ensure we can decode what we encode\n data = {'a test key': 'a test value'}\n encoded = self.session.encode(data)\n self.assertEqual(self.session.decode(encoded), data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L245_C8", "label": "data =", "type": "assigned_variable", "loc": [245, 245], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L243_C4", "vector": [14, 2, 0.8305, 0.0034, 2, 0.33, 0.0, 929, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = {'a test key': 'a test value'}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L246_C8", "label": "encoded = encode()", "type": "assigned_variable", "loc": [246, 246], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L243_C4", "vector": [14, 2, 0.8339, 0.0034, 2, 0.33, 0.5, 951, 3, 1, 0, 0, 623, 10, 1], "semantic": {"name": "encoded", "arg_names": [], "import_names": [], "rhs_call_name": "encode", "annotation": ""}, "snippet": " encoded = self.session.encode(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L247_C8", "label": "assertEqual()", "type": "expression", "loc": [247, 247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L243_C4", "vector": [8, 2, 0.8373, 0.0034, 2, 0.33, 1.0, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(self.session.decode(encoded), data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L249_C4", "label": "test_decode_django12", "type": "function", "loc": [249, 259], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "vector": [2, 1, 0.861, 0.0373, 1, 0.84, 1.0, 271, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "test_decode_django12", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_decode_django12(self):\n # Ensure we can decode values encoded using Django 1.2\n # Hard code the Django 1.2 method here:\n def encode(session_dict):\n pickled = pickle.dumps(session_dict, pickle.HIGHEST_PROTOCOL)\n pickled_md5 = md5_constructor(pickled + settings.SECRET_KEY).hexdigest()\n return base64.encodestring(pickled + pickled_md5)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L252_C8", "label": "encode", "type": "function", "loc": [252, 255], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L249_C4", "vector": [2, 2, 0.8593, 0.0136, 2, 0.96, 0.0, 623, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "encode", "arg_names": ["session_dict"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def encode(session_dict):\n pickled = pickle.dumps(session_dict, pickle.HIGHEST_PROTOCOL)\n pickled_md5 = md5_constructor(pickled + settings.SECRET_KEY).hexdigest()\n return base64.encodestring(pickled + pickled_md5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L253_C12", "label": "pickled = dumps()", "type": "assigned_variable", "loc": [253, 253], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L252_C8", "vector": [14, 3, 0.8576, 0.0034, 3, 0.24, 0.0, 271, 3, 2, 0, 0, 160, 10, 1], "semantic": {"name": "pickled", "arg_names": [], "import_names": [], "rhs_call_name": "dumps", "annotation": ""}, "snippet": " pickled = pickle.dumps(session_dict, pickle.HIGHEST_PROTOCOL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L254_C12", "label": "pickled_md5 = hexdigest()", "type": "assigned_variable", "loc": [254, 254], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L252_C8", "vector": [14, 3, 0.861, 0.0034, 3, 0.24, 0.5, 633, 3, 0, 0, 0, 89, 10, 2], "semantic": {"name": "pickled_md5", "arg_names": [], "import_names": [], "rhs_call_name": "hexdigest", "annotation": ""}, "snippet": " pickled_md5 = md5_constructor(pickled + settings.SECRET_KEY).hexdigest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Return_L255_C12", "label": "return", "type": "return", "loc": [255, 255], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L252_C8", "vector": [13, 3, 0.8644, 0.0034, 3, 0.24, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return base64.encodestring(pickled + pickled_md5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L257_C8", "label": "data =", "type": "assigned_variable", "loc": [257, 257], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L249_C4", "vector": [14, 2, 0.8712, 0.0034, 2, 0.96, 0.3333, 929, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = {'a test key': 'a test value'}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L258_C8", "label": "encoded = encode()", "type": "assigned_variable", "loc": [258, 258], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L249_C4", "vector": [14, 2, 0.8746, 0.0034, 2, 0.96, 0.6667, 951, 3, 1, 0, 0, 623, 10, 1], "semantic": {"name": "encoded", "arg_names": [], "import_names": [], "rhs_call_name": "encode", "annotation": ""}, "snippet": " encoded = encode(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L259_C8", "label": "assertEqual()", "type": "expression", "loc": [259, 259], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L249_C4", "vector": [8, 2, 0.878, 0.0034, 2, 0.96, 1.0, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(self.session.decode(encoded), data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L262_C0", "label": "DatabaseSessionTests", "type": "class", "loc": [262, 264], "level": 0, "parent": null, "vector": [3, 0, 0.8915, 0.0102, 0, 0.66, 0.85, 302, 0, 0, 0, 0, 156, 0, 0], "semantic": {"name": "DatabaseSessionTests", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DatabaseSessionTests(SessionTestsMixin, TestCase):\n\n backend = DatabaseSession"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L264_C4", "label": "backend =", "type": "assigned_variable", "loc": [264, 264], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L262_C0", "vector": [14, 1, 0.8949, 0.0034, 1, 0.66, 0.0, 631, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "backend", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " backend = DatabaseSession"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L267_C0", "label": "CacheDBSessionTests", "type": "class", "loc": [267, 269], "level": 0, "parent": null, "vector": [3, 0, 0.9085, 0.0102, 0, 0.66, 0.9, 559, 0, 0, 0, 0, 156, 0, 0], "semantic": {"name": "CacheDBSessionTests", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CacheDBSessionTests(SessionTestsMixin, TestCase):\n\n backend = CacheDBSession"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L269_C4", "label": "backend =", "type": "assigned_variable", "loc": [269, 269], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L267_C0", "vector": [14, 1, 0.9119, 0.0034, 1, 0.42, 0.0, 631, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "backend", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " backend = CacheDBSession"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L272_C0", "label": "FileSessionTests", "type": "class", "loc": [272, 290], "level": 0, "parent": null, "vector": [3, 0, 0.9525, 0.0644, 0, 0.66, 0.95, 645, 0, 3, 0, 0, 156, 0, 7], "semantic": {"name": "FileSessionTests", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FileSessionTests(SessionTestsMixin, unittest.TestCase):\n\n backend = FileSession\n\n def setUp(self):\n super(FileSessionTests, self).setUp()\n # Do file session tests in an isolated directory, and kill it after we're done.\n self.original_session_file_path = settings.SESSION_FILE_PATH"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L274_C4", "label": "backend =", "type": "assigned_variable", "loc": [274, 274], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L272_C0", "vector": [14, 1, 0.9288, 0.0034, 1, 0.63, 0.0, 631, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "backend", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " backend = FileSession"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L276_C4", "label": "setUp", "type": "function", "loc": [276, 280], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L272_C0", "vector": [2, 1, 0.9424, 0.0169, 1, 0.63, 0.3333, 952, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "setUp", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def setUp(self):\n super(FileSessionTests, self).setUp()\n # Do file session tests in an isolated directory, and kill it after we're done.\n self.original_session_file_path = settings.SESSION_FILE_PATH\n self.temp_session_store = settings.SESSION_FILE_PATH = tempfile.mkdtemp()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L277_C8", "label": "setUp()", "type": "expression", "loc": [277, 277], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L276_C4", "vector": [8, 2, 0.939, 0.0034, 2, 0.04, 0.0, 952, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "setUp", "arg_names": [], "import_names": [], "rhs_call_name": "setUp", "annotation": ""}, "snippet": " super(FileSessionTests, self).setUp()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L279_C8", "label": "self.original_session_file_path =", "type": "assigned_variable", "loc": [279, 279], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L276_C4", "vector": [14, 2, 0.9458, 0.0034, 2, 0.04, 0.5, 429, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.original_session_file_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.original_session_file_path = settings.SESSION_FILE_PATH"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L280_C8", "label": "self.temp_session_store = mkdtemp()", "type": "assigned_variable", "loc": [280, 280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L276_C4", "vector": [14, 2, 0.9492, 0.0034, 2, 0.04, 1.0, 506, 3, 0, 0, 0, 912, 10, 1], "semantic": {"name": "self.temp_session_store", "arg_names": [], "import_names": [], "rhs_call_name": "mkdtemp", "annotation": ""}, "snippet": " self.temp_session_store = settings.SESSION_FILE_PATH = tempfile.mkdtemp()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L282_C4", "label": "tearDown", "type": "function", "loc": [282, 285], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L272_C0", "vector": [2, 1, 0.961, 0.0136, 1, 0.63, 0.6667, 530, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "tearDown", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def tearDown(self):\n settings.SESSION_FILE_PATH = self.original_session_file_path\n shutil.rmtree(self.temp_session_store)\n super(FileSessionTests, self).tearDown()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L283_C8", "label": "settings.SESSION_FILE_PATH =", "type": "assigned_variable", "loc": [283, 283], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L282_C4", "vector": [14, 2, 0.9593, 0.0034, 2, 0.42, 0.0, 12, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "settings.SESSION_FILE_PATH", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " settings.SESSION_FILE_PATH = self.original_session_file_path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L284_C8", "label": "rmtree()", "type": "expression", "loc": [284, 284], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L282_C4", "vector": [8, 2, 0.9627, 0.0034, 2, 0.42, 0.5, 317, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "rmtree", "arg_names": [], "import_names": [], "rhs_call_name": "rmtree", "annotation": ""}, "snippet": " shutil.rmtree(self.temp_session_store)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L285_C8", "label": "tearDown()", "type": "expression", "loc": [285, 285], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L282_C4", "vector": [8, 2, 0.9661, 0.0034, 2, 0.42, 1.0, 530, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "tearDown", "arg_names": [], "import_names": [], "rhs_call_name": "tearDown", "annotation": ""}, "snippet": " super(FileSessionTests, self).tearDown()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L287_C4", "label": "test_configuration_check", "type": "function", "loc": [287, 290], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L272_C0", "vector": [2, 1, 0.978, 0.0136, 1, 0.63, 1.0, 588, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "test_configuration_check", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_configuration_check(self):\n # Make sure the file backend checks for a good storage dir\n settings.SESSION_FILE_PATH = \"/if/this/directory/exists/you/have/a/weird/computer\"\n self.assertRaises(ImproperlyConfigured, self.backend)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L289_C8", "label": "settings.SESSION_FILE_PATH =", "type": "assigned_variable", "loc": [289, 289], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L287_C4", "vector": [14, 2, 0.9797, 0.0034, 2, 0.27, 0.0, 12, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "settings.SESSION_FILE_PATH", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " settings.SESSION_FILE_PATH = \"/if/this/directory/exists/you/have/a/weird/computer\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L290_C8", "label": "assertRaises()", "type": "expression", "loc": [290, 290], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L287_C4", "vector": [8, 2, 0.9831, 0.0034, 2, 0.27, 1.0, 11, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertRaises", "arg_names": [], "import_names": [], "rhs_call_name": "assertRaises", "annotation": ""}, "snippet": " self.assertRaises(ImproperlyConfigured, self.backend)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L293_C0", "label": "CacheSessionTests", "type": "class", "loc": [293, 295], "level": 0, "parent": null, "vector": [3, 0, 0.9966, 0.0102, 0, 0.66, 1.0, 222, 0, 0, 0, 0, 156, 0, 0], "semantic": {"name": "CacheSessionTests", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CacheSessionTests(SessionTestsMixin, unittest.TestCase):\n\n backend = CacheSession"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L295_C4", "label": "backend =", "type": "assigned_variable", "loc": [295, 295], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L293_C0", "vector": [14, 1, 1.0, 0.0034, 1, 0.73, 0.0, 631, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "backend", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " backend = CacheSession"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L65_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L65_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L65_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L65_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L126_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L131_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L131_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L139_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L158_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L158_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L158_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L158_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L158_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L158_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L174_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L175_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L177_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L177_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L177_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L180_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L177_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L181_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L177_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L177_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L186_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L188_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L186_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L186_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L186_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L192_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L186_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L197_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L199_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L201_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L202_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L204_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L204_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L205_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L204_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L206_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L204_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L207_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L204_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L208_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L210_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L210_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L213_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L213_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L215_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L216_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L218_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L219_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L221_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L222_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L224_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L225_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L227_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L229_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L230_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L232_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L233_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L235_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L214_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L236_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:Try_L213_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L241_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L243_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L245_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L243_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L246_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L243_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L247_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L249_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L249_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L252_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L252_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L253_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L252_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L254_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L252_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Return_L255_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L249_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L257_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L249_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L258_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L249_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L259_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L264_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L267_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L269_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L272_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L274_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L272_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L276_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L276_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L276_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L279_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L276_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L280_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L272_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L282_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L283_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L284_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L285_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L272_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L287_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L287_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L289_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L287_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Expr_L290_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L293_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L295_C4"}] |
import time
from django.conf import settings
from django.utils.cache import patch_vary_headers
from django.utils.http import cookie_date
from django.utils.importlib import import_module
class SessionMiddleware(object):
def process_request(self, request):
engine = import_module(settings.SESSION_ENGINE)
session_key = request.COOKIES.get(settings.SESSION_COOKIE_NAME, None)
request.session = engine.SessionStore(session_key)
def process_response(self, request, response):
"""
If request.session was modified, or if the configuration is to save the
session every time, save the changes and set a session cookie.
"""
try:
accessed = request.session.accessed
modified = request.session.modified
except AttributeError:
pass
else:
if accessed:
patch_vary_headers(response, ('Cookie',))
if modified or settings.SESSION_SAVE_EVERY_REQUEST:
if request.session.get_expire_at_browser_close():
max_age = None
expires = None
else:
max_age = request.session.get_expiry_age()
expires_time = time.time() + max_age
expires = cookie_date(expires_time)
# Save the session data and refresh the client cookie.
request.session.save()
response.set_cookie(settings.SESSION_COOKIE_NAME,
request.session.session_key, max_age=max_age,
expires=expires, domain=settings.SESSION_COOKIE_DOMAIN,
path=settings.SESSION_COOKIE_PATH,
secure=settings.SESSION_COOKIE_SECURE or None)
return response
| ajibawa-2023/Python-Code-Large/train/row_98793 | 27 | 42 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98793:Import_L1_C0", "label": "time import time", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0238, 0.0238, 0, 0.66, 0.0, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:ImportFrom_L3_C0", "label": "from django.conf import settings", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0238, 0, 0.66, 0.2, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:ImportFrom_L4_C0", "label": "from django.utils.cache import patch_vary_headers", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0952, 0.0238, 0, 0.66, 0.4, 53, 0, 1, 0, 0, 53, 0, 0], "semantic": {"name": "django.utils.cache", "arg_names": [], "import_names": ["patch_vary_headers"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.cache import patch_vary_headers"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:ImportFrom_L5_C0", "label": "from django.utils.http import cookie_date", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.119, 0.0238, 0, 0.66, 0.6, 516, 0, 1, 0, 0, 516, 0, 0], "semantic": {"name": "django.utils.http", "arg_names": [], "import_names": ["cookie_date"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.http import cookie_date"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:ImportFrom_L6_C0", "label": "from django.utils.importlib import import_module", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0238, 0, 0.66, 0.8, 118, 0, 1, 0, 0, 118, 0, 0], "semantic": {"name": "django.utils.importlib", "arg_names": [], "import_names": ["import_module"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.importlib import import_module"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:ClassDef_L8_C0", "label": "SessionMiddleware", "type": "class", "loc": [8, 42], "level": 0, "parent": null, "vector": [3, 0, 0.5952, 0.8333, 0, 0.66, 1.0, 683, 0, 2, 0, 0, 186, 0, 10], "semantic": {"name": "SessionMiddleware", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SessionMiddleware(object):\n def process_request(self, request):\n engine = import_module(settings.SESSION_ENGINE)\n session_key = request.COOKIES.get(settings.SESSION_COOKIE_NAME, None)\n request.session = engine.SessionStore(session_key)\n\n def process_response(self, request, response):\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:FunctionDef_L9_C4", "label": "process_request", "type": "function", "loc": [9, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98793:ClassDef_L8_C0", "vector": [2, 1, 0.25, 0.0952, 1, 0.15, 0.0, 81, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "process_request", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def process_request(self, request):\n engine = import_module(settings.SESSION_ENGINE)\n session_key = request.COOKIES.get(settings.SESSION_COOKIE_NAME, None)\n request.session = engine.SessionStore(session_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:Assign_L10_C8", "label": "engine = import_module()", "type": "assigned_variable", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98793:FunctionDef_L9_C4", "vector": [14, 2, 0.2381, 0.0238, 2, 0.67, 0.0, 3, 3, 1, 0, 0, 637, 10, 1], "semantic": {"name": "engine", "arg_names": [], "import_names": [], "rhs_call_name": "import_module", "annotation": ""}, "snippet": " engine = import_module(settings.SESSION_ENGINE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:Assign_L11_C8", "label": "session_key = get()", "type": "assigned_variable", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98793:FunctionDef_L9_C4", "vector": [14, 2, 0.2619, 0.0238, 2, 0.67, 0.5, 555, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "session_key", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " session_key = request.COOKIES.get(settings.SESSION_COOKIE_NAME, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:Assign_L12_C8", "label": "request.session = SessionStore()", "type": "assigned_variable", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98793:FunctionDef_L9_C4", "vector": [14, 2, 0.2857, 0.0238, 2, 0.67, 1.0, 591, 3, 1, 0, 0, 951, 10, 1], "semantic": {"name": "request.session", "arg_names": [], "import_names": [], "rhs_call_name": "SessionStore", "annotation": ""}, "snippet": " request.session = engine.SessionStore(session_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:FunctionDef_L14_C4", "label": "process_response", "type": "function", "loc": [14, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98793:ClassDef_L8_C0", "vector": [2, 1, 0.6667, 0.6905, 1, 0.15, 1.0, 298, 0, 3, 1, 0, 0, 0, 7], "semantic": {"name": "process_response", "arg_names": ["self", "request", "response"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def process_response(self, request, response):\n \"\"\"\n If request.session was modified, or if the configuration is to save the\n session every time, save the changes and set a session cookie.\n \"\"\"\n try:\n accessed = request.session.accessed\n modified = request.session.modified"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:Expr_L15_C8", "label": "expression", "type": "expression", "loc": [15, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98793:FunctionDef_L14_C4", "vector": [8, 2, 0.3929, 0.0952, 2, 0.51, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n If request.session was modified, or if the configuration is to save the\n session every time, save the changes and set a session cookie.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:Try_L19_C8", "label": "try", "type": "try", "loc": [19, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98793:FunctionDef_L14_C4", "vector": [7, 2, 0.7143, 0.5476, 2, 0.51, 0.5, 0, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n accessed = request.session.accessed\n modified = request.session.modified\n except AttributeError:\n pass\n else:\n if accessed:\n patch_vary_headers(response, ('Cookie',))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:Assign_L20_C12", "label": "accessed =", "type": "assigned_variable", "loc": [20, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98793:Try_L19_C8", "vector": [14, 3, 0.4762, 0.0238, 3, 0.83, 0.0, 981, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "accessed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " accessed = request.session.accessed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:Assign_L21_C12", "label": "modified =", "type": "assigned_variable", "loc": [21, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98793:Try_L19_C8", "vector": [14, 3, 0.5, 0.0238, 3, 0.83, 0.3333, 150, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "modified", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " modified = request.session.modified"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:If_L25_C12", "label": "if", "type": "if", "loc": [25, 26], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98793:Try_L19_C8", "vector": [4, 3, 0.6071, 0.0476, 3, 0.83, 0.6667, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if accessed:\n patch_vary_headers(response, ('Cookie',))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:Expr_L26_C16", "label": "patch_vary_headers()", "type": "expression", "loc": [26, 26], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98793:If_L25_C12", "vector": [8, 4, 0.619, 0.0238, 4, 0.48, 0.0, 726, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "patch_vary_headers", "arg_names": [], "import_names": [], "rhs_call_name": "patch_vary_headers", "annotation": ""}, "snippet": " patch_vary_headers(response, ('Cookie',))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:If_L27_C12", "label": "if", "type": "if", "loc": [27, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98793:Try_L19_C8", "vector": [4, 3, 0.8095, 0.3571, 3, 0.83, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if modified or settings.SESSION_SAVE_EVERY_REQUEST:\n if request.session.get_expire_at_browser_close():\n max_age = None\n expires = None\n else:\n max_age = request.session.get_expiry_age()\n expires_time = time.time() + max_age\n expires = cookie_date(expires_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:If_L28_C16", "label": "if", "type": "if", "loc": [28, 34], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98793:If_L27_C12", "vector": [4, 4, 0.7381, 0.1667, 4, 0.83, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.session.get_expire_at_browser_close():\n max_age = None\n expires = None\n else:\n max_age = request.session.get_expiry_age()\n expires_time = time.time() + max_age\n expires = cookie_date(expires_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:Assign_L29_C20", "label": "max_age =", "type": "assigned_variable", "loc": [29, 29], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98793:If_L28_C16", "vector": [14, 5, 0.6905, 0.0238, 5, 0.62, 0.0, 674, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "max_age", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " max_age = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:Assign_L30_C20", "label": "expires =", "type": "assigned_variable", "loc": [30, 30], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98793:If_L28_C16", "vector": [14, 5, 0.7143, 0.0238, 5, 0.62, 0.25, 741, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "expires", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expires = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:Assign_L32_C20", "label": "max_age = get_expiry_age()", "type": "assigned_variable", "loc": [32, 32], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98793:If_L28_C16", "vector": [14, 5, 0.7619, 0.0238, 5, 0.62, 0.5, 674, 3, 0, 0, 0, 94, 10, 1], "semantic": {"name": "max_age", "arg_names": [], "import_names": [], "rhs_call_name": "get_expiry_age", "annotation": ""}, "snippet": " max_age = request.session.get_expiry_age()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:Assign_L33_C20", "label": "expires_time =", "type": "assigned_variable", "loc": [33, 33], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98793:If_L28_C16", "vector": [14, 5, 0.7857, 0.0238, 5, 0.62, 0.75, 326, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "expires_time", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expires_time = time.time() + max_age"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:Assign_L34_C20", "label": "expires = cookie_date()", "type": "assigned_variable", "loc": [34, 34], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_98793:If_L28_C16", "vector": [14, 5, 0.8095, 0.0238, 5, 0.62, 1.0, 741, 3, 1, 0, 0, 577, 10, 1], "semantic": {"name": "expires", "arg_names": [], "import_names": [], "rhs_call_name": "cookie_date", "annotation": ""}, "snippet": " expires = cookie_date(expires_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:Expr_L36_C16", "label": "save()", "type": "expression", "loc": [36, 36], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98793:If_L27_C12", "vector": [8, 4, 0.8571, 0.0238, 4, 0.83, 0.5, 928, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " request.session.save()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:Expr_L37_C16", "label": "set_cookie()", "type": "expression", "loc": [37, 41], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98793:If_L27_C12", "vector": [8, 4, 0.9286, 0.119, 4, 0.83, 1.0, 146, 3, 7, 0, 0, 0, 0, 1], "semantic": {"name": "set_cookie", "arg_names": [], "import_names": [], "rhs_call_name": "set_cookie", "annotation": ""}, "snippet": " response.set_cookie(settings.SESSION_COOKIE_NAME,\n request.session.session_key, max_age=max_age,\n expires=expires, domain=settings.SESSION_COOKIE_DOMAIN,\n path=settings.SESSION_COOKIE_PATH,\n secure=settings.SESSION_COOKIE_SECURE or None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98793:Return_L42_C8", "label": "return", "type": "return", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98793:FunctionDef_L14_C4", "vector": [13, 2, 1.0, 0.0238, 2, 0.51, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98793:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98793:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98793:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98793:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98793:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98793:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98793:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98793:Assign_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98793:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98793:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98793:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98793:Expr_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98793:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98793:Try_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98793:Try_L19_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98793:Assign_L20_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98793:Try_L19_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98793:Assign_L21_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98793:Try_L19_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98793:If_L25_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98793:If_L25_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98793:Expr_L26_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98793:Try_L19_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98793:If_L27_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98793:If_L27_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98793:If_L28_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98793:If_L28_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98793:Assign_L29_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98793:If_L28_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98793:Assign_L30_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98793:If_L28_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98793:Assign_L32_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98793:If_L28_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98793:Assign_L33_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98793:If_L28_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_98793:Assign_L34_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98793:If_L27_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98793:Expr_L36_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98793:If_L27_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98793:Expr_L37_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98793:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98793:Return_L42_C8"}] |
import datetime
from django.conf import settings
from django.contrib.sessions.models import Session
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.core.exceptions import SuspiciousOperation
from django.db import IntegrityError, transaction, router
from django.utils.encoding import force_unicode
class SessionStore(SessionBase):
"""
Implements database session store.
"""
def __init__(self, session_key=None):
super(SessionStore, self).__init__(session_key)
def load(self):
try:
s = Session.objects.get(
session_key = self.session_key,
expire_date__gt=datetime.datetime.now()
)
return self.decode(force_unicode(s.session_data))
except (Session.DoesNotExist, SuspiciousOperation):
self.create()
return {}
def exists(self, session_key):
try:
Session.objects.get(session_key=session_key)
except Session.DoesNotExist:
return False
return True
def create(self):
while True:
self.session_key = self._get_new_session_key()
try:
# Save immediately to ensure we have a unique entry in the
# database.
self.save(must_create=True)
except CreateError:
# Key wasn't unique. Try again.
continue
self.modified = True
self._session_cache = {}
return
def save(self, must_create=False):
"""
Saves the current session data to the database. If 'must_create' is
True, a database error will be raised if the saving operation doesn't
create a *new* entry (as opposed to possibly updating an existing
entry).
"""
obj = Session(
session_key = self.session_key,
session_data = self.encode(self._get_session(no_load=must_create)),
expire_date = self.get_expiry_date()
)
using = router.db_for_write(Session, instance=obj)
sid = transaction.savepoint(using=using)
try:
obj.save(force_insert=must_create, using=using)
except IntegrityError:
if must_create:
transaction.savepoint_rollback(sid, using=using)
raise CreateError
raise
def delete(self, session_key=None):
if session_key is None:
if self._session_key is None:
return
session_key = self._session_key
try:
Session.objects.get(session_key=session_key).delete()
except Session.DoesNotExist:
pass
| ajibawa-2023/Python-Code-Large/train/row_98795 | 46 | 78 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0128, 0.0128, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetime"], "rhs_call_name": "", "annotation": ""}, "snippet": "import datetime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:ImportFrom_L2_C0", "label": "from django.conf import settings", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0256, 0.0128, 0, 0.66, 0.1429, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:ImportFrom_L3_C0", "label": "from django.contrib.sessions.models import Session", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0385, 0.0128, 0, 0.66, 0.2857, 800, 0, 1, 0, 0, 800, 0, 0], "semantic": {"name": "django.contrib.sessions.models", "arg_names": [], "import_names": ["Session"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.sessions.models import Session"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:ImportFrom_L4_C0", "label": "from django.contrib.sessions.backends.base import SessionBase, CreateError", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0513, 0.0128, 0, 0.66, 0.4286, 907, 0, 2, 0, 0, 907, 0, 0], "semantic": {"name": "django.contrib.sessions.backends.base", "arg_names": [], "import_names": ["SessionBase", "CreateError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.sessions.backends.base import SessionBase, CreateError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:ImportFrom_L5_C0", "label": "from django.core.exceptions import SuspiciousOperation", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0641, 0.0128, 0, 0.66, 0.5714, 160, 0, 1, 0, 0, 160, 0, 0], "semantic": {"name": "django.core.exceptions", "arg_names": [], "import_names": ["SuspiciousOperation"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.exceptions import SuspiciousOperation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:ImportFrom_L6_C0", "label": "from django.db import IntegrityError, transaction, router", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0128, 0, 0.66, 0.7143, 40, 0, 3, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["IntegrityError", "transaction", "router"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db import IntegrityError, transaction, router"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:ImportFrom_L7_C0", "label": "from django.utils.encoding import force_unicode", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0897, 0.0128, 0, 0.66, 0.8571, 96, 0, 1, 0, 0, 96, 0, 0], "semantic": {"name": "django.utils.encoding", "arg_names": [], "import_names": ["force_unicode"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.encoding import force_unicode"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:ClassDef_L9_C0", "label": "SessionStore", "type": "class", "loc": [9, 78], "level": 0, "parent": null, "vector": [3, 0, 0.5577, 0.8974, 0, 0.66, 1.0, 951, 0, 6, 0, 0, 324, 0, 20], "semantic": {"name": "SessionStore", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SessionStore(SessionBase):\n \"\"\"\n Implements database session store.\n \"\"\"\n def __init__(self, session_key=None):\n super(SessionStore, self).__init__(session_key)\n\n def load(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Expr_L10_C4", "label": "expression", "type": "expression", "loc": [10, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:ClassDef_L9_C0", "vector": [8, 1, 0.141, 0.0385, 1, 0.19, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Implements database session store.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L13_C4", "label": "__init__", "type": "function", "loc": [13, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:ClassDef_L9_C0", "vector": [2, 1, 0.1731, 0.0256, 1, 0.19, 0.1667, 555, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "session_key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, session_key=None):\n super(SessionStore, self).__init__(session_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Expr_L14_C8", "label": "__init__()", "type": "expression", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L13_C4", "vector": [8, 2, 0.1795, 0.0128, 2, 0.16, 0.0, 555, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(SessionStore, self).__init__(session_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L16_C4", "label": "load", "type": "function", "loc": [16, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:ClassDef_L9_C0", "vector": [2, 1, 0.2628, 0.1282, 1, 0.19, 0.3333, 37, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "load", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def load(self):\n try:\n s = Session.objects.get(\n session_key = self.session_key,\n expire_date__gt=datetime.datetime.now()\n )\n return self.decode(force_unicode(s.session_data))\n except (Session.DoesNotExist, SuspiciousOperation):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L17_C8", "label": "try", "type": "try", "loc": [17, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L16_C4", "vector": [7, 2, 0.2692, 0.1154, 2, 0.32, 0.0, 0, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n s = Session.objects.get(\n session_key = self.session_key,\n expire_date__gt=datetime.datetime.now()\n )\n return self.decode(force_unicode(s.session_data))\n except (Session.DoesNotExist, SuspiciousOperation):\n self.create()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Assign_L18_C12", "label": "s = get()", "type": "assigned_variable", "loc": [18, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L17_C8", "vector": [14, 3, 0.25, 0.0513, 3, 0.06, 0.0, 553, 3, 2, 0, 0, 607, 10, 2], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " s = Session.objects.get(\n session_key = self.session_key,\n expire_date__gt=datetime.datetime.now()\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Return_L22_C12", "label": "return", "type": "return", "loc": [22, 22], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L17_C8", "vector": [13, 3, 0.2821, 0.0128, 3, 0.06, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.decode(force_unicode(s.session_data))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Expr_L24_C12", "label": "create()", "type": "expression", "loc": [24, 24], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L17_C8", "vector": [8, 3, 0.3077, 0.0128, 3, 0.06, 0.0, 316, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "create", "arg_names": [], "import_names": [], "rhs_call_name": "create", "annotation": ""}, "snippet": " self.create()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Return_L25_C12", "label": "return", "type": "return", "loc": [25, 25], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L17_C8", "vector": [13, 3, 0.3205, 0.0128, 3, 0.06, 1.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L27_C4", "label": "exists", "type": "function", "loc": [27, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:ClassDef_L9_C0", "vector": [2, 1, 0.3782, 0.0769, 1, 0.19, 0.5, 829, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "exists", "arg_names": ["self", "session_key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def exists(self, session_key):\n try:\n Session.objects.get(session_key=session_key)\n except Session.DoesNotExist:\n return False\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L28_C8", "label": "try", "type": "try", "loc": [28, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L27_C4", "vector": [7, 2, 0.3782, 0.0513, 2, 0.75, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n Session.objects.get(session_key=session_key)\n except Session.DoesNotExist:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Expr_L29_C12", "label": "get()", "type": "expression", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L28_C8", "vector": [8, 3, 0.3718, 0.0128, 3, 0.31, 0.0, 607, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "get", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " Session.objects.get(session_key=session_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Return_L31_C12", "label": "return", "type": "return", "loc": [31, 31], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L28_C8", "vector": [13, 3, 0.3974, 0.0128, 3, 0.31, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Return_L32_C8", "label": "return", "type": "return", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L27_C4", "vector": [13, 2, 0.4103, 0.0128, 2, 0.75, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L34_C4", "label": "create", "type": "function", "loc": [34, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:ClassDef_L9_C0", "vector": [2, 1, 0.5128, 0.1667, 1, 0.19, 0.6667, 316, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "create", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def create(self):\n while True:\n self.session_key = self._get_new_session_key()\n try:\n # Save immediately to ensure we have a unique entry in the\n # database.\n self.save(must_create=True)\n except CreateError:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:While_L35_C8", "label": "while", "type": "while", "loc": [35, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L34_C4", "vector": [5, 2, 0.5192, 0.1538, 2, 0.79, 0.0, 0, 1, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n self.session_key = self._get_new_session_key()\n try:\n # Save immediately to ensure we have a unique entry in the\n # database.\n self.save(must_create=True)\n except CreateError:\n # Key wasn't unique. Try again."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Assign_L36_C12", "label": "self.session_key = _get_new_session_key()", "type": "assigned_variable", "loc": [36, 36], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:While_L35_C8", "vector": [14, 3, 0.4615, 0.0128, 3, 0.2, 0.0, 113, 3, 0, 0, 0, 936, 10, 1], "semantic": {"name": "self.session_key", "arg_names": [], "import_names": [], "rhs_call_name": "_get_new_session_key", "annotation": ""}, "snippet": " self.session_key = self._get_new_session_key()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L37_C12", "label": "try", "type": "try", "loc": [37, 43], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:While_L35_C8", "vector": [7, 3, 0.5128, 0.0897, 3, 0.2, 0.25, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # Save immediately to ensure we have a unique entry in the\n # database.\n self.save(must_create=True)\n except CreateError:\n # Key wasn't unique. Try again.\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Expr_L40_C16", "label": "save()", "type": "expression", "loc": [40, 40], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L37_C12", "vector": [8, 4, 0.5128, 0.0128, 4, 0.21, 0.0, 928, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " self.save(must_create=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Assign_L44_C12", "label": "self.modified =", "type": "assigned_variable", "loc": [44, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:While_L35_C8", "vector": [14, 3, 0.5641, 0.0128, 3, 0.2, 0.5, 763, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.modified", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.modified = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Assign_L45_C12", "label": "self._session_cache =", "type": "assigned_variable", "loc": [45, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:While_L35_C8", "vector": [14, 3, 0.5769, 0.0128, 3, 0.2, 0.75, 37, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self._session_cache", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._session_cache = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Return_L46_C12", "label": "return", "type": "return", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:While_L35_C8", "vector": [13, 3, 0.5897, 0.0128, 3, 0.2, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L48_C4", "label": "save", "type": "function", "loc": [48, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:ClassDef_L9_C0", "vector": [2, 1, 0.7436, 0.2692, 1, 0.19, 0.8333, 928, 0, 2, 0, 0, 0, 0, 8], "semantic": {"name": "save", "arg_names": ["self", "must_create"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def save(self, must_create=False):\n \"\"\"\n Saves the current session data to the database. If 'must_create' is\n True, a database error will be raised if the saving operation doesn't\n create a *new* entry (as opposed to possibly updating an existing\n entry).\n \"\"\"\n obj = Session("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Expr_L49_C8", "label": "expression", "type": "expression", "loc": [49, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L48_C4", "vector": [8, 2, 0.6603, 0.0769, 2, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Saves the current session data to the database. If 'must_create' is\n True, a database error will be raised if the saving operation doesn't\n create a *new* entry (as opposed to possibly updating an existing\n entry).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Assign_L55_C8", "label": "obj = Session()", "type": "assigned_variable", "loc": [55, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L48_C4", "vector": [14, 2, 0.7308, 0.0641, 2, 0.94, 0.25, 505, 3, 3, 0, 0, 712, 10, 4], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "Session", "annotation": ""}, "snippet": " obj = Session(\n session_key = self.session_key,\n session_data = self.encode(self._get_session(no_load=must_create)),\n expire_date = self.get_expiry_date()\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Assign_L60_C8", "label": "using = db_for_write()", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L48_C4", "vector": [14, 2, 0.7692, 0.0128, 2, 0.94, 0.5, 699, 3, 2, 0, 0, 395, 10, 1], "semantic": {"name": "using", "arg_names": [], "import_names": [], "rhs_call_name": "db_for_write", "annotation": ""}, "snippet": " using = router.db_for_write(Session, instance=obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Assign_L61_C8", "label": "sid = savepoint()", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L48_C4", "vector": [14, 2, 0.7821, 0.0128, 2, 0.94, 0.75, 440, 3, 1, 0, 0, 525, 10, 1], "semantic": {"name": "sid", "arg_names": [], "import_names": [], "rhs_call_name": "savepoint", "annotation": ""}, "snippet": " sid = transaction.savepoint(using=using)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L62_C8", "label": "try", "type": "try", "loc": [62, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L48_C4", "vector": [7, 2, 0.8333, 0.0897, 2, 0.94, 1.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n obj.save(force_insert=must_create, using=using)\n except IntegrityError:\n if must_create:\n transaction.savepoint_rollback(sid, using=using)\n raise CreateError\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Expr_L63_C12", "label": "save()", "type": "expression", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L62_C8", "vector": [8, 3, 0.8077, 0.0128, 3, 0.46, 0.0, 928, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " obj.save(force_insert=must_create, using=using)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:If_L65_C12", "label": "if", "type": "if", "loc": [65, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L62_C8", "vector": [4, 3, 0.8462, 0.0385, 3, 0.46, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if must_create:\n transaction.savepoint_rollback(sid, using=using)\n raise CreateError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Expr_L66_C16", "label": "savepoint_rollback()", "type": "expression", "loc": [66, 66], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:If_L65_C12", "vector": [8, 4, 0.8462, 0.0128, 4, 0.05, 0.0, 417, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "savepoint_rollback", "arg_names": [], "import_names": [], "rhs_call_name": "savepoint_rollback", "annotation": ""}, "snippet": " transaction.savepoint_rollback(sid, using=using)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L70_C4", "label": "delete", "type": "function", "loc": [70, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:ClassDef_L9_C0", "vector": [2, 1, 0.9487, 0.1154, 1, 0.19, 1.0, 266, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "delete", "arg_names": ["self", "session_key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def delete(self, session_key=None):\n if session_key is None:\n if self._session_key is None:\n return\n session_key = self._session_key\n try:\n Session.objects.get(session_key=session_key).delete()\n except Session.DoesNotExist:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:If_L71_C8", "label": "if", "type": "if", "loc": [71, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L70_C4", "vector": [4, 2, 0.9295, 0.0513, 2, 0.24, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if session_key is None:\n if self._session_key is None:\n return\n session_key = self._session_key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:If_L72_C12", "label": "if", "type": "if", "loc": [72, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:If_L71_C8", "vector": [4, 3, 0.9295, 0.0256, 3, 0.32, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._session_key is None:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Return_L73_C16", "label": "return", "type": "return", "loc": [73, 73], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:If_L72_C12", "vector": [13, 4, 0.9359, 0.0128, 4, 0.17, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Assign_L74_C12", "label": "session_key =", "type": "assigned_variable", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:If_L71_C8", "vector": [14, 3, 0.9487, 0.0128, 3, 0.32, 1.0, 555, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "session_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " session_key = self._session_key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L75_C8", "label": "try", "type": "try", "loc": [75, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L70_C4", "vector": [7, 2, 0.9808, 0.0513, 2, 0.24, 1.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n Session.objects.get(session_key=session_key).delete()\n except Session.DoesNotExist:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98795:Expr_L76_C12", "label": "delete()", "type": "expression", "loc": [76, 76], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L75_C8", "vector": [8, 3, 0.9744, 0.0128, 3, 0.05, 0.0, 266, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " Session.objects.get(session_key=session_key).delete()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98795:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Expr_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L17_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Assign_L18_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L17_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Return_L22_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L17_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Expr_L24_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L17_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Return_L25_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Expr_L29_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Return_L31_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Return_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:While_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:While_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Assign_L36_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:While_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L37_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L37_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Expr_L40_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:While_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Assign_L44_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:While_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Assign_L45_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:While_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Return_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Expr_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Expr_L63_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:If_L65_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:If_L65_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Expr_L66_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:If_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:If_L71_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:If_L72_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:If_L72_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Return_L73_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:If_L71_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Assign_L74_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:Try_L75_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Expr_L76_C12"}] |
import base64
import os
import random
import sys
import time
from datetime import datetime, timedelta
try:
import cPickle as pickle
except ImportError:
import pickle
from django.conf import settings
from django.core.exceptions import SuspiciousOperation
from django.utils.hashcompat import md5_constructor
from django.utils.crypto import constant_time_compare, salted_hmac
# Use the system (hardware-based) random number generator if it exists.
if hasattr(random, 'SystemRandom'):
randrange = random.SystemRandom().randrange
else:
randrange = random.randrange
MAX_SESSION_KEY = 18446744073709551616L # 2 << 63
class CreateError(Exception):
"""
Used internally as a consistent exception type to catch from save (see the
docstring for SessionBase.save() for details).
"""
pass
class SessionBase(object):
"""
Base class for all Session classes.
"""
TEST_COOKIE_NAME = 'testcookie'
TEST_COOKIE_VALUE = 'worked'
def __init__(self, session_key=None):
self._session_key = session_key
self.accessed = False
self.modified = False
def __contains__(self, key):
return key in self._session
def __getitem__(self, key):
return self._session[key]
def __setitem__(self, key, value):
self._session[key] = value
self.modified = True
def __delitem__(self, key):
del self._session[key]
self.modified = True
def keys(self):
return self._session.keys()
def items(self):
return self._session.items()
def get(self, key, default=None):
return self._session.get(key, default)
def pop(self, key, *args):
self.modified = self.modified or key in self._session
return self._session.pop(key, *args)
def setdefault(self, key, value):
if key in self._session:
return self._session[key]
else:
self.modified = True
self._session[key] = value
return value
def set_test_cookie(self):
self[self.TEST_COOKIE_NAME] = self.TEST_COOKIE_VALUE
def test_cookie_worked(self):
return self.get(self.TEST_COOKIE_NAME) == self.TEST_COOKIE_VALUE
def delete_test_cookie(self):
del self[self.TEST_COOKIE_NAME]
def _hash(self, value):
key_salt = "django.contrib.sessions" + self.__class__.__name__
return salted_hmac(key_salt, value).hexdigest()
def encode(self, session_dict):
"Returns the given session dictionary pickled and encoded as a string."
pickled = pickle.dumps(session_dict, pickle.HIGHEST_PROTOCOL)
hash = self._hash(pickled)
return base64.encodestring(hash + ":" + pickled)
def decode(self, session_data):
encoded_data = base64.decodestring(session_data)
try:
# could produce ValueError if there is no ':'
hash, pickled = encoded_data.split(':', 1)
expected_hash = self._hash(pickled)
if not constant_time_compare(hash, expected_hash):
raise SuspiciousOperation("Session data corrupted")
else:
return pickle.loads(pickled)
except Exception:
# ValueError, SuspiciousOperation, unpickling exceptions
# Fall back to Django 1.2 method
# PendingDeprecationWarning <- here to remind us to
# remove this fallback in Django 1.5
try:
return self._decode_old(session_data)
except Exception:
# Unpickling can cause a variety of exceptions. If something happens,
# just return an empty dictionary (an empty session).
return {}
def _decode_old(self, session_data):
encoded_data = base64.decodestring(session_data)
pickled, tamper_check = encoded_data[:-32], encoded_data[-32:]
if not constant_time_compare(md5_constructor(pickled + settings.SECRET_KEY).hexdigest(),
tamper_check):
raise SuspiciousOperation("User tampered with session cookie.")
return pickle.loads(pickled)
def update(self, dict_):
self._session.update(dict_)
self.modified = True
def has_key(self, key):
return self._session.has_key(key)
def values(self):
return self._session.values()
def iterkeys(self):
return self._session.iterkeys()
def itervalues(self):
return self._session.itervalues()
def iteritems(self):
return self._session.iteritems()
def clear(self):
# To avoid unnecessary persistent storage accesses, we set up the
# internals directly (loading data wastes time, since we are going to
# set it to an empty dict anyway).
self._session_cache = {}
self.accessed = True
self.modified = True
def _get_new_session_key(self):
"Returns session key that isn't being used."
# The random module is seeded when this Apache child is created.
# Use settings.SECRET_KEY as added salt.
try:
pid = os.getpid()
except AttributeError:
# No getpid() in Jython, for example
pid = 1
while 1:
session_key = md5_constructor("%s%s%s%s"
% (randrange(0, MAX_SESSION_KEY), pid, time.time(),
settings.SECRET_KEY)).hexdigest()
if not self.exists(session_key):
break
return session_key
def _get_session_key(self):
if self._session_key:
return self._session_key
else:
self._session_key = self._get_new_session_key()
return self._session_key
def _set_session_key(self, session_key):
self._session_key = session_key
session_key = property(_get_session_key, _set_session_key)
def _get_session(self, no_load=False):
"""
Lazily loads session from storage (unless "no_load" is True, when only
an empty dict is stored) and stores it in the current instance.
"""
self.accessed = True
try:
return self._session_cache
except AttributeError:
if self._session_key is None or no_load:
self._session_cache = {}
else:
self._session_cache = self.load()
return self._session_cache
_session = property(_get_session)
def get_expiry_age(self):
"""Get the number of seconds until the session expires."""
expiry = self.get('_session_expiry')
if not expiry: # Checks both None and 0 cases
return settings.SESSION_COOKIE_AGE
if not isinstance(expiry, datetime):
return expiry
delta = expiry - datetime.now()
return delta.days * 86400 + delta.seconds
def get_expiry_date(self):
"""Get session the expiry date (as a datetime object)."""
expiry = self.get('_session_expiry')
if isinstance(expiry, datetime):
return expiry
if not expiry: # Checks both None and 0 cases
expiry = settings.SESSION_COOKIE_AGE
return datetime.now() + timedelta(seconds=expiry)
def set_expiry(self, value):
"""
Sets a custom expiration for the session. ``value`` can be an integer,
a Python ``datetime`` or ``timedelta`` object or ``None``.
If ``value`` is an integer, the session will expire after that many
seconds of inactivity. If set to ``0`` then the session will expire on
browser close.
If ``value`` is a ``datetime`` or ``timedelta`` object, the session
will expire at that specific future time.
If ``value`` is ``None``, the session uses the global session expiry
policy.
"""
if value is None:
# Remove any custom expiration for this session.
try:
del self['_session_expiry']
except KeyError:
pass
return
if isinstance(value, timedelta):
value = datetime.now() + value
self['_session_expiry'] = value
def get_expire_at_browser_close(self):
"""
Returns ``True`` if the session is set to expire when the browser
closes, and ``False`` if there's an expiry date. Use
``get_expiry_date()`` or ``get_expiry_age()`` to find the actual expiry
date/age, if there is one.
"""
if self.get('_session_expiry') is None:
return settings.SESSION_EXPIRE_AT_BROWSER_CLOSE
return self.get('_session_expiry') == 0
def flush(self):
"""
Removes the current session data from the database and regenerates the
key.
"""
self.clear()
self.delete()
self.create()
def cycle_key(self):
"""
Creates a new session key, whilst retaining the current session data.
"""
data = self._session_cache
key = self.session_key
self.create()
self._session_cache = data
self.delete(key)
# Methods that child classes must implement.
def exists(self, session_key):
"""
Returns True if the given session_key already exists.
"""
raise NotImplementedError
def create(self):
"""
Creates a new session instance. Guaranteed to create a new object with
a unique key and will have saved the result once (with empty data)
before the method returns.
"""
raise NotImplementedError
def save(self, must_create=False):
"""
Saves the session data. If 'must_create' is True, a new session object
is created (otherwise a CreateError exception is raised). Otherwise,
save() can update an existing object with the same key.
"""
raise NotImplementedError
def delete(self, session_key=None):
"""
Deletes the session data under this key. If the key is None, the
current session key value is used.
"""
raise NotImplementedError
def load(self):
"""
Loads the session data and returns a dictionary.
"""
raise NotImplementedError
| ajibawa-2023/Python-Code-Large/train/row_98796 | 174 | 309 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Import_L1_C0", "label": "base64 import base64", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0032, 0.0032, 0, 0.66, 0.0, 177, 0, 1, 0, 0, 177, 0, 0], "semantic": {"name": "base64", "arg_names": [], "import_names": ["base64"], "rhs_call_name": "", "annotation": ""}, "snippet": "import base64"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Import_L2_C0", "label": "os import os", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0065, 0.0032, 0, 0.66, 0.0769, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Import_L3_C0", "label": "random import random", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0097, 0.0032, 0, 0.66, 0.1538, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["random"], "rhs_call_name": "", "annotation": ""}, "snippet": "import random"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Import_L4_C0", "label": "sys import sys", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0129, 0.0032, 0, 0.66, 0.2308, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Import_L5_C0", "label": "time import time", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0162, 0.0032, 0, 0.66, 0.3077, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:ImportFrom_L6_C0", "label": "from datetime import datetime, timedelta", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0194, 0.0032, 0, 0.66, 0.3846, 426, 0, 2, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetime", "timedelta"], "rhs_call_name": "", "annotation": ""}, "snippet": "from datetime import datetime, timedelta"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L7_C0", "label": "try", "type": "try", "loc": [7, 10], "level": 0, "parent": null, "vector": [7, 0, 0.0275, 0.0129, 0, 0.66, 0.4615, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n import cPickle as pickle\nexcept ImportError:\n import pickle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Import_L8_C4", "label": "cPickle import pickle", "type": "import", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L7_C0", "vector": [1, 1, 0.0259, 0.0032, 1, 0.32, 0.0, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "cPickle", "arg_names": [], "import_names": ["pickle"], "rhs_call_name": "", "annotation": ""}, "snippet": " import cPickle as pickle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Import_L10_C4", "label": "pickle import pickle", "type": "import", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L7_C0", "vector": [1, 1, 0.0324, 0.0032, 1, 0.32, 0.0, 848, 0, 1, 0, 0, 848, 0, 0], "semantic": {"name": "pickle", "arg_names": [], "import_names": ["pickle"], "rhs_call_name": "", "annotation": ""}, "snippet": " import pickle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:ImportFrom_L12_C0", "label": "from django.conf import settings", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0388, 0.0032, 0, 0.66, 0.5385, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:ImportFrom_L13_C0", "label": "from django.core.exceptions import SuspiciousOperation", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0421, 0.0032, 0, 0.66, 0.6154, 160, 0, 1, 0, 0, 160, 0, 0], "semantic": {"name": "django.core.exceptions", "arg_names": [], "import_names": ["SuspiciousOperation"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.exceptions import SuspiciousOperation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:ImportFrom_L14_C0", "label": "from django.utils.hashcompat import md5_constructor", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0453, 0.0032, 0, 0.66, 0.6923, 474, 0, 1, 0, 0, 474, 0, 0], "semantic": {"name": "django.utils.hashcompat", "arg_names": [], "import_names": ["md5_constructor"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.hashcompat import md5_constructor"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:ImportFrom_L15_C0", "label": "from django.utils.crypto import constant_time_compare, salted_hmac", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0485, 0.0032, 0, 0.66, 0.7692, 657, 0, 2, 0, 0, 657, 0, 0], "semantic": {"name": "django.utils.crypto", "arg_names": [], "import_names": ["constant_time_compare", "salted_hmac"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.crypto import constant_time_compare, salted_hmac"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L18_C0", "label": "if", "type": "if", "loc": [18, 21], "level": 0, "parent": null, "vector": [4, 0, 0.0631, 0.0129, 0, 0.66, 0.8462, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if hasattr(random, 'SystemRandom'):\n randrange = random.SystemRandom().randrange\nelse:\n randrange = random.randrange"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L19_C4", "label": "randrange =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L18_C0", "vector": [14, 1, 0.0615, 0.0032, 1, 0.53, 0.0, 28, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "randrange", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " randrange = random.SystemRandom().randrange"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L21_C4", "label": "randrange =", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L18_C0", "vector": [14, 1, 0.068, 0.0032, 1, 0.53, 1.0, 28, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "randrange", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " randrange = random.randrange"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L23_C0", "label": "CreateError", "type": "class", "loc": [23, 28], "level": 0, "parent": null, "vector": [3, 0, 0.0825, 0.0194, 0, 0.66, 0.9231, 124, 0, 0, 0, 0, 645, 0, 0], "semantic": {"name": "CreateError", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CreateError(Exception):\n \"\"\"\n Used internally as a consistent exception type to catch from save (see the\n docstring for SessionBase.save() for details).\n \"\"\"\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L24_C4", "label": "expression", "type": "expression", "loc": [24, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L23_C0", "vector": [8, 1, 0.0825, 0.0129, 1, 0.16, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Used internally as a consistent exception type to catch from save (see the\n docstring for SessionBase.save() for details).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "label": "SessionBase", "type": "class", "loc": [30, 309], "level": 0, "parent": null, "vector": [3, 0, 0.5485, 0.9061, 0, 0.66, 1.0, 324, 0, 39, 0, 0, 186, 0, 55], "semantic": {"name": "SessionBase", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SessionBase(object):\n \"\"\"\n Base class for all Session classes.\n \"\"\"\n TEST_COOKIE_NAME = 'testcookie'\n TEST_COOKIE_VALUE = 'worked'\n\n def __init__(self, session_key=None):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L31_C4", "label": "expression", "type": "expression", "loc": [31, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [8, 1, 0.1036, 0.0097, 1, 0.95, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Base class for all Session classes.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L34_C4", "label": "TEST_COOKIE_NAME =", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [14, 1, 0.11, 0.0032, 1, 0.95, 0.0233, 504, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TEST_COOKIE_NAME", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " TEST_COOKIE_NAME = 'testcookie'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L35_C4", "label": "TEST_COOKIE_VALUE =", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [14, 1, 0.1133, 0.0032, 1, 0.95, 0.0465, 310, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TEST_COOKIE_VALUE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " TEST_COOKIE_VALUE = 'worked'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L37_C4", "label": "__init__", "type": "function", "loc": [37, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.1246, 0.0129, 1, 0.95, 0.0698, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "session_key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, session_key=None):\n self._session_key = session_key\n self.accessed = False\n self.modified = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L38_C8", "label": "self._session_key =", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L37_C4", "vector": [14, 2, 0.123, 0.0032, 2, 0.24, 0.0, 987, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._session_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._session_key = session_key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L39_C8", "label": "self.accessed =", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L37_C4", "vector": [14, 2, 0.1262, 0.0032, 2, 0.24, 0.5, 453, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.accessed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.accessed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L40_C8", "label": "self.modified =", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L37_C4", "vector": [14, 2, 0.1294, 0.0032, 2, 0.24, 1.0, 763, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.modified", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.modified = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L42_C4", "label": "__contains__", "type": "function", "loc": [42, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.1375, 0.0065, 1, 0.95, 0.093, 456, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__contains__", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __contains__(self, key):\n return key in self._session"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L43_C8", "label": "return", "type": "return", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L42_C4", "vector": [13, 2, 0.1392, 0.0032, 2, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return key in self._session"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L45_C4", "label": "__getitem__", "type": "function", "loc": [45, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.1472, 0.0065, 1, 0.95, 0.1163, 698, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__getitem__", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getitem__(self, key):\n return self._session[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L46_C8", "label": "return", "type": "return", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L45_C4", "vector": [13, 2, 0.1489, 0.0032, 2, 0.54, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._session[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L48_C4", "label": "__setitem__", "type": "function", "loc": [48, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.1586, 0.0097, 1, 0.95, 0.1395, 343, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__setitem__", "arg_names": ["self", "key", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __setitem__(self, key, value):\n self._session[key] = value\n self.modified = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L49_C8", "label": "assign", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L48_C4", "vector": [14, 2, 0.1586, 0.0032, 2, 0.85, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._session[key] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L50_C8", "label": "self.modified =", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L48_C4", "vector": [14, 2, 0.1618, 0.0032, 2, 0.85, 1.0, 763, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.modified", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.modified = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L52_C4", "label": "__delitem__", "type": "function", "loc": [52, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.1715, 0.0097, 1, 0.95, 0.1628, 66, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__delitem__", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __delitem__(self, key):\n del self._session[key]\n self.modified = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L54_C8", "label": "self.modified =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L52_C4", "vector": [14, 2, 0.1748, 0.0032, 2, 0.22, 0.0, 763, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.modified", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.modified = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L56_C4", "label": "keys", "type": "function", "loc": [56, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.1828, 0.0065, 1, 0.95, 0.186, 204, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "keys", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def keys(self):\n return self._session.keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L57_C8", "label": "return", "type": "return", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L56_C4", "vector": [13, 2, 0.1845, 0.0032, 2, 0.73, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._session.keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L59_C4", "label": "items", "type": "function", "loc": [59, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.1926, 0.0065, 1, 0.95, 0.2093, 339, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "items", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def items(self):\n return self._session.items()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L60_C8", "label": "return", "type": "return", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L59_C4", "vector": [13, 2, 0.1942, 0.0032, 2, 0.42, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._session.items()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L62_C4", "label": "get", "type": "function", "loc": [62, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.2023, 0.0065, 1, 0.95, 0.2326, 607, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "get", "arg_names": ["self", "key", "default"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self, key, default=None):\n return self._session.get(key, default)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L63_C8", "label": "return", "type": "return", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L62_C4", "vector": [13, 2, 0.2039, 0.0032, 2, 0.39, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._session.get(key, default)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L65_C4", "label": "pop", "type": "function", "loc": [65, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.2136, 0.0097, 1, 0.95, 0.2558, 969, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "pop", "arg_names": ["self", "key", "args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def pop(self, key, *args):\n self.modified = self.modified or key in self._session\n return self._session.pop(key, *args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L66_C8", "label": "self.modified =", "type": "assigned_variable", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L65_C4", "vector": [14, 2, 0.2136, 0.0032, 2, 0.96, 0.0, 763, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.modified", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.modified = self.modified or key in self._session"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L67_C8", "label": "return", "type": "return", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L65_C4", "vector": [13, 2, 0.2168, 0.0032, 2, 0.96, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._session.pop(key, *args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L69_C4", "label": "setdefault", "type": "function", "loc": [69, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.233, 0.0227, 1, 0.95, 0.2791, 262, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "setdefault", "arg_names": ["self", "key", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def setdefault(self, key, value):\n if key in self._session:\n return self._session[key]\n else:\n self.modified = True\n self._session[key] = value\n return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L70_C8", "label": "if", "type": "if", "loc": [70, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L69_C4", "vector": [4, 2, 0.2346, 0.0194, 2, 0.48, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if key in self._session:\n return self._session[key]\n else:\n self.modified = True\n self._session[key] = value\n return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L71_C12", "label": "return", "type": "return", "loc": [71, 71], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L70_C8", "vector": [13, 3, 0.2298, 0.0032, 3, 0.97, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._session[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L73_C12", "label": "self.modified =", "type": "assigned_variable", "loc": [73, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L70_C8", "vector": [14, 3, 0.2362, 0.0032, 3, 0.97, 0.3333, 763, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.modified", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.modified = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L74_C12", "label": "assign", "type": "assigned_variable", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L70_C8", "vector": [14, 3, 0.2395, 0.0032, 3, 0.97, 0.6667, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._session[key] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L75_C12", "label": "return", "type": "return", "loc": [75, 75], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L70_C8", "vector": [13, 3, 0.2427, 0.0032, 3, 0.97, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L77_C4", "label": "set_test_cookie", "type": "function", "loc": [77, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.2508, 0.0065, 1, 0.95, 0.3023, 915, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "set_test_cookie", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_test_cookie(self):\n self[self.TEST_COOKIE_NAME] = self.TEST_COOKIE_VALUE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L78_C8", "label": "assign", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L77_C4", "vector": [14, 2, 0.2524, 0.0032, 2, 0.13, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self[self.TEST_COOKIE_NAME] = self.TEST_COOKIE_VALUE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L80_C4", "label": "test_cookie_worked", "type": "function", "loc": [80, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.2605, 0.0065, 1, 0.95, 0.3256, 696, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "test_cookie_worked", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_cookie_worked(self):\n return self.get(self.TEST_COOKIE_NAME) == self.TEST_COOKIE_VALUE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L81_C8", "label": "return", "type": "return", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L80_C4", "vector": [13, 2, 0.2621, 0.0032, 2, 0.4, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get(self.TEST_COOKIE_NAME) == self.TEST_COOKIE_VALUE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L83_C4", "label": "delete_test_cookie", "type": "function", "loc": [83, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.2702, 0.0065, 1, 0.95, 0.3488, 358, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "delete_test_cookie", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def delete_test_cookie(self):\n del self[self.TEST_COOKIE_NAME]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L86_C4", "label": "_hash", "type": "function", "loc": [86, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.2816, 0.0097, 1, 0.95, 0.3721, 202, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "_hash", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _hash(self, value):\n key_salt = \"django.contrib.sessions\" + self.__class__.__name__\n return salted_hmac(key_salt, value).hexdigest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L87_C8", "label": "key_salt =", "type": "assigned_variable", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L86_C4", "vector": [14, 2, 0.2816, 0.0032, 2, 0.8, 0.0, 643, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "key_salt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key_salt = \"django.contrib.sessions\" + self.__class__.__name__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L88_C8", "label": "return", "type": "return", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L86_C4", "vector": [13, 2, 0.2848, 0.0032, 2, 0.8, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return salted_hmac(key_salt, value).hexdigest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L90_C4", "label": "encode", "type": "function", "loc": [90, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.2977, 0.0162, 1, 0.95, 0.3953, 623, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "encode", "arg_names": ["self", "session_dict"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def encode(self, session_dict):\n \"Returns the given session dictionary pickled and encoded as a string.\"\n pickled = pickle.dumps(session_dict, pickle.HIGHEST_PROTOCOL)\n hash = self._hash(pickled)\n return base64.encodestring(hash + \":\" + pickled)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L91_C8", "label": "expression", "type": "expression", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L90_C4", "vector": [8, 2, 0.2945, 0.0032, 2, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns the given session dictionary pickled and encoded as a string.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L92_C8", "label": "pickled = dumps()", "type": "assigned_variable", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L90_C4", "vector": [14, 2, 0.2977, 0.0032, 2, 0.72, 0.3333, 271, 3, 2, 0, 0, 160, 10, 1], "semantic": {"name": "pickled", "arg_names": [], "import_names": [], "rhs_call_name": "dumps", "annotation": ""}, "snippet": " pickled = pickle.dumps(session_dict, pickle.HIGHEST_PROTOCOL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L93_C8", "label": "hash = _hash()", "type": "assigned_variable", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L90_C4", "vector": [14, 2, 0.301, 0.0032, 2, 0.72, 0.6667, 58, 3, 1, 0, 0, 202, 10, 1], "semantic": {"name": "hash", "arg_names": [], "import_names": [], "rhs_call_name": "_hash", "annotation": ""}, "snippet": " hash = self._hash(pickled)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L94_C8", "label": "return", "type": "return", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L90_C4", "vector": [13, 2, 0.3042, 0.0032, 2, 0.72, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return base64.encodestring(hash + \":\" + pickled)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L96_C4", "label": "decode", "type": "function", "loc": [96, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.343, 0.068, 1, 0.95, 0.4186, 528, 0, 2, 1, 0, 0, 0, 7], "semantic": {"name": "decode", "arg_names": ["self", "session_data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def decode(self, session_data):\n encoded_data = base64.decodestring(session_data)\n try:\n # could produce ValueError if there is no ':'\n hash, pickled = encoded_data.split(':', 1)\n expected_hash = self._hash(pickled)\n if not constant_time_compare(hash, expected_hash):\n raise SuspiciousOperation(\"Session data corrupted\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L97_C8", "label": "encoded_data = decodestring()", "type": "assigned_variable", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L96_C4", "vector": [14, 2, 0.3139, 0.0032, 2, 0.24, 0.0, 185, 3, 1, 0, 0, 480, 10, 1], "semantic": {"name": "encoded_data", "arg_names": [], "import_names": [], "rhs_call_name": "decodestring", "annotation": ""}, "snippet": " encoded_data = base64.decodestring(session_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L98_C8", "label": "try", "type": "try", "loc": [98, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L96_C4", "vector": [7, 2, 0.3463, 0.0615, 2, 0.24, 1.0, 0, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # could produce ValueError if there is no ':'\n hash, pickled = encoded_data.split(':', 1)\n expected_hash = self._hash(pickled)\n if not constant_time_compare(hash, expected_hash):\n raise SuspiciousOperation(\"Session data corrupted\")\n else:\n return pickle.loads(pickled)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L100_C12", "label": "hash, pickled = split()", "type": "assigned_variable", "loc": [100, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L98_C8", "vector": [14, 3, 0.3236, 0.0032, 3, 0.23, 0.0, 459, 3, 2, 0, 0, 908, 10, 1], "semantic": {"name": "hash, pickled", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " hash, pickled = encoded_data.split(':', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L101_C12", "label": "expected_hash = _hash()", "type": "assigned_variable", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L98_C8", "vector": [14, 3, 0.3269, 0.0032, 3, 0.23, 0.5, 689, 3, 1, 0, 0, 202, 10, 1], "semantic": {"name": "expected_hash", "arg_names": [], "import_names": [], "rhs_call_name": "_hash", "annotation": ""}, "snippet": " expected_hash = self._hash(pickled)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L102_C12", "label": "if", "type": "if", "loc": [102, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L98_C8", "vector": [4, 3, 0.335, 0.0129, 3, 0.23, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not constant_time_compare(hash, expected_hash):\n raise SuspiciousOperation(\"Session data corrupted\")\n else:\n return pickle.loads(pickled)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L105_C16", "label": "return", "type": "return", "loc": [105, 105], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L102_C12", "vector": [13, 4, 0.3398, 0.0032, 4, 0.19, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return pickle.loads(pickled)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L111_C12", "label": "try", "type": "try", "loc": [111, 116], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L98_C8", "vector": [7, 3, 0.3673, 0.0194, 3, 0.23, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return self._decode_old(session_data)\n except Exception:\n # Unpickling can cause a variety of exceptions. If something happens,\n # just return an empty dictionary (an empty session).\n return {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L112_C16", "label": "return", "type": "return", "loc": [112, 112], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L111_C12", "vector": [13, 4, 0.3625, 0.0032, 4, 0.11, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._decode_old(session_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L116_C16", "label": "return", "type": "return", "loc": [116, 116], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L111_C12", "vector": [13, 4, 0.3754, 0.0032, 4, 0.11, 0.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L118_C4", "label": "_decode_old", "type": "function", "loc": [118, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.3916, 0.0227, 1, 0.95, 0.4419, 836, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "_decode_old", "arg_names": ["self", "session_data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _decode_old(self, session_data):\n encoded_data = base64.decodestring(session_data)\n pickled, tamper_check = encoded_data[:-32], encoded_data[-32:]\n if not constant_time_compare(md5_constructor(pickled + settings.SECRET_KEY).hexdigest(),\n tamper_check):\n raise SuspiciousOperation(\"User tampered with session cookie.\")\n return pickle.loads(pickled)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L119_C8", "label": "encoded_data = decodestring()", "type": "assigned_variable", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L118_C4", "vector": [14, 2, 0.3851, 0.0032, 2, 0.88, 0.0, 185, 3, 1, 0, 0, 480, 10, 1], "semantic": {"name": "encoded_data", "arg_names": [], "import_names": [], "rhs_call_name": "decodestring", "annotation": ""}, "snippet": " encoded_data = base64.decodestring(session_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L120_C8", "label": "pickled, tamper_check =", "type": "assigned_variable", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L118_C4", "vector": [14, 2, 0.3883, 0.0032, 2, 0.88, 0.3333, 552, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "pickled, tamper_check", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pickled, tamper_check = encoded_data[:-32], encoded_data[-32:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L121_C8", "label": "if", "type": "if", "loc": [121, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L118_C4", "vector": [4, 2, 0.3948, 0.0097, 2, 0.88, 0.6667, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not constant_time_compare(md5_constructor(pickled + settings.SECRET_KEY).hexdigest(),\n tamper_check):\n raise SuspiciousOperation(\"User tampered with session cookie.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L124_C8", "label": "return", "type": "return", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L118_C4", "vector": [13, 2, 0.4013, 0.0032, 2, 0.88, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return pickle.loads(pickled)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L126_C4", "label": "update", "type": "function", "loc": [126, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.411, 0.0097, 1, 0.95, 0.4651, 637, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": ["self", "dict_"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def update(self, dict_):\n self._session.update(dict_)\n self.modified = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L127_C8", "label": "update()", "type": "expression", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L126_C4", "vector": [8, 2, 0.411, 0.0032, 2, 0.74, 0.0, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self._session.update(dict_)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L128_C8", "label": "self.modified =", "type": "assigned_variable", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L126_C4", "vector": [14, 2, 0.4142, 0.0032, 2, 0.74, 1.0, 763, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.modified", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.modified = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L130_C4", "label": "has_key", "type": "function", "loc": [130, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.4223, 0.0065, 1, 0.95, 0.4884, 882, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "has_key", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def has_key(self, key):\n return self._session.has_key(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L131_C8", "label": "return", "type": "return", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L130_C4", "vector": [13, 2, 0.4239, 0.0032, 2, 0.73, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._session.has_key(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L133_C4", "label": "values", "type": "function", "loc": [133, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.432, 0.0065, 1, 0.95, 0.5116, 721, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "values", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def values(self):\n return self._session.values()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L134_C8", "label": "return", "type": "return", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L133_C4", "vector": [13, 2, 0.4337, 0.0032, 2, 0.62, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._session.values()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L136_C4", "label": "iterkeys", "type": "function", "loc": [136, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.4417, 0.0065, 1, 0.95, 0.5349, 232, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "iterkeys", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def iterkeys(self):\n return self._session.iterkeys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L137_C8", "label": "return", "type": "return", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L136_C4", "vector": [13, 2, 0.4434, 0.0032, 2, 0.97, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._session.iterkeys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L139_C4", "label": "itervalues", "type": "function", "loc": [139, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.4515, 0.0065, 1, 0.95, 0.5581, 288, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "itervalues", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def itervalues(self):\n return self._session.itervalues()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L140_C8", "label": "return", "type": "return", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L139_C4", "vector": [13, 2, 0.4531, 0.0032, 2, 0.18, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._session.itervalues()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L142_C4", "label": "iteritems", "type": "function", "loc": [142, 143], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.4612, 0.0065, 1, 0.95, 0.5814, 252, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "iteritems", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def iteritems(self):\n return self._session.iteritems()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L143_C8", "label": "return", "type": "return", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L142_C4", "vector": [13, 2, 0.4628, 0.0032, 2, 0.98, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._session.iteritems()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L145_C4", "label": "clear", "type": "function", "loc": [145, 151], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.479, 0.0227, 1, 0.95, 0.6047, 712, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "clear", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clear(self):\n # To avoid unnecessary persistent storage accesses, we set up the\n # internals directly (loading data wastes time, since we are going to\n # set it to an empty dict anyway).\n self._session_cache = {}\n self.accessed = True\n self.modified = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L149_C8", "label": "self._session_cache =", "type": "assigned_variable", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L145_C4", "vector": [14, 2, 0.4822, 0.0032, 2, 0.64, 0.0, 37, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self._session_cache", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._session_cache = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L150_C8", "label": "self.accessed =", "type": "assigned_variable", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L145_C4", "vector": [14, 2, 0.4854, 0.0032, 2, 0.64, 0.5, 453, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.accessed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.accessed = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L151_C8", "label": "self.modified =", "type": "assigned_variable", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L145_C4", "vector": [14, 2, 0.4887, 0.0032, 2, 0.64, 1.0, 763, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.modified", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.modified = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L153_C4", "label": "_get_new_session_key", "type": "function", "loc": [153, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.5194, 0.0518, 1, 0.95, 0.6279, 936, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "_get_new_session_key", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_new_session_key(self):\n \"Returns session key that isn't being used.\"\n # The random module is seeded when this Apache child is created.\n # Use settings.SECRET_KEY as added salt.\n try:\n pid = os.getpid()\n except AttributeError:\n # No getpid() in Jython, for example"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L154_C8", "label": "expression", "type": "expression", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L153_C4", "vector": [8, 2, 0.4984, 0.0032, 2, 0.92, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Returns session key that isn't being used.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L157_C8", "label": "try", "type": "try", "loc": [157, 161], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L153_C4", "vector": [7, 2, 0.5146, 0.0162, 2, 0.92, 0.3333, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n pid = os.getpid()\n except AttributeError:\n # No getpid() in Jython, for example\n pid = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L158_C12", "label": "pid = getpid()", "type": "assigned_variable", "loc": [158, 158], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L157_C8", "vector": [14, 3, 0.5113, 0.0032, 3, 0.33, 0.0, 838, 3, 0, 0, 0, 896, 10, 1], "semantic": {"name": "pid", "arg_names": [], "import_names": [], "rhs_call_name": "getpid", "annotation": ""}, "snippet": " pid = os.getpid()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L161_C12", "label": "pid =", "type": "assigned_variable", "loc": [161, 161], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L157_C8", "vector": [14, 3, 0.521, 0.0032, 3, 0.33, 0.0, 838, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "pid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pid = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:While_L162_C8", "label": "while", "type": "while", "loc": [162, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L153_C4", "vector": [5, 2, 0.5324, 0.0194, 2, 0.92, 0.6667, 0, 1, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while 1:\n session_key = md5_constructor(\"%s%s%s%s\"\n % (randrange(0, MAX_SESSION_KEY), pid, time.time(),\n settings.SECRET_KEY)).hexdigest()\n if not self.exists(session_key):\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L163_C12", "label": "session_key = hexdigest()", "type": "assigned_variable", "loc": [163, 165], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:While_L162_C8", "vector": [14, 3, 0.5307, 0.0097, 3, 0.08, 0.0, 555, 3, 0, 0, 0, 89, 10, 4], "semantic": {"name": "session_key", "arg_names": [], "import_names": [], "rhs_call_name": "hexdigest", "annotation": ""}, "snippet": " session_key = md5_constructor(\"%s%s%s%s\"\n % (randrange(0, MAX_SESSION_KEY), pid, time.time(),\n settings.SECRET_KEY)).hexdigest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L166_C12", "label": "if", "type": "if", "loc": [166, 167], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:While_L162_C8", "vector": [4, 3, 0.5388, 0.0065, 3, 0.08, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.exists(session_key):\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L168_C8", "label": "return", "type": "return", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L153_C4", "vector": [13, 2, 0.5437, 0.0032, 2, 0.92, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return session_key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L170_C4", "label": "_get_session_key", "type": "function", "loc": [170, 175], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.5583, 0.0194, 1, 0.95, 0.6512, 663, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "_get_session_key", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_session_key(self):\n if self._session_key:\n return self._session_key\n else:\n self._session_key = self._get_new_session_key()\n return self._session_key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L171_C8", "label": "if", "type": "if", "loc": [171, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L170_C4", "vector": [4, 2, 0.5599, 0.0162, 2, 0.73, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._session_key:\n return self._session_key\n else:\n self._session_key = self._get_new_session_key()\n return self._session_key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L172_C12", "label": "return", "type": "return", "loc": [172, 172], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L171_C8", "vector": [13, 3, 0.5566, 0.0032, 3, 0.8, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._session_key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L174_C12", "label": "self._session_key = _get_new_session_key()", "type": "assigned_variable", "loc": [174, 174], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L171_C8", "vector": [14, 3, 0.5631, 0.0032, 3, 0.8, 0.5, 987, 3, 0, 0, 0, 936, 10, 1], "semantic": {"name": "self._session_key", "arg_names": [], "import_names": [], "rhs_call_name": "_get_new_session_key", "annotation": ""}, "snippet": " self._session_key = self._get_new_session_key()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L175_C12", "label": "return", "type": "return", "loc": [175, 175], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L171_C8", "vector": [13, 3, 0.5663, 0.0032, 3, 0.8, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._session_key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L177_C4", "label": "_set_session_key", "type": "function", "loc": [177, 178], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.5744, 0.0065, 1, 0.95, 0.6744, 584, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "_set_session_key", "arg_names": ["self", "session_key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_session_key(self, session_key):\n self._session_key = session_key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L178_C8", "label": "self._session_key =", "type": "assigned_variable", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L177_C4", "vector": [14, 2, 0.5761, 0.0032, 2, 0.34, 0.0, 987, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._session_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._session_key = session_key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L180_C4", "label": "session_key = property()", "type": "assigned_variable", "loc": [180, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [14, 1, 0.5825, 0.0032, 1, 0.95, 0.6977, 555, 3, 2, 0, 0, 244, 10, 1], "semantic": {"name": "session_key", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " session_key = property(_get_session_key, _set_session_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L182_C4", "label": "_get_session", "type": "function", "loc": [182, 195], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.61, 0.0453, 1, 0.95, 0.7209, 988, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "_get_session", "arg_names": ["self", "no_load"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_session(self, no_load=False):\n \"\"\"\n Lazily loads session from storage (unless \"no_load\" is True, when only\n an empty dict is stored) and stores it in the current instance.\n \"\"\"\n self.accessed = True\n try:\n return self._session_cache"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L183_C8", "label": "expression", "type": "expression", "loc": [183, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L182_C4", "vector": [8, 2, 0.5971, 0.0129, 2, 0.97, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Lazily loads session from storage (unless \"no_load\" is True, when only\n an empty dict is stored) and stores it in the current instance.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L187_C8", "label": "self.accessed =", "type": "assigned_variable", "loc": [187, 187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L182_C4", "vector": [14, 2, 0.6052, 0.0032, 2, 0.97, 0.3333, 453, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.accessed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.accessed = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L188_C8", "label": "try", "type": "try", "loc": [188, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L182_C4", "vector": [7, 2, 0.6181, 0.0227, 2, 0.97, 0.6667, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return self._session_cache\n except AttributeError:\n if self._session_key is None or no_load:\n self._session_cache = {}\n else:\n self._session_cache = self.load()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L189_C12", "label": "return", "type": "return", "loc": [189, 189], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L188_C8", "vector": [13, 3, 0.6117, 0.0032, 3, 0.02, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._session_cache"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L191_C12", "label": "if", "type": "if", "loc": [191, 194], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L188_C8", "vector": [4, 3, 0.623, 0.0129, 3, 0.02, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._session_key is None or no_load:\n self._session_cache = {}\n else:\n self._session_cache = self.load()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L192_C16", "label": "self._session_cache =", "type": "assigned_variable", "loc": [192, 192], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L191_C12", "vector": [14, 4, 0.6214, 0.0032, 4, 0.46, 0.0, 37, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self._session_cache", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._session_cache = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L194_C16", "label": "self._session_cache = load()", "type": "assigned_variable", "loc": [194, 194], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L191_C12", "vector": [14, 4, 0.6278, 0.0032, 4, 0.46, 1.0, 37, 3, 0, 0, 0, 37, 10, 1], "semantic": {"name": "self._session_cache", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " self._session_cache = self.load()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L195_C8", "label": "return", "type": "return", "loc": [195, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L182_C4", "vector": [13, 2, 0.6311, 0.0032, 2, 0.97, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._session_cache"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L197_C4", "label": "_session = property()", "type": "assigned_variable", "loc": [197, 197], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [14, 1, 0.6375, 0.0032, 1, 0.95, 0.7442, 328, 3, 1, 0, 0, 244, 10, 1], "semantic": {"name": "_session", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " _session = property(_get_session)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L199_C4", "label": "get_expiry_age", "type": "function", "loc": [199, 207], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.657, 0.0291, 1, 0.95, 0.7674, 94, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "get_expiry_age", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_expiry_age(self):\n \"\"\"Get the number of seconds until the session expires.\"\"\"\n expiry = self.get('_session_expiry')\n if not expiry: # Checks both None and 0 cases\n return settings.SESSION_COOKIE_AGE\n if not isinstance(expiry, datetime):\n return expiry\n delta = expiry - datetime.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L200_C8", "label": "expression", "type": "expression", "loc": [200, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L199_C4", "vector": [8, 2, 0.6472, 0.0032, 2, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Get the number of seconds until the session expires.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L201_C8", "label": "expiry = get()", "type": "assigned_variable", "loc": [201, 201], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L199_C4", "vector": [14, 2, 0.6505, 0.0032, 2, 0.54, 0.2, 993, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "expiry", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " expiry = self.get('_session_expiry')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L202_C8", "label": "if", "type": "if", "loc": [202, 203], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L199_C4", "vector": [4, 2, 0.6553, 0.0065, 2, 0.54, 0.4, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not expiry: # Checks both None and 0 cases\n return settings.SESSION_COOKIE_AGE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L203_C12", "label": "return", "type": "return", "loc": [203, 203], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L202_C8", "vector": [13, 3, 0.657, 0.0032, 3, 0.79, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return settings.SESSION_COOKIE_AGE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L204_C8", "label": "if", "type": "if", "loc": [204, 205], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L199_C4", "vector": [4, 2, 0.6618, 0.0065, 2, 0.54, 0.6, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(expiry, datetime):\n return expiry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L205_C12", "label": "return", "type": "return", "loc": [205, 205], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L204_C8", "vector": [13, 3, 0.6634, 0.0032, 3, 0.71, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return expiry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L206_C8", "label": "delta =", "type": "assigned_variable", "loc": [206, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L199_C4", "vector": [14, 2, 0.6667, 0.0032, 2, 0.54, 0.8, 593, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "delta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " delta = expiry - datetime.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L207_C8", "label": "return", "type": "return", "loc": [207, 207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L199_C4", "vector": [13, 2, 0.6699, 0.0032, 2, 0.54, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return delta.days * 86400 + delta.seconds"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L209_C4", "label": "get_expiry_date", "type": "function", "loc": [209, 216], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.6877, 0.0259, 1, 0.95, 0.7907, 787, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "get_expiry_date", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_expiry_date(self):\n \"\"\"Get session the expiry date (as a datetime object).\"\"\"\n expiry = self.get('_session_expiry')\n if isinstance(expiry, datetime):\n return expiry\n if not expiry: # Checks both None and 0 cases\n expiry = settings.SESSION_COOKIE_AGE\n return datetime.now() + timedelta(seconds=expiry)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L210_C8", "label": "expression", "type": "expression", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L209_C4", "vector": [8, 2, 0.6796, 0.0032, 2, 0.99, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Get session the expiry date (as a datetime object).\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L211_C8", "label": "expiry = get()", "type": "assigned_variable", "loc": [211, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L209_C4", "vector": [14, 2, 0.6828, 0.0032, 2, 0.99, 0.25, 993, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "expiry", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " expiry = self.get('_session_expiry')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L212_C8", "label": "if", "type": "if", "loc": [212, 213], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L209_C4", "vector": [4, 2, 0.6877, 0.0065, 2, 0.99, 0.5, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(expiry, datetime):\n return expiry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L213_C12", "label": "return", "type": "return", "loc": [213, 213], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L212_C8", "vector": [13, 3, 0.6893, 0.0032, 3, 0.93, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return expiry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L214_C8", "label": "if", "type": "if", "loc": [214, 215], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L209_C4", "vector": [4, 2, 0.6942, 0.0065, 2, 0.99, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not expiry: # Checks both None and 0 cases\n expiry = settings.SESSION_COOKIE_AGE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L215_C12", "label": "expiry =", "type": "assigned_variable", "loc": [215, 215], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L214_C8", "vector": [14, 3, 0.6958, 0.0032, 3, 0.26, 0.0, 993, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "expiry", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expiry = settings.SESSION_COOKIE_AGE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L216_C8", "label": "return", "type": "return", "loc": [216, 216], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L209_C4", "vector": [13, 2, 0.699, 0.0032, 2, 0.99, 1.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return datetime.now() + timedelta(seconds=expiry)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L218_C4", "label": "set_expiry", "type": "function", "loc": [218, 242], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.7443, 0.0809, 1, 0.95, 0.814, 454, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "set_expiry", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_expiry(self, value):\n \"\"\"\n Sets a custom expiration for the session. ``value`` can be an integer,\n a Python ``datetime`` or ``timedelta`` object or ``None``.\n\n If ``value`` is an integer, the session will expire after that many\n seconds of inactivity. If set to ``0`` then the session will expire on\n browser close."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L219_C8", "label": "expression", "type": "expression", "loc": [219, 232], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L218_C4", "vector": [8, 2, 0.7298, 0.0453, 2, 0.7, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Sets a custom expiration for the session. ``value`` can be an integer,\n a Python ``datetime`` or ``timedelta`` object or ``None``.\n\n If ``value`` is an integer, the session will expire after that many\n seconds of inactivity. If set to ``0`` then the session will expire on\n browser close.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L233_C8", "label": "if", "type": "if", "loc": [233, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L218_C4", "vector": [4, 2, 0.7638, 0.0227, 2, 0.7, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value is None:\n # Remove any custom expiration for this session.\n try:\n del self['_session_expiry']\n except KeyError:\n pass\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L235_C12", "label": "try", "type": "try", "loc": [235, 238], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L233_C8", "vector": [7, 3, 0.7654, 0.0129, 3, 0.69, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n del self['_session_expiry']\n except KeyError:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L239_C12", "label": "return", "type": "return", "loc": [239, 239], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L233_C8", "vector": [13, 3, 0.7735, 0.0032, 3, 0.69, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L240_C8", "label": "if", "type": "if", "loc": [240, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L218_C4", "vector": [4, 2, 0.7783, 0.0065, 2, 0.7, 0.6667, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, timedelta):\n value = datetime.now() + value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L241_C12", "label": "value =", "type": "assigned_variable", "loc": [241, 241], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L240_C8", "vector": [14, 3, 0.7799, 0.0032, 3, 0.38, 0.0, 441, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = datetime.now() + value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L242_C8", "label": "assign", "type": "assigned_variable", "loc": [242, 242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L218_C4", "vector": [14, 2, 0.7832, 0.0032, 2, 0.7, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['_session_expiry'] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L244_C4", "label": "get_expire_at_browser_close", "type": "function", "loc": [244, 253], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.8042, 0.0324, 1, 0.95, 0.8372, 86, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "get_expire_at_browser_close", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_expire_at_browser_close(self):\n \"\"\"\n Returns ``True`` if the session is set to expire when the browser\n closes, and ``False`` if there's an expiry date. Use\n ``get_expiry_date()`` or ``get_expiry_age()`` to find the actual expiry\n date/age, if there is one.\n \"\"\"\n if self.get('_session_expiry') is None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L245_C8", "label": "expression", "type": "expression", "loc": [245, 250], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L244_C4", "vector": [8, 2, 0.801, 0.0194, 2, 0.79, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns ``True`` if the session is set to expire when the browser\n closes, and ``False`` if there's an expiry date. Use\n ``get_expiry_date()`` or ``get_expiry_age()`` to find the actual expiry\n date/age, if there is one.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L251_C8", "label": "if", "type": "if", "loc": [251, 252], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L244_C4", "vector": [4, 2, 0.8139, 0.0065, 2, 0.79, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.get('_session_expiry') is None:\n return settings.SESSION_EXPIRE_AT_BROWSER_CLOSE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L252_C12", "label": "return", "type": "return", "loc": [252, 252], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L251_C8", "vector": [13, 3, 0.8155, 0.0032, 3, 0.96, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return settings.SESSION_EXPIRE_AT_BROWSER_CLOSE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L253_C8", "label": "return", "type": "return", "loc": [253, 253], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L244_C4", "vector": [13, 2, 0.8188, 0.0032, 2, 0.79, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get('_session_expiry') == 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L255_C4", "label": "flush", "type": "function", "loc": [255, 262], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.8366, 0.0259, 1, 0.95, 0.8605, 439, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "flush", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def flush(self):\n \"\"\"\n Removes the current session data from the database and regenerates the\n key.\n \"\"\"\n self.clear()\n self.delete()\n self.create()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L256_C8", "label": "expression", "type": "expression", "loc": [256, 259], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L255_C4", "vector": [8, 2, 0.8333, 0.0129, 2, 0.32, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Removes the current session data from the database and regenerates the\n key.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L260_C8", "label": "clear()", "type": "expression", "loc": [260, 260], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L255_C4", "vector": [8, 2, 0.8414, 0.0032, 2, 0.32, 0.3333, 712, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "clear", "arg_names": [], "import_names": [], "rhs_call_name": "clear", "annotation": ""}, "snippet": " self.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L261_C8", "label": "delete()", "type": "expression", "loc": [261, 261], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L255_C4", "vector": [8, 2, 0.8447, 0.0032, 2, 0.32, 0.6667, 266, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " self.delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L262_C8", "label": "create()", "type": "expression", "loc": [262, 262], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L255_C4", "vector": [8, 2, 0.8479, 0.0032, 2, 0.32, 1.0, 316, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "create", "arg_names": [], "import_names": [], "rhs_call_name": "create", "annotation": ""}, "snippet": " self.create()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L264_C4", "label": "cycle_key", "type": "function", "loc": [264, 272], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.8673, 0.0291, 1, 0.95, 0.8837, 573, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "cycle_key", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def cycle_key(self):\n \"\"\"\n Creates a new session key, whilst retaining the current session data.\n \"\"\"\n data = self._session_cache\n key = self.session_key\n self.create()\n self._session_cache = data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L265_C8", "label": "expression", "type": "expression", "loc": [265, 267], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L264_C4", "vector": [8, 2, 0.8608, 0.0097, 2, 0.14, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Creates a new session key, whilst retaining the current session data.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L268_C8", "label": "data =", "type": "assigned_variable", "loc": [268, 268], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L264_C4", "vector": [14, 2, 0.8673, 0.0032, 2, 0.14, 0.2, 929, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = self._session_cache"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L269_C8", "label": "key =", "type": "assigned_variable", "loc": [269, 269], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L264_C4", "vector": [14, 2, 0.8706, 0.0032, 2, 0.14, 0.4, 230, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = self.session_key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L270_C8", "label": "create()", "type": "expression", "loc": [270, 270], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L264_C4", "vector": [8, 2, 0.8738, 0.0032, 2, 0.14, 0.6, 316, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "create", "arg_names": [], "import_names": [], "rhs_call_name": "create", "annotation": ""}, "snippet": " self.create()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L271_C8", "label": "self._session_cache =", "type": "assigned_variable", "loc": [271, 271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L264_C4", "vector": [14, 2, 0.877, 0.0032, 2, 0.14, 0.8, 37, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._session_cache", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._session_cache = data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L272_C8", "label": "delete()", "type": "expression", "loc": [272, 272], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L264_C4", "vector": [8, 2, 0.8803, 0.0032, 2, 0.14, 1.0, 266, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " self.delete(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L276_C4", "label": "exists", "type": "function", "loc": [276, 280], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.8997, 0.0162, 1, 0.95, 0.907, 829, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "exists", "arg_names": ["self", "session_key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def exists(self, session_key):\n \"\"\"\n Returns True if the given session_key already exists.\n \"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L277_C8", "label": "expression", "type": "expression", "loc": [277, 279], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L276_C4", "vector": [8, 2, 0.8997, 0.0097, 2, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns True if the given session_key already exists.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L282_C4", "label": "create", "type": "function", "loc": [282, 288], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.9223, 0.0227, 1, 0.95, 0.9302, 316, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "create", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def create(self):\n \"\"\"\n Creates a new session instance. Guaranteed to create a new object with\n a unique key and will have saved the result once (with empty data)\n before the method returns.\n \"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L283_C8", "label": "expression", "type": "expression", "loc": [283, 287], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L282_C4", "vector": [8, 2, 0.9223, 0.0162, 2, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Creates a new session instance. Guaranteed to create a new object with\n a unique key and will have saved the result once (with empty data)\n before the method returns.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L290_C4", "label": "save", "type": "function", "loc": [290, 296], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.9482, 0.0227, 1, 0.95, 0.9535, 928, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "save", "arg_names": ["self", "must_create"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def save(self, must_create=False):\n \"\"\"\n Saves the session data. If 'must_create' is True, a new session object\n is created (otherwise a CreateError exception is raised). Otherwise,\n save() can update an existing object with the same key.\n \"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L291_C8", "label": "expression", "type": "expression", "loc": [291, 295], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L290_C4", "vector": [8, 2, 0.9482, 0.0162, 2, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Saves the session data. If 'must_create' is True, a new session object\n is created (otherwise a CreateError exception is raised). Otherwise,\n save() can update an existing object with the same key.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L298_C4", "label": "delete", "type": "function", "loc": [298, 303], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.9725, 0.0194, 1, 0.95, 0.9767, 266, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "delete", "arg_names": ["self", "session_key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def delete(self, session_key=None):\n \"\"\"\n Deletes the session data under this key. If the key is None, the\n current session key value is used.\n \"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L299_C8", "label": "expression", "type": "expression", "loc": [299, 302], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L298_C4", "vector": [8, 2, 0.9725, 0.0129, 2, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Deletes the session data under this key. If the key is None, the\n current session key value is used.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L305_C4", "label": "load", "type": "function", "loc": [305, 309], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "vector": [2, 1, 0.9935, 0.0162, 1, 0.95, 1.0, 37, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "load", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def load(self):\n \"\"\"\n Loads the session data and returns a dictionary.\n \"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L306_C8", "label": "expression", "type": "expression", "loc": [306, 308], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L305_C4", "vector": [8, 2, 0.9935, 0.0097, 2, 0.69, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Loads the session data and returns a dictionary.\n \"\"\""}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Import_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Import_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L65_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L65_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L71_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L73_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L74_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L75_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L90_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L90_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L90_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L90_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L98_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L100_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L98_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L101_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L98_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L102_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L102_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L105_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L98_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L111_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L111_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L112_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L111_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L116_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L118_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L139_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L142_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L157_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L158_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L157_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L161_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:While_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:While_L162_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L163_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:While_L162_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L166_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L170_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L170_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L171_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L171_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L172_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L171_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L174_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L171_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L175_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L177_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L177_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L178_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L180_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L187_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L188_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L188_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L189_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L188_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L191_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L191_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L192_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L191_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L194_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L195_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L197_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L199_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L199_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L201_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L199_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L202_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L202_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L203_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L199_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L204_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L204_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L205_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L199_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L206_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L199_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L207_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L209_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L209_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L210_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L209_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L211_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L209_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L212_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L212_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L213_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L209_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L214_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L214_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L215_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L209_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L216_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L218_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L218_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L219_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L218_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L233_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L233_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L235_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L233_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L239_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L218_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L240_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L241_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L218_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L242_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L244_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L245_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:If_L251_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L252_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Return_L253_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L255_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L255_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L256_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L255_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L260_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L255_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L261_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L255_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L262_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L264_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L264_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L265_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L264_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L268_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L264_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L269_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L264_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L270_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L264_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Assign_L271_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L264_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L272_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L276_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L276_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L282_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L283_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L290_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L290_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L291_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L298_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L298_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L299_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L305_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:FunctionDef_L305_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Expr_L306_C8"}] |
"""
Cached, database-backed sessions.
"""
from django.conf import settings
from django.contrib.sessions.backends.db import SessionStore as DBStore
from django.core.cache import cache
class SessionStore(DBStore):
"""
Implements cached, database backed sessions.
"""
def __init__(self, session_key=None):
super(SessionStore, self).__init__(session_key)
def load(self):
data = cache.get(self.session_key, None)
if data is None:
data = super(SessionStore, self).load()
cache.set(self.session_key, data, settings.SESSION_COOKIE_AGE)
return data
def exists(self, session_key):
return super(SessionStore, self).exists(session_key)
def save(self, must_create=False):
super(SessionStore, self).save(must_create)
cache.set(self.session_key, self._session, settings.SESSION_COOKIE_AGE)
def delete(self, session_key=None):
super(SessionStore, self).delete(session_key)
cache.delete(session_key or self.session_key)
def flush(self):
"""
Removes the current session data from the database and regenerates the
key.
"""
self.clear()
self.delete(self.session_key)
self.create() | ajibawa-2023/Python-Code-Large/train/row_98797 | 27 | 42 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98797:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0476, 0.0714, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nCached, database-backed sessions.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:ImportFrom_L5_C0", "label": "from django.conf import settings", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.119, 0.0238, 0, 0.66, 0.25, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:ImportFrom_L6_C0", "label": "from django.contrib.sessions.backends.db import DBStore", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0238, 0, 0.66, 0.5, 857, 0, 1, 0, 0, 857, 0, 0], "semantic": {"name": "django.contrib.sessions.backends.db", "arg_names": [], "import_names": ["DBStore"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.sessions.backends.db import SessionStore as DBStore"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:ImportFrom_L7_C0", "label": "from django.core.cache import cache", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0238, 0, 0.66, 0.75, 734, 0, 1, 0, 0, 734, 0, 0], "semantic": {"name": "django.core.cache", "arg_names": [], "import_names": ["cache"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.cache import cache"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:ClassDef_L9_C0", "label": "SessionStore", "type": "class", "loc": [9, 42], "level": 0, "parent": null, "vector": [3, 0, 0.6071, 0.8095, 0, 0.66, 1.0, 951, 0, 6, 0, 0, 58, 0, 17], "semantic": {"name": "SessionStore", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SessionStore(DBStore):\n \"\"\"\n Implements cached, database backed sessions.\n \"\"\"\n\n def __init__(self, session_key=None):\n super(SessionStore, self).__init__(session_key)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:Expr_L10_C4", "label": "expression", "type": "expression", "loc": [10, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98797:ClassDef_L9_C0", "vector": [8, 1, 0.2619, 0.0714, 1, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Implements cached, database backed sessions.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L14_C4", "label": "__init__", "type": "function", "loc": [14, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98797:ClassDef_L9_C0", "vector": [2, 1, 0.3452, 0.0476, 1, 0.25, 0.1667, 555, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "session_key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, session_key=None):\n super(SessionStore, self).__init__(session_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:Expr_L15_C8", "label": "__init__()", "type": "expression", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L14_C4", "vector": [8, 2, 0.3571, 0.0238, 2, 0.94, 0.0, 555, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(SessionStore, self).__init__(session_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L17_C4", "label": "load", "type": "function", "loc": [17, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98797:ClassDef_L9_C0", "vector": [2, 1, 0.4643, 0.1429, 1, 0.25, 0.3333, 37, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "load", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def load(self):\n data = cache.get(self.session_key, None)\n if data is None:\n data = super(SessionStore, self).load()\n cache.set(self.session_key, data, settings.SESSION_COOKIE_AGE)\n return data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:Assign_L18_C8", "label": "data = get()", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L17_C4", "vector": [14, 2, 0.4286, 0.0238, 2, 0.35, 0.0, 929, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " data = cache.get(self.session_key, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:If_L19_C8", "label": "if", "type": "if", "loc": [19, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L17_C4", "vector": [4, 2, 0.4762, 0.0714, 2, 0.35, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if data is None:\n data = super(SessionStore, self).load()\n cache.set(self.session_key, data, settings.SESSION_COOKIE_AGE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:Assign_L20_C12", "label": "data = load()", "type": "assigned_variable", "loc": [20, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98797:If_L19_C8", "vector": [14, 3, 0.4762, 0.0238, 3, 0.78, 0.0, 929, 3, 0, 0, 0, 37, 10, 2], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " data = super(SessionStore, self).load()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:Expr_L21_C12", "label": "set()", "type": "expression", "loc": [21, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_98797:If_L19_C8", "vector": [8, 3, 0.5, 0.0238, 3, 0.78, 1.0, 21, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "set", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " cache.set(self.session_key, data, settings.SESSION_COOKIE_AGE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:Return_L22_C8", "label": "return", "type": "return", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L17_C4", "vector": [13, 2, 0.5238, 0.0238, 2, 0.35, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L24_C4", "label": "exists", "type": "function", "loc": [24, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98797:ClassDef_L9_C0", "vector": [2, 1, 0.5833, 0.0476, 1, 0.25, 0.5, 829, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "exists", "arg_names": ["self", "session_key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def exists(self, session_key):\n return super(SessionStore, self).exists(session_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:Return_L25_C8", "label": "return", "type": "return", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L24_C4", "vector": [13, 2, 0.5952, 0.0238, 2, 0.67, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return super(SessionStore, self).exists(session_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L27_C4", "label": "save", "type": "function", "loc": [27, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98797:ClassDef_L9_C0", "vector": [2, 1, 0.6667, 0.0714, 1, 0.25, 0.6667, 928, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "save", "arg_names": ["self", "must_create"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def save(self, must_create=False):\n super(SessionStore, self).save(must_create)\n cache.set(self.session_key, self._session, settings.SESSION_COOKIE_AGE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:Expr_L28_C8", "label": "save()", "type": "expression", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L27_C4", "vector": [8, 2, 0.6667, 0.0238, 2, 0.87, 0.0, 928, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " super(SessionStore, self).save(must_create)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:Expr_L29_C8", "label": "set()", "type": "expression", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L27_C4", "vector": [8, 2, 0.6905, 0.0238, 2, 0.87, 1.0, 21, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "set", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " cache.set(self.session_key, self._session, settings.SESSION_COOKIE_AGE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L31_C4", "label": "delete", "type": "function", "loc": [31, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98797:ClassDef_L9_C0", "vector": [2, 1, 0.7619, 0.0714, 1, 0.25, 0.8333, 266, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "delete", "arg_names": ["self", "session_key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def delete(self, session_key=None):\n super(SessionStore, self).delete(session_key)\n cache.delete(session_key or self.session_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:Expr_L32_C8", "label": "delete()", "type": "expression", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L31_C4", "vector": [8, 2, 0.7619, 0.0238, 2, 0.27, 0.0, 266, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " super(SessionStore, self).delete(session_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:Expr_L33_C8", "label": "delete()", "type": "expression", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L31_C4", "vector": [8, 2, 0.7857, 0.0238, 2, 0.27, 1.0, 266, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " cache.delete(session_key or self.session_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L35_C4", "label": "flush", "type": "function", "loc": [35, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_98797:ClassDef_L9_C0", "vector": [2, 1, 0.9167, 0.1905, 1, 0.25, 1.0, 439, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "flush", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def flush(self):\n \"\"\"\n Removes the current session data from the database and regenerates the\n key.\n \"\"\"\n self.clear()\n self.delete(self.session_key)\n self.create()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:Expr_L36_C8", "label": "expression", "type": "expression", "loc": [36, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L35_C4", "vector": [8, 2, 0.8929, 0.0952, 2, 0.23, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Removes the current session data from the database and regenerates the\n key.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:Expr_L40_C8", "label": "clear()", "type": "expression", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L35_C4", "vector": [8, 2, 0.9524, 0.0238, 2, 0.23, 0.3333, 712, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "clear", "arg_names": [], "import_names": [], "rhs_call_name": "clear", "annotation": ""}, "snippet": " self.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:Expr_L41_C8", "label": "delete()", "type": "expression", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L35_C4", "vector": [8, 2, 0.9762, 0.0238, 2, 0.23, 0.6667, 266, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " self.delete(self.session_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98797:Expr_L42_C8", "label": "create()", "type": "expression", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L35_C4", "vector": [8, 2, 1.0, 0.0238, 2, 0.23, 1.0, 316, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "create", "arg_names": [], "import_names": [], "rhs_call_name": "create", "annotation": ""}, "snippet": " self.create()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98797:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98797:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98797:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98797:Expr_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98797:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98797:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98797:If_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98797:If_L19_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98797:Assign_L20_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98797:If_L19_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_98797:Expr_L21_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98797:Return_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98797:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98797:Return_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98797:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98797:Expr_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98797:Expr_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98797:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98797:Expr_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98797:Expr_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98797:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98797:Expr_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98797:Expr_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98797:Expr_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98797:Expr_L42_C8"}] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.